mirror of
https://github.com/konvajs/konva.git
synced 2026-01-08 18:54:40 +08:00
Merge branch 'master' of https://github.com/ericdrowell/KineticJS
This commit is contained in:
@@ -1,8 +1,28 @@
|
||||
(function() {
|
||||
var SPACE = '',
|
||||
TRANSFORM_CHANGE_STR = [
|
||||
'xChange.kinetic',
|
||||
'yChange.kinetic',
|
||||
'scaleXChange.kinetic',
|
||||
'scaleYChange.kinetic',
|
||||
'skewXChange.kinetic',
|
||||
'skewYChange.kinetic',
|
||||
'rotationChange.kinetic',
|
||||
'offsetXChange.kinetic',
|
||||
'offsetYChange.kinetic'
|
||||
].join(SPACE);
|
||||
|
||||
Kinetic.Util.addMethods(Kinetic.Container, {
|
||||
__init: function(config) {
|
||||
this.children = new Kinetic.Collection();
|
||||
Kinetic.Node.call(this, config);
|
||||
|
||||
this.on(TRANSFORM_CHANGE_STR, function() {
|
||||
var stage = this.getStage();
|
||||
if (stage) {
|
||||
stage._enableNestedTransforms = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* returns a {@link Kinetic.Collection} of direct descendant nodes
|
||||
|
||||
@@ -224,7 +224,15 @@
|
||||
}
|
||||
},
|
||||
_applyAncestorTransforms: function(shape) {
|
||||
var m = shape.getAbsoluteTransform().getMatrix();
|
||||
var stage = shape.getStage(),
|
||||
m;
|
||||
|
||||
if (stage && stage._enableNestedTransforms) {
|
||||
m = shape.getAbsoluteTransform().getMatrix();
|
||||
}
|
||||
else {
|
||||
m = shape.getTransform().getMatrix();
|
||||
}
|
||||
this.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
},
|
||||
_clip: function(container) {
|
||||
|
||||
@@ -42,7 +42,7 @@ var Kinetic = {};
|
||||
shapes: {},
|
||||
listenClickTap: false,
|
||||
inDblClickWindow: false,
|
||||
|
||||
|
||||
// configurations
|
||||
enableTrace: false,
|
||||
traceArrMax: 100,
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
X = 'x',
|
||||
Y = 'y',
|
||||
|
||||
transformChangeStr = [
|
||||
TRANSFORM_CHANGE_STR = [
|
||||
'xChange.kinetic',
|
||||
'yChange.kinetic',
|
||||
'scaleXChange.kinetic',
|
||||
@@ -64,7 +64,7 @@
|
||||
this.setAttrs(config);
|
||||
|
||||
// event bindings for cache handling
|
||||
this.on(transformChangeStr, function() {
|
||||
this.on(TRANSFORM_CHANGE_STR, function() {
|
||||
this._clearCache(TRANSFORM);
|
||||
that._clearSelfAndChildrenCache(ABSOLUTE_TRANSFORM);
|
||||
});
|
||||
@@ -1251,7 +1251,6 @@
|
||||
* @memberof Kinetic.Node.prototype
|
||||
*/
|
||||
getTransform: function() {
|
||||
//return this._getTransform();
|
||||
return this._getCache(TRANSFORM, this._getTransform);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
this._id = Kinetic.idCounter++;
|
||||
this._buildDOM();
|
||||
this._bindContentEvents();
|
||||
this._enableNestedTransforms = false;
|
||||
Kinetic.stages.push(this);
|
||||
},
|
||||
_validateAdd: function(child) {
|
||||
|
||||
15
src/Tween.js
15
src/Tween.js
@@ -103,16 +103,10 @@
|
||||
start = node.getAttr(key);
|
||||
|
||||
if (Kinetic.Util._isArray(end)) {
|
||||
end = Kinetic.Util._getPoints(end);
|
||||
diff = [];
|
||||
len = end.length;
|
||||
for (n=0; n<len; n++) {
|
||||
startVal = start[n];
|
||||
endVal = end[n];
|
||||
diff.push({
|
||||
x: endVal.x - startVal.x,
|
||||
y: endVal.y - startVal.y
|
||||
});
|
||||
diff.push(end[n] - start[n]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,12 +134,7 @@
|
||||
newVal = [];
|
||||
len = start.length;
|
||||
for (n=0; n<len; n++) {
|
||||
startVal = start[n];
|
||||
diffVal = diff[n];
|
||||
newVal.push({
|
||||
x: startVal.x + (diffVal.x * i),
|
||||
y: startVal.y + (diffVal.y * i)
|
||||
});
|
||||
newVal.push(start[n] + (diff[n] * i));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user