mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-09 00:11:52 -07:00
Circle.hs: only compute sqrt 2 once.
This commit is contained in:
@@ -38,8 +38,9 @@ circleLayout r (w:ws) = return $ (w, center r) : (zip ws sats)
|
|||||||
|
|
||||||
center :: Rectangle -> Rectangle
|
center :: Rectangle -> Rectangle
|
||||||
center (Rectangle sx sy sw sh) = Rectangle x y w h
|
center (Rectangle sx sy sw sh) = Rectangle x y w h
|
||||||
where w = round ((fromIntegral sw / sqrt 2) :: Double)
|
where s = sqrt 2
|
||||||
h = round ((fromIntegral sh / sqrt 2) :: Double)
|
w = round ((fromIntegral sw / s) :: Double)
|
||||||
|
h = round ((fromIntegral sh / s) :: Double)
|
||||||
x = sx + fromIntegral (sw - w) `div` 2
|
x = sx + fromIntegral (sw - w) `div` 2
|
||||||
y = sy + fromIntegral (sh - h) `div` 2
|
y = sy + fromIntegral (sh - h) `div` 2
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user