From b9976d9e8b266d29336133a25f187f71e99fee17 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Wed, 30 Nov 2022 19:28:05 -0300 Subject: [PATCH] avoid filling history with uneventful moves Signed-off-by: Victor Seiji Hariki --- js/ui/tool/select.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/ui/tool/select.js b/js/ui/tool/select.js index a9f4b8f..92e667b 100644 --- a/js/ui/tool/select.js +++ b/js/ui/tool/select.js @@ -183,7 +183,7 @@ const selectTransformTool = () => }; }; - // Mouse move handelr. As always, also renders cursor + // Mouse move handler. As always, also renders cursor state.movecb = (evn) => { ovCtx.clearRect(0, 0, ovCanvas.width, ovCanvas.height); imageCollection.inputElement.style.cursor = "auto"; @@ -298,6 +298,16 @@ const selectTransformTool = () => // Handles left mouse clicks state.clickcb = (evn) => { + if ( + state.original.x === state.selected.x && + state.original.y === state.selected.y && + state.original.w === state.selected.w && + state.original.h === state.selected.h + ) { + state.reset(); + return; + } + // If something is selected, commit changes to the canvas if (state.selected) { imgCtx.drawImage(