Skip to content

Commit

Permalink
Fix buildPath for path from string.
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Apr 19, 2017
1 parent a2ce528 commit 38d77a7
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/tool/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,23 +328,25 @@ define(function (require) {
// TODO Optimize double memory cost problem
function createPathOptions(str, opts) {
var pathProxy = createPathProxyFromString(str);
var transform;
opts = opts || {};
opts.buildPath = function (path) {
path.setData(pathProxy.data);
transform && transformPath(path, transform);
// Svg and vml renderer don't have context
var ctx = path.getContext();
if (ctx) {
path.rebuildPath(ctx);
if (path.setData) {
path.setData(pathProxy.data);
// Svg and vml renderer don't have context
var ctx = path.getContext();
if (ctx) {
path.rebuildPath(ctx);
}
}
else {
var ctx = path;
pathProxy.rebuildPath(ctx);
}
};

opts.applyTransform = function (m) {
if (!transform) {
transform = matrix.create();
}
matrix.mul(transform, m, transform);
transformPath(pathProxy, m);

this.dirty(true);
};

Expand Down

0 comments on commit 38d77a7

Please sign in to comment.