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.
This commit is contained in:
abakkk 2020-06-07 20:37:13 +02:00
parent 2c632c3d3a
commit d0177aa8eb
1 changed files with 9 additions and 2 deletions

11
draw.js
View File

@ -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;