skip when the size is too small to be visible (3px)

This commit is contained in:
abakkk 2019-03-08 12:01:19 +01:00
parent 26ae9fd784
commit 743d8d7644
1 changed files with 14 additions and 10 deletions

View File

@ -257,8 +257,12 @@ var DrawingArea = new Lang.Class({
this.buttonReleasedHandler = null; this.buttonReleasedHandler = null;
} }
// skip when the size is too small to be visible (3px)
if (this.currentElement && this.currentElement.points.length >= 2 &&
Math.hypot(this.currentElement.points[1][0] - this.currentElement.points[0][0], this.currentElement.points[1][1] - this.currentElement.points[0][1]) > 3) {
// start writing // start writing
if (this.currentShape == Shapes.TEXT && this.currentElement) { if (this.currentShape == Shapes.TEXT) {
this.currentElement.shape = Shapes.TEXT; this.currentElement.shape = Shapes.TEXT;
this.currentElement.text = ''; this.currentElement.text = '';
this.emitter.emit('show-osd', _("Type your text\nand press Enter"), null); this.emitter.emit('show-osd', _("Type your text\nand press Enter"), null);
@ -267,9 +271,9 @@ var DrawingArea = new Lang.Class({
return; return;
} }
if (this.currentElement) {
this.elements.push(this.currentElement); this.elements.push(this.currentElement);
} }
this.currentElement = null; this.currentElement = null;
this._redisplay(); this._redisplay();
}, },