From 278cf20058ad788676a7abe82a65083f41f84e17 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 8 Nov 2021 09:43:34 -0700 Subject: Fix calculating position for rotation layout modifier --- src/Internal/Layout.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Internal/Layout.hs') 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) -- cgit