dragstart fixes when transformer is used

This commit is contained in:
Anton Lavrenov
2020-09-02 12:50:41 -05:00
parent 7ae8415da8
commit 4a29a1e109
7 changed files with 73 additions and 1327 deletions

View File

@@ -434,6 +434,8 @@ suite('Node', function () {
layer.drawHit();
showHit(layer);
assert.equal(layer.getIntersection({ x: 60, y: 60 }), null);
});
// ======================================================

View File

@@ -3873,7 +3873,8 @@ suite('Transformer', function () {
});
// make sure drag also triggers on the transformer.
tr.on('dragstart', () => {
tr.on('dragstart', (e) => {
assert.equal(!!e.evt, true);
dragstart += 1;
});
tr.on('dragmove', () => {
@@ -3883,6 +3884,12 @@ suite('Transformer', function () {
dragend += 1;
});
// also drag should bubble to stage
// two times for two rects
stage.on('dragstart', () => {
dragstart += 1;
});
layer.add(tr);
layer.draw();
@@ -3908,7 +3915,7 @@ suite('Transformer', function () {
// proxy drag to other nodes
assert.equal(rect2.x(), 110);
assert.equal(rect2.y(), 110);
assert.equal(dragstart, 2);
assert.equal(dragstart, 4);
assert.equal(dragmove, 3);
assert.equal(dragend, 2);
});