Skip to content

Commit

Permalink
Merge pull request #1096 from ecomfe/fix-path
Browse files Browse the repository at this point in the history
fix(path): using appendData instead of setData for path
  • Loading branch information
Ovilia authored Oct 14, 2024
2 parents 247e119 + 55b9232 commit 0969347
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/PathProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export default class PathProxy {
for (let i = 0; i < len; i++) {
appendSize += path[i].len();
}
if (hasTypedArray && (this.data instanceof Float32Array)) {
if (hasTypedArray && (this.data instanceof Float32Array || !this.data)) {
this.data = new Float32Array(offset + appendSize);
}
for (let i = 0; i < len; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/tool/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function createPathOptions(str: string, opts: SVGPathOption): InnerSVGPathOption
const innerOpts: InnerSVGPathOption = extend({}, opts);
innerOpts.buildPath = function (path: PathProxy | CanvasRenderingContext2D) {
if (isPathProxy(path)) {
path.setData(pathProxy.data);
path.appendPath(pathProxy);
// Svg and vml renderer don't have context
const ctx = path.getContext();
if (ctx) {
Expand Down

0 comments on commit 0969347

Please sign in to comment.