mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-05 14:53:37 +00:00
fix bug in reverseSpline
This commit is contained in:
parent
46275514ff
commit
c6694e4e2f
|
@ -213,7 +213,7 @@ addToAnchor anchor newSpline = over ( field' @"documentContent" . field' @"strok
|
|||
AnchorAtStart _ ->
|
||||
let
|
||||
setBrushData :: PointData () -> PointData brushData
|
||||
setBrushData = set ( field @"brushParams" ) ( brushParams ( splineStart prevSpline ) )
|
||||
setBrushData = set ( field @"brushParams" ) ( brushParams ( splineStart prevSpline ) )
|
||||
in fmap setBrushData ( reverseSpline newSpline ) <> prevSpline
|
||||
AnchorAtEnd _ ->
|
||||
let
|
||||
|
|
|
@ -276,12 +276,12 @@ reverseSpline spline@( Spline { splineStart = p0, splineCurves = OpenCurves curv
|
|||
prev :|> lst -> Spline { splineStart = openCurveEnd lst, splineCurves = OpenCurves ( go prev lst ) }
|
||||
where
|
||||
go :: Seq ( Curve Open crvData ptData ) -> Curve Open crvData ptData -> Seq ( Curve Open crvData ptData )
|
||||
go Empty ( LineTo _ dat ) = Empty :|> LineTo ( NextPoint p0 ) dat
|
||||
go Empty ( Bezier2To p1 _ dat ) = Empty :|> Bezier2To p0 ( NextPoint p1 ) dat
|
||||
go Empty ( Bezier3To p1 p2 _ dat ) = Empty :|> Bezier3To p0 p1 ( NextPoint p2 ) dat
|
||||
go ( crvs :|> crv ) ( LineTo _ dat ) = go crvs crv :|> LineTo ( curveEnd crv ) dat
|
||||
go ( crvs :|> crv ) ( Bezier2To p1 _ dat ) = go crvs crv :|> Bezier2To ( openCurveEnd crv ) ( NextPoint p1 ) dat
|
||||
go ( crvs :|> crv ) ( Bezier3To p1 p2 _ dat ) = go crvs crv :|> Bezier3To ( openCurveEnd crv ) p1 ( NextPoint p2 ) dat
|
||||
go Empty ( LineTo _ dat ) = LineTo ( NextPoint p0 ) dat :<| Empty
|
||||
go Empty ( Bezier2To p1 _ dat ) = Bezier2To p1 ( NextPoint p0 ) dat :<| Empty
|
||||
go Empty ( Bezier3To p1 p2 _ dat ) = Bezier3To p2 p1 ( NextPoint p0 ) dat :<| Empty
|
||||
go ( crvs :|> crv ) ( LineTo _ dat ) = LineTo ( curveEnd crv ) dat :<| go crvs crv
|
||||
go ( crvs :|> crv ) ( Bezier2To p1 _ dat ) = Bezier2To p1 ( NextPoint $ openCurveEnd crv ) dat :<| go crvs crv
|
||||
go ( crvs :|> crv ) ( Bezier3To p1 p2 _ dat ) = Bezier3To p2 p1 ( NextPoint $ openCurveEnd crv ) dat :<| go crvs crv
|
||||
|
||||
splineEnd :: Spline Open crvData ptData -> ptData
|
||||
splineEnd ( Spline { splineStart, splineCurves = OpenCurves curves } ) = case curves of
|
||||
|
|
Loading…
Reference in a new issue