From 10fd65bea0668b68738663e58a0505840710329a Mon Sep 17 00:00:00 2001 From: Ben Thomasson Date: Mon, 30 Apr 2018 10:23:14 -0400 Subject: [PATCH] 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. --- awx/ui/client/src/network-ui/toolbox.fsm.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/network-ui/toolbox.fsm.js b/awx/ui/client/src/network-ui/toolbox.fsm.js index c8a80c6463..562c38b167 100644 --- a/awx/ui/client/src/network-ui/toolbox.fsm.js +++ b/awx/ui/client/src/network-ui/toolbox.fsm.js @@ -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'];