@@ -79,26 +79,32 @@ class EdgeViewFacade(
7979 return
8080 }
8181
82- val sideRotated = data.pos.id.side.rotate(displayRotation)
83- val cornerRotated = data.pos.id.corner.rotate(displayRotation)
82+ var targetSide = data.pos.id.side
83+ var targetCorner = data.pos.id.corner
84+
85+ // edges are rotated with display rotation by default, this rotates them back.
86+ if (! local.repo.rotateEdges) {
87+ targetSide = targetSide.rotate(displayRotation)
88+ targetCorner = targetCorner.rotate(displayRotation)
89+ }
8490
8591 val lengthPct = 1f / data.side.nSegments
86- val windowLength = when (sideRotated ) {
92+ val windowLength = when (targetSide ) {
8793 EdgeSide .Left , EdgeSide .Right -> displayHeight
8894 EdgeSide .Top , EdgeSide .Bottom -> displayWidth
8995 }
9096
9197 val length = (lengthPct * windowLength).roundToInt()
9298
93- windowParams.height = when (sideRotated ) {
99+ windowParams.height = when (targetSide ) {
94100 EdgeSide .Left , EdgeSide .Right -> length
95101 EdgeSide .Top , EdgeSide .Bottom -> data.pos.thickness
96102 }
97- windowParams.width = when (sideRotated ) {
103+ windowParams.width = when (targetSide ) {
98104 EdgeSide .Left , EdgeSide .Right -> data.pos.thickness
99105 EdgeSide .Top , EdgeSide .Bottom -> length
100106 }
101- windowParams.gravity = when (cornerRotated ) {
107+ windowParams.gravity = when (targetCorner ) {
102108 EdgeCorner .BottomRight -> Gravity .BOTTOM or Gravity .RIGHT
103109 EdgeCorner .Bottom -> Gravity .BOTTOM or Gravity .CENTER_HORIZONTAL
104110 EdgeCorner .BottomLeft -> Gravity .BOTTOM or Gravity .LEFT
@@ -118,7 +124,7 @@ class EdgeViewFacade(
118124 ctx = ctx,
119125 local = local,
120126 edgePosData = data.pos,
121- edgeSide = sideRotated ,
127+ edgeSide = targetSide ,
122128 dpi = displayDensityDpi,
123129 onSeekImpl = ControlFeatureImpl .from(data.pos.onSeek),
124130 onLongClick = ActionFeatureImpl .from(data.pos.onLongClick),
0 commit comments