summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-05-01 18:41:22 -0400
committerJoe Crayne <joe@jerkface.net>2019-05-01 18:41:22 -0400
commita7998a03dccd5c879508e729559de20743c7dafd (patch)
tree4de582760959e8b98c366a11354ab2d762463689
parentfce8237d59397054ea467fd9b5357877342dc34b (diff)
meshsketch: scroll-wheel zoom (lens angle).
-rw-r--r--MeshSketch.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/MeshSketch.hs b/MeshSketch.hs
index 8c46d54..6d7e757 100644
--- a/MeshSketch.hs
+++ b/MeshSketch.hs
@@ -310,6 +310,16 @@ onEvent w realized ev = do
310 EventTypeScroll -> do 310 EventTypeScroll -> do
311 sev <- get ev #scroll 311 sev <- get ev #scroll
312 d <- get sev #direction 312 d <- get sev #direction
313 let δ = case d of
314 ScrollDirectionDown -> - pi/180
315 ScrollDirectionUp -> pi/180
316 _ -> 0
317 when (δ /= 0) $ do
318 modifyIORef (stCamera st) $ \cam -> cam
319 { camHeightAngle = δ + camHeightAngle cam
320 , camWorldToScreen = Nothing
321 , camScreenToWorld = Nothing
322 }
313 put d 323 put d
314 return () 324 return ()
315 325