Fixes dragging devices out of the inventory toolbox

Fixes a defect where devices were dropped onto the canvas
if they were moved a small amount after being selected in
the inventory toolbox.   This fix checks that the mouse
has cleared the boundary of the inventory toolbox before
dropping it onto the canvas.
This commit is contained in:
Ben Thomasson
2018-04-30 10:23:14 -04:00
parent 7781667977
commit 10fd65bea0

View File

@@ -234,8 +234,19 @@ _Start.prototype.start.transitions = ['Ready'];
_Move.prototype.onMouseUp = function (controller) {
controller.changeState(Dropping);
var i = 0;
var toolbox = controller.toolbox;
if (controller.scope.mouseX < controller.toolbox.width) {
for(i = 0; i < toolbox.items.length; i++) {
toolbox.items[i].selected = false;
}
toolbox.selected_item = null;
controller.changeState(Ready);
} else {
controller.changeState(Dropping);
}
};
_Move.prototype.onMouseUp.transitions = ['Dropping'];