Skip to content

Commit fb50783

Browse files
FlamencoMrRio
authored andcommitted
Ignore legacy code for closing path (#979)
1 parent 9f89d36 commit fb50783

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

HOTFIX_README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#Hotfixes
2+
3+
We sometimes bake-in solutions (A.K.A. hotfixes) to solve issues for specific use cases.
4+
5+
When we deem a hotfix will not break existing code,
6+
will make it default behaviour and mark the hotfix as _accepted_,
7+
At that point the define can be removed.
8+
9+
To enable a hotfix, define the following member of your created PDF,
10+
where the pdf.hotfix field is the name of the hotfix.
11+
12+
var pdf new jsPDF(...);
13+
pdf.hotfix.fill_close = true;
14+
15+
#Active Hotfixes
16+
17+
##fill_close
18+
###Applies To
19+
context2d plugin
20+
21+
### Affects
22+
Filling paths
23+
24+
### Description
25+
In certain cases, closing a fill would result in a path resolving to an incorrect point.
26+
The was most likely fixed when we refactored matrix logic. Enabling this hotfix will ignore a most-likely unneeded workaround.
27+
28+
#Accepted Hotfixes
29+
There a currently no accepted hotfixes.

plugins/context2d.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,15 @@
11431143
}
11441144
}
11451145

1146-
// extra move bug causing close to resolve to wrong point
1147-
var x = moves[i].start.x;
1148-
var y = moves[i].start.y;
1149-
this.internal.line2(c2d, x, y);
1146+
if (this.pdf.hotfix && this.pdf.hotfix.fill_close) {
1147+
// do nothing
1148+
}
1149+
else {
1150+
// extra move bug causing close to resolve to wrong point
1151+
var x = moves[i].start.x;
1152+
var y = moves[i].start.y;
1153+
this.internal.line2(c2d, x, y);
1154+
}
11501155

11511156
this.pdf.internal.out('h');
11521157
this.pdf.internal.out('f');

0 commit comments

Comments
 (0)