From ed167f8d1bae3d4f626dd0d473277c72f97c6375 Mon Sep 17 00:00:00 2001 From: abakkk Date: Fri, 9 Oct 2020 08:48:42 +0200 Subject: [PATCH] fix transformation stopping * Handle case where grabbed element does not have transformation to stop. * Update cursor after erasing drawing while an element is grabbed. --- area.js | 6 +++++- elements.js | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/area.js b/area.js index 4eb284b..6415d6f 100644 --- a/area.js +++ b/area.js @@ -884,8 +884,12 @@ var DrawingArea = new Lang.Class({ // A priori there is nothing to stop, except transformations, if there is no current element. // 'force' argument is passed when leaving drawing mode to ensure all is clean, as a workaround for possible bugs. _stopAll: function(force) { - if (this.grabbedElement) + if (this.grabbedElement) { this._stopTransforming(); + this.grabbedElement = null; + this.grabbedElementLocked = null; + this.updatePointerCursor(); + } if (!this.currentElement && !force) return; diff --git a/elements.js b/elements.js index 2bbcaeb..5890187 100644 --- a/elements.js +++ b/elements.js @@ -577,11 +577,12 @@ const _DrawingElement = new Lang.Class({ }, stopTransformation: function() { + this.showSymmetryElement = false; + // Clean transformations let transformation = this.lastTransformation; - - if (transformation.type == Transformations.REFLECTION || transformation.type == Transformations.INVERSION) - this.showSymmetryElement = false; + if (!transformation) + return; if (transformation.type == Transformations.REFLECTION && getNearness([transformation.startX, transformation.startY], [transformation.endX, transformation.endY], MIN_REFLECTION_LINE_LENGTH) ||