Redo more complex selection positions--results in slowdown

This commit is contained in:
2022-07-01 16:23:05 +01:00
parent 207d52a719
commit 9e9c449fe6
5 changed files with 102 additions and 57 deletions
+13 -4
View File
@@ -103,10 +103,19 @@ zoneClouds w = w & clZoning %~ \zn ->
--runIdentity (S.fold_ (flip $ updateZoning (:)) (zn & znObjects .~ mempty) id (_clouds w))
updateWorldSelect :: World -> World
updateWorldSelect w = case w ^? mouseButtons . ix ButtonLeft of
Nothing -> w
Just False -> w & wSelect . _1 .~ mouseWorldPos w
Just True -> w & wSelect . _2 .~ mouseWorldPos w
updateWorldSelect w = f . g $ case (w ^? mouseButtons . ix ButtonLeft, w ^? mouseButtons . ix ButtonRight) of
(Nothing ,Nothing) -> w
(Just False,Nothing) -> w & lLine . _1 .~ mwp
(Just True ,Nothing) -> w & lLine . _2 .~ mwp
(Nothing ,_) -> w
(Just False,_) -> w & rLine . _1 .~ mwp
(Just True ,_) -> w & rLine . _2 .~ mwp
where
mwp = mouseWorldPos w
f | ButtonLeft `M.member` _mouseButtons w = lSelect .~ mwp
| otherwise = id
g | ButtonRight `M.member` _mouseButtons w = rSelect .~ mwp
| otherwise = id
mcChooseUpdate :: Machine -> Machine -> World -> World
mcChooseUpdate mc mc'