mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
fixed up group drag and drop
This commit is contained in:
@@ -195,10 +195,10 @@
|
||||
},
|
||||
_applyAncestorTransforms: function(node) {
|
||||
var context = this.context;
|
||||
node.eachAncestorReverse(function(no) {
|
||||
node._eachAncestorReverse(function(no) {
|
||||
var t = no.getTransform(), m = t.getMatrix();
|
||||
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -38,7 +38,7 @@
|
||||
dd.prevParent = this.getParent();
|
||||
|
||||
// re-construct node tree
|
||||
this.eachAncestorReverse(function(node) {
|
||||
this._eachAncestorReverse(function(node) {
|
||||
if(node.nodeType === 'Layer') {
|
||||
dd.topLayer = new Kinetic.Layer({
|
||||
x: node.getX(),
|
||||
|
16
src/Node.js
16
src/Node.js
@@ -436,17 +436,13 @@
|
||||
getRotationDeg: function() {
|
||||
return Kinetic.Type._radToDeg(this.getRotation());
|
||||
},
|
||||
/**
|
||||
* iterate through ancestors in reverse
|
||||
* @name eachAncestorReverse
|
||||
* @methodOf Kinetic.Node.prototype
|
||||
* @param {Function} func function is passed a node on each iteration
|
||||
*/
|
||||
eachAncestorReverse: function(func) {
|
||||
_eachAncestorReverse: function(func, includeSelf) {
|
||||
var family = [], parent = this.getParent();
|
||||
|
||||
// build family by traversing ancestors
|
||||
family.unshift(this);
|
||||
if(includeSelf) {
|
||||
family.unshift(this);
|
||||
}
|
||||
while(parent) {
|
||||
family.unshift(parent);
|
||||
parent = parent.parent;
|
||||
@@ -671,10 +667,10 @@
|
||||
// absolute transform
|
||||
var am = new Kinetic.Transform();
|
||||
|
||||
this.eachAncestorReverse(function(node) {
|
||||
this._eachAncestorReverse(function(node) {
|
||||
var m = node.getTransform();
|
||||
am.multiply(m);
|
||||
});
|
||||
}, true);
|
||||
return am;
|
||||
},
|
||||
/**
|
||||
|
@@ -258,7 +258,7 @@ Test.Modules.NODE = {
|
||||
clone.simulate('click');
|
||||
test(clicks.toString() === 'myRect,rectClone', 'click order should be myRect followed by rectClone');
|
||||
},
|
||||
'*clone a group': function(containerId) {
|
||||
'clone a group': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
|
Reference in New Issue
Block a user