From 3d36b395414ffbe0ccff4b4c669dc38b689c779b Mon Sep 17 00:00:00 2001 From: sheaf Date: Sat, 28 Sep 2024 11:17:33 +0200 Subject: [PATCH] fix brush rotation widget --- src/app/MetaBrush/Application/Action.hs | 4 ++-- src/app/MetaBrush/Render/Document.hs | 2 -- src/metabrushes/MetaBrush/Draw.hs | 12 ++++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/app/MetaBrush/Application/Action.hs b/src/app/MetaBrush/Application/Action.hs index a84b44c..741a00c 100644 --- a/src/app/MetaBrush/Application/Action.hs +++ b/src/app/MetaBrush/Application/Action.hs @@ -825,9 +825,9 @@ instance HandleAction MouseMove where case applyBrushWidgetAction ( pressingControl modifiers ) pos ( Just brushAction ) doc of Nothing -> pure Don'tModifyDoc - Just ( newDocument, _ ) -> do + Just ( newDocument, brushAction' ) -> do + STM.writeTVar mouseHoldTVar ( Just $ BrushWidgetAction pos brushAction' ) -- This is just for preview, so TrivialDiff. - STM.writeTVar mouseHoldTVar ( Just $ BrushWidgetAction pos brushAction ) pure ( UpdateDoc $ UpdateDocumentTo newDocument TrivialDiff ) _ -> pure Don'tModifyDoc | otherwise diff --git a/src/app/MetaBrush/Render/Document.hs b/src/app/MetaBrush/Render/Document.hs index ed3ae18..59114c7 100644 --- a/src/app/MetaBrush/Render/Document.hs +++ b/src/app/MetaBrush/Render/Document.hs @@ -110,8 +110,6 @@ import MetaBrush.Unique import MetaBrush.GTK.Util ( withRGBA ) -import Debug.Trace - -------------------------------------------------------------------------------- data Renders a diff --git a/src/metabrushes/MetaBrush/Draw.hs b/src/metabrushes/MetaBrush/Draw.hs index f8f947d..b2ab83c 100644 --- a/src/metabrushes/MetaBrush/Draw.hs +++ b/src/metabrushes/MetaBrush/Draw.hs @@ -70,8 +70,6 @@ import MetaBrush.Stroke import MetaBrush.Unique ( Unique, UniqueSupply, freshUnique ) -import Debug.Trace - -------------------------------------------------------------------------------- -- | A draw anchor, to continue drawing from one end of an existing stroke. @@ -209,12 +207,10 @@ anchorPos ( DrawAnchor { anchorStroke, anchorIsAtEnd } ) case Map.lookup anchorStroke strokes of Nothing -> error "draw anchor: stroke not present in hierarchy" Just ( Stroke { strokeSpline } ) -> - let res = - coords $ - if anchorIsAtEnd - then splineEnd ( adjustSplineType @Open strokeSpline ) - else splineStart ( adjustSplineType @Open strokeSpline ) - in trace ("anchorPos: " ++ show res) res + coords $ + if anchorIsAtEnd + then splineEnd ( adjustSplineType @Open strokeSpline ) + else splineStart ( adjustSplineType @Open strokeSpline ) addToAnchor :: DrawAnchor -> Spline Open () ( PointData () ) -> Document -> Document addToAnchor anchor newSpline doc@( Document { documentMetadata, documentContent = oldContent } ) =