Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e745c93

Browse files
committed
[[ Bug 21860 ]] Fix encoding of svg paths containing relative commands
This patch fixes a problem in svg paths making heavy use of relative commands caused by close subpath not resetting the last point to the first point of the subpath. The first point is now recorded when a move command is encountered, and this is used when a close command is encountered to update the last point.
1 parent 2009e05 commit e745c93

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

docs/notes/bugfix-21860.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix encoding of svg paths containing relative commands

extensions/script-libraries/drawing/drawing.livecodescript

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,10 @@ private command _svgEncodeTransform @xContext, pTransform
15701570
end _svgEncodeTransform
15711571

15721572
private command _svgEncodePath @xContext, pPath
1573+
local tFirstX, tFirstY
1574+
put 0 into tFirstX
1575+
put 0 into tFirstY
1576+
15731577
local tLastX, tLastY
15741578
put 0 into tLastX
15751579
put 0 into tLastY
@@ -1591,11 +1595,15 @@ private command _svgEncodePath @xContext, pPath
15911595
put kMCGDrawingPathOpcodeMoveTo into tOpcode
15921596
put tScalars[1] into tLastX
15931597
put tScalars[2] into tLastY
1598+
put tLastX into tFirstX
1599+
put tLastY into tFirstY
15941600
break
15951601

15961602
case "Z"
15971603
case "z"
15981604
put kMCGDrawingPathOpcodeCloseSubpath into tOpcode
1605+
put tFirstX into tLastX
1606+
put tFirstY into tLastY
15991607
break
16001608

16011609
case "l"

0 commit comments

Comments
 (0)