mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 21:34:50 +08:00
configure what mouse buttons can be used for drag&drop
This commit is contained in:
@@ -247,7 +247,7 @@ Konva.Stage.prototype.simulateMouseDown = function(pos) {
|
||||
this._mousedown({
|
||||
clientX: pos.x,
|
||||
clientY: pos.y + top,
|
||||
button: pos.button
|
||||
button: pos.button || 0
|
||||
});
|
||||
};
|
||||
|
||||
@@ -257,7 +257,7 @@ Konva.Stage.prototype.simulateMouseMove = function(pos) {
|
||||
var evt = {
|
||||
clientX: pos.x,
|
||||
clientY: pos.y + top,
|
||||
button: pos.button
|
||||
button: pos.button || 0
|
||||
};
|
||||
|
||||
this._mousemove(evt);
|
||||
@@ -270,7 +270,7 @@ Konva.Stage.prototype.simulateMouseUp = function(pos) {
|
||||
var evt = {
|
||||
clientX: pos.x,
|
||||
clientY: pos.y + top,
|
||||
button: pos.button
|
||||
button: pos.button || 0
|
||||
};
|
||||
|
||||
Konva.DD._endDragBefore(evt);
|
||||
|
||||
@@ -112,11 +112,34 @@ suite('DragAndDrop', function() {
|
||||
|
||||
assert(circle.isDragging() === false, 'no dragging with right click');
|
||||
|
||||
Konva.dragButtons = [0, 2];
|
||||
stage.simulateMouseUp({
|
||||
x: 291,
|
||||
y: 112,
|
||||
button: 2
|
||||
});
|
||||
|
||||
// simulate buttons change
|
||||
stage.simulateMouseDown({
|
||||
x: 291,
|
||||
y: 112,
|
||||
button: 2
|
||||
});
|
||||
|
||||
stage.simulateMouseMove({
|
||||
x: 311,
|
||||
y: 112,
|
||||
button: 2
|
||||
});
|
||||
|
||||
assert(circle.isDragging() === true, 'no dragging with right click');
|
||||
|
||||
stage.simulateMouseUp({
|
||||
x: 291,
|
||||
y: 112,
|
||||
button: 2
|
||||
});
|
||||
Konva.dragButtons = [0];
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
|
||||
Reference in New Issue
Block a user