mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
events fixes
This commit is contained in:
@@ -513,7 +513,7 @@ suite('MouseEvents', function() {
|
||||
});
|
||||
|
||||
assert(mouseover, '1) mouseover should be true');
|
||||
assert(!mousemove, '1) mousemove should be true');
|
||||
assert(mousemove, '1) mousemove should be true');
|
||||
assert(!mousedown, '1) mousedown should be false');
|
||||
assert(!mouseup, '1) mouseup should be false');
|
||||
assert(!click, '1) click should be false');
|
||||
@@ -2053,4 +2053,47 @@ suite('MouseEvents', function() {
|
||||
|
||||
assert.equal(mouseenter, 1, 'mouseenter should be 1');
|
||||
});
|
||||
|
||||
test('should trigger mouse events if we set Konva.hitOnDragEnabled = true', function() {
|
||||
Konva.hitOnDragEnabled = true;
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
var rect = new Konva.Rect({
|
||||
width: 50,
|
||||
height: 50,
|
||||
fill: 'red',
|
||||
draggable: true
|
||||
});
|
||||
layer.add(rect);
|
||||
|
||||
layer.draw();
|
||||
|
||||
var mousemove = 0;
|
||||
rect.on('mousemove', () => {
|
||||
mousemove += 1;
|
||||
});
|
||||
|
||||
stage.simulateMouseDown({
|
||||
x: 10,
|
||||
y: 10
|
||||
});
|
||||
|
||||
stage.simulateMouseMove({
|
||||
x: 20,
|
||||
y: 20
|
||||
});
|
||||
stage.simulateMouseMove({
|
||||
x: 30,
|
||||
y: 30
|
||||
});
|
||||
stage.simulateMouseUp({
|
||||
x: 30,
|
||||
y: 30
|
||||
});
|
||||
|
||||
assert.equal(mousemove, 2, 'mousemove should be 2');
|
||||
Konva.hitOnDragEnabled = false;
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user