mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
fixed drag and drop bug related to drag constraints and positioned containers. Just needed to move the drag constraint logic after the matrix unravel
This commit is contained in:
23
src/Stage.js
23
src/Stage.js
@@ -646,14 +646,6 @@ Kinetic.Stage.prototype = {
|
||||
newNodePos.y = db.bottom;
|
||||
}
|
||||
|
||||
// constraint overrides
|
||||
if(dc === 'horizontal') {
|
||||
newNodePos.y = node.y;
|
||||
}
|
||||
else if(dc === 'vertical') {
|
||||
newNodePos.x = node.x;
|
||||
}
|
||||
|
||||
/*
|
||||
* save rotation and scale and then
|
||||
* remove them from the transform
|
||||
@@ -673,9 +665,20 @@ Kinetic.Stage.prototype = {
|
||||
var it = node.getAbsoluteTransform();
|
||||
it.invert();
|
||||
it.translate(newNodePos.x, newNodePos.y);
|
||||
newNodePos = {
|
||||
x: node.x + it.getTranslation().x,
|
||||
y: node.y + it.getTranslation().y
|
||||
};
|
||||
|
||||
node.x += it.getTranslation().x;
|
||||
node.y += it.getTranslation().y;
|
||||
// constraint overrides
|
||||
if(dc === 'horizontal') {
|
||||
newNodePos.y = node.y;
|
||||
}
|
||||
else if(dc === 'vertical') {
|
||||
newNodePos.x = node.x;
|
||||
}
|
||||
|
||||
node.setPosition(newNodePos.x, newNodePos.y);
|
||||
|
||||
// restore rotation and scale
|
||||
node.rotate(rot);
|
||||
|
Reference in New Issue
Block a user