Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applying the stack overflow hack to main library #566

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion src/Shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,29 @@
delete Kinetic.Global.shapes[this.colorKey];
return this;
},
/**
* Enable and set override Transform matrix
* @method
* @memberof Kinetic.Shape.prototype
*/
setOverrideTransform: function(m) {
if(m instanceof Kinetic.Transform) {
this._overrideTransform = true;
this.setAttr('OverrideTransform',m);
return true;
}
else
return false;
},
/**
* clear override Transform matrix
* @method
* @memberof Kinetic.Shape.prototype
*/
clearOverrideTransform: function(m) {
this._overrideTransform = false;
this.setAttr('OverrideTransform',[]);
},
drawScene: function(canvas) {
canvas = canvas || this.getLayer().getCanvas();

Expand All @@ -217,7 +240,12 @@
context.save();
canvas._applyOpacity(this);
canvas._applyLineJoin(this);
canvas._applyAncestorTransforms(this);
if(this._overrideTransform) {
var m2 = this.getAttr('OverrideTransform').getMatrix();
canvas.context.setTransform(m2[0], m2[1], m2[2], m2[3], m2[4], m2[5]);
}
else
canvas._applyAncestorTransforms(this);
drawFunc.call(this, canvas);
context.restore();
}
Expand Down