From d0177aa8eb7f5f1cf131a67ead5fc52893c084d3 Mon Sep 17 00:00:00 2001 From: abakkk Date: Sun, 7 Jun 2020 20:37:13 +0200 Subject: [PATCH] Fix null line-width when drawing It may be usefull to select null line width in combination with fill. However user cannot see what he's drawing. So add a dummy stroke while drawing. --- draw.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/draw.js b/draw.js index 86b1aa7..a3c7743 100644 --- a/draw.js +++ b/draw.js @@ -214,6 +214,13 @@ var DrawingArea = new Lang.Class({ if (this.currentElement) { this.currentElement.buildCairo(cr, this.textHasCursor); + + if (this.currentElement.fill && this.currentElement.line.lineWidth == 0) { + // add a dummy stroke while drawing + cr.setLineWidth(2); + cr.setDash([1, 2], 0); + } + cr.stroke(); } @@ -385,8 +392,8 @@ var DrawingArea = new Lang.Class({ }); if (this.currentShape == Shapes.TEXT) { - this.currentElement.line = { lineWidth: 1, lineJoin: 0, lineCap: 0 }; - this.currentElement.dash = { array: [1, 1] , offset: 0 }; + this.currentElement.line = { lineWidth: 2, lineJoin: 0, lineCap: 0 }; + this.currentElement.dash = { array: [1, 2] , offset: 0 }; this.currentElement.fill = false; this.currentElement.text = _("Text"); this.currentElement.state = TextState.DRAWING;