packages feed

eventloop 0.8.2.3 → 0.8.2.4

raw patch · 3 files changed

+20/−15 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

eventloop.cabal view
@@ -6,7 +6,7 @@ -- PVP summary:      +-+------- breaking API changes
 --                   | | +----- non-breaking API additions
 --                   | | | +--- code changes with no API change
-version:             0.8.2.3
+version:             0.8.2.4
 synopsis:            A different take on an IO system. Based on Amanda's IO loop, this eventloop takes a function that maps input events to output events. It can easily be extended by modules that represent IO devices or join multiple modules together.
 description:         A different take on an IO system. Based on Amanda's IO loop, this eventloop takes a function that maps input events to output events. It can easily be extended by modules that represent IO devices or join multiple modules together.
                      Each module exists of a initialize and teardown function that are both called once at startup and shutting down. During run-time, a module can provice a preprocessor function (which transforms input events before they get to the eventloop),
src/Eventloop/Module/BasicShapes/Classes.hs view
@@ -126,7 +126,10 @@     | start == inspected && inspected == dest = [dest]
     | start == inspected                      = strokePointsForLine strokeWidth inspected dest
     | inspected == dest                       = strokePointsForLine strokeWidth start inspected
-    | otherwise                               = [p1, p2]
+    | isJust mp1 && isJust mp2                = [fromJust mp1, fromJust mp2]
+    | otherwise                               = [sup1, sdown1] -- Is possible due to rounding. Direction vectors are roughly parallel but stepping points are not equal
+                                                               -- GHC will think parallel vectors are parallel while they are not. So no intersection as stepping points are slightly different
+                                                               -- Just return half width up and down from inspected as this is close enough
     where
         halfWidth = strokeWidth / 2
         quart = 0.5 * pi
@@ -142,8 +145,8 @@         sdown1 = followVector halfWidth downv1 inspected
         downv2 = negateVector upv2
         sdown2 = followVector halfWidth downv2 inspected
-        (Just p1) = intersectVector sdown1 v1 sdown2 v2
-        (Just p2) = intersectVector sup1 v1 sup2 v2
+        mp1 = intersectVector sdown1 v1 sdown2 v2
+        mp2 = intersectVector sup1 v1 sup2 v2
 
 
 strokePoints :: StrokeLineThickness -> [Point] -> [Point]
src/Eventloop/Module/StatefulGraphics/StatefulGraphics.hs view
@@ -114,14 +114,14 @@                  -> [GraphicPerformed]                  -> (GraphicsState, GraphicsState) -- Redraw and Remove state calculateRedraws _ [] = ([], [])-calculateRedraws state ((Drawn sbb):performed)-    = (toRedraw', toRemove)+calculateRedraws state ((Drawn sbb@(StatefulBB (Stateful name _ _) _)):performed)+    = (toRedraw', toRemove')     where         id = getId sbb         (toRedraw, toRemove) = calculateRedraws state performed-        (_, toRedraw') = calculateRedrawsForDrawn (state, toRedraw) sbb+        (_, toRedraw', toRemove') = calculateRedrawsForDrawn (state, toRedraw, toRemove) sbb -calculateRedraws state ((Removed sg):performed)+calculateRedraws state ((Removed sg@(StatefulBB (Stateful name _ _) _)):performed)     = (toRedraw', toRemove')     where         (toRedraw, toRemove) = calculateRedraws state performed@@ -141,11 +141,15 @@ However, if there is one graphic to be found that completely contains the drawn graphic, nothing has to happen. Also, all graphics completely behind the drawn graphic, will not be redrawn. -}-calculateRedrawsForDrawn :: (GraphicsState, GraphicsState) -- Current check and redraw state+calculateRedrawsForDrawn :: (GraphicsState, GraphicsState, GraphicsState) -- Current check and redraw state                          -> StatefulBB-                         -> (GraphicsState, GraphicsState)-calculateRedrawsForDrawn (toCheck, toRedraw) new-    = foldl calculateRedrawsForDrawn (toCheck', toRedraw') checkNow+                         -> (GraphicsState, GraphicsState, GraphicsState)+calculateRedrawsForDrawn (toCheck, toRedraw, toRemove) new@(StatefulBB (Stateful id _ (Text {})) _)+   = calculateRedrawsForRemoved (toCheck', new:toRedraw, toRemove) new+   where+       toCheck' = fst $ removeGraphic toCheck id+calculateRedrawsForDrawn (toCheck, toRedraw, toRemove) new+    = foldl calculateRedrawsForDrawn (toCheck', toRedraw', toRemove) checkNow     where         id = getId new         z  = getZ new@@ -181,15 +185,13 @@         aboveContained   = filter (contains old) above         aboveContainedBy = filter (\sg -> contains sg old) above -        toRemove' = old:toRemove-         checkNow = belowOverlapped                  ++ belowContained                  ++ belowContainedBy                  ++ aboveOverlapped                  ++ aboveContained                  ++ aboveContainedBy-        (toCheck', toRedraw') = foldl calculateRedrawsForDrawn (toCheck, toRedraw) checkNow+        (toCheck', toRedraw', toRemove') = foldl calculateRedrawsForDrawn (toCheck, toRedraw, old:toRemove) checkNow   statefulIds :: GraphicsState -> [NamedId]