fix brush rotation widget

This commit is contained in:
sheaf 2024-09-28 11:17:33 +02:00
parent a41c6235ae
commit 3d36b39541
3 changed files with 6 additions and 12 deletions

View file

@ -825,9 +825,9 @@ instance HandleAction MouseMove where
case applyBrushWidgetAction ( pressingControl modifiers ) pos ( Just brushAction ) doc of case applyBrushWidgetAction ( pressingControl modifiers ) pos ( Just brushAction ) doc of
Nothing -> Nothing ->
pure Don'tModifyDoc pure Don'tModifyDoc
Just ( newDocument, _ ) -> do Just ( newDocument, brushAction' ) -> do
STM.writeTVar mouseHoldTVar ( Just $ BrushWidgetAction pos brushAction' )
-- This is just for preview, so TrivialDiff. -- This is just for preview, so TrivialDiff.
STM.writeTVar mouseHoldTVar ( Just $ BrushWidgetAction pos brushAction )
pure ( UpdateDoc $ UpdateDocumentTo newDocument TrivialDiff ) pure ( UpdateDoc $ UpdateDocumentTo newDocument TrivialDiff )
_ -> pure Don'tModifyDoc _ -> pure Don'tModifyDoc
| otherwise | otherwise

View file

@ -110,8 +110,6 @@ import MetaBrush.Unique
import MetaBrush.GTK.Util import MetaBrush.GTK.Util
( withRGBA ) ( withRGBA )
import Debug.Trace
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
data Renders a data Renders a

View file

@ -70,8 +70,6 @@ import MetaBrush.Stroke
import MetaBrush.Unique import MetaBrush.Unique
( Unique, UniqueSupply, freshUnique ) ( Unique, UniqueSupply, freshUnique )
import Debug.Trace
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | A draw anchor, to continue drawing from one end of an existing stroke. -- | 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 case Map.lookup anchorStroke strokes of
Nothing -> error "draw anchor: stroke not present in hierarchy" Nothing -> error "draw anchor: stroke not present in hierarchy"
Just ( Stroke { strokeSpline } ) -> Just ( Stroke { strokeSpline } ) ->
let res = coords $
coords $ if anchorIsAtEnd
if anchorIsAtEnd then splineEnd ( adjustSplineType @Open strokeSpline )
then splineEnd ( adjustSplineType @Open strokeSpline ) else splineStart ( adjustSplineType @Open strokeSpline )
else splineStart ( adjustSplineType @Open strokeSpline )
in trace ("anchorPos: " ++ show res) res
addToAnchor :: DrawAnchor -> Spline Open () ( PointData () ) -> Document -> Document addToAnchor :: DrawAnchor -> Spline Open () ( PointData () ) -> Document -> Document
addToAnchor anchor newSpline doc@( Document { documentMetadata, documentContent = oldContent } ) = addToAnchor anchor newSpline doc@( Document { documentMetadata, documentContent = oldContent } ) =