fix transformation stopping

* Handle case where grabbed element does not have transformation to stop.
* Update cursor after erasing drawing while an element is grabbed.
This commit is contained in:
abakkk 2020-10-09 08:48:42 +02:00
parent 44ba9ba17d
commit ed167f8d1b
2 changed files with 9 additions and 4 deletions

View File

@ -884,8 +884,12 @@ var DrawingArea = new Lang.Class({
// A priori there is nothing to stop, except transformations, if there is no current element. // 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. // 'force' argument is passed when leaving drawing mode to ensure all is clean, as a workaround for possible bugs.
_stopAll: function(force) { _stopAll: function(force) {
if (this.grabbedElement) if (this.grabbedElement) {
this._stopTransforming(); this._stopTransforming();
this.grabbedElement = null;
this.grabbedElementLocked = null;
this.updatePointerCursor();
}
if (!this.currentElement && !force) if (!this.currentElement && !force)
return; return;

View File

@ -577,11 +577,12 @@ const _DrawingElement = new Lang.Class({
}, },
stopTransformation: function() { stopTransformation: function() {
this.showSymmetryElement = false;
// Clean transformations // Clean transformations
let transformation = this.lastTransformation; let transformation = this.lastTransformation;
if (!transformation)
if (transformation.type == Transformations.REFLECTION || transformation.type == Transformations.INVERSION) return;
this.showSymmetryElement = false;
if (transformation.type == Transformations.REFLECTION && if (transformation.type == Transformations.REFLECTION &&
getNearness([transformation.startX, transformation.startY], [transformation.endX, transformation.endY], MIN_REFLECTION_LINE_LENGTH) || getNearness([transformation.startX, transformation.startY], [transformation.endX, transformation.endY], MIN_REFLECTION_LINE_LENGTH) ||