diff --git a/activities/LabyrinthJS.activity/js/activity.js b/activities/LabyrinthJS.activity/js/activity.js index 2743af72b..7ed7ffd04 100644 --- a/activities/LabyrinthJS.activity/js/activity.js +++ b/activities/LabyrinthJS.activity/js/activity.js @@ -362,11 +362,18 @@ define(["sugar-web/activity/activity", "l10n", "sugar-web/datastore", "sugar-web if (lastSelected == this) lastSelected = null; return; } else if (currentMode == 1) { + if (isSelectedNode(this)) { + unselectNode(this); + lastSelected = null; + } + else { selectNode(this); } if (lastSelected != null && lastSelected != this) { createEdge(lastSelected, this); + unselectNode(this); + lastSelected = null; pushState(); } - lastSelected = this; + if (isSelectedNode(this)) lastSelected = this; return; } else { if (isSelectedNode(this)) { @@ -639,6 +646,14 @@ define(["sugar-web/activity/activity", "l10n", "sugar-web/datastore", "sugar-web undoButton.addEventListener('click', function () { undoState(); }, true); var redoButton = document.getElementById("redo-button"); redoButton.addEventListener('click', function () { redoState(); }, true); + document.addEventListener('keydown', function (event) { + if (event.ctrlKey && event.key === 'z' || event.key === 'Z') { + undoState(); + } + if (event.ctrlKey && (event.key === 'y' || event.key === 'Y')) { + redoState(); + } + }); var reinitState = function() { stateHistory = [];