diff options
| author | Josh Rahm <rahm@google.com> | 2021-11-08 09:43:34 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:45 -0600 |
| commit | 9b78e3dd3be1e3a8e036cdda7b1e2ab3027000f8 (patch) | |
| tree | 5b27d18bbea51e3efc8930aa093d74e3e1a0a6f4 /src | |
| parent | 41fea501b325bd25588e7ccd5c20bf46fdd9b916 (diff) | |
| download | rde-9b78e3dd3be1e3a8e036cdda7b1e2ab3027000f8.tar.gz rde-9b78e3dd3be1e3a8e036cdda7b1e2ab3027000f8.tar.bz2 rde-9b78e3dd3be1e3a8e036cdda7b1e2ab3027000f8.zip | |
Fix calculating position for rotation layout modifier
Diffstat (limited to 'src')
| -rw-r--r-- | src/Internal/Layout.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Internal/Layout.hs b/src/Internal/Layout.hs index 632e912..f28ae4d 100644 --- a/src/Internal/Layout.hs +++ b/src/Internal/Layout.hs @@ -106,7 +106,7 @@ data Zoomable a = Zoomable Bool Float Float -- True if zooming in on the focused deriving (Show, Read) -- Toggles if the current window should be zoomed or not. Set the boolean --- to set the zoom. +-- to set the zoom.mhar data ZoomModifier = ToggleZoom | Zoom | @@ -122,11 +122,14 @@ instance Message ZoomModifier where instance Message DoRotate where instance (Eq a) => LayoutModifier Rotateable a where - pureModifier (Rotateable rotate) (Rectangle _ _ sw sh) _ returned = + pureModifier (Rotateable rotate) (Rectangle x' y' sw sh) _ returned = if rotate - then (map (second (scaleRect . mirrorRect)) returned, Nothing) + then (map (second (unzero . scaleRect . mirrorRect . zero)) returned, Nothing) else (returned, Nothing) where + zero (Rectangle x y w h) = Rectangle (x - x') (y - y') w h + unzero (Rectangle x y w h) = Rectangle (x + x') (y + y') w h + scaleRect (Rectangle x y w h) = Rectangle (x * fi sw `div` fi sh) (y * fi sh `div` fi sw) |