layers and eraser

Paint the current element in the `backLayer` when it is in "eraser mode".
This commit is contained in:
abakkk 2020-10-10 15:02:01 +02:00
parent 556cbb2ab3
commit dd45e87f01
1 changed files with 12 additions and 3 deletions

15
area.js
View File

@ -328,10 +328,17 @@ var DrawingArea = new Lang.Class({
cr.stroke();
cr.restore();
}
if (this.currentElement && this.currentElement.eraser) {
this.currentElement.buildCairo(cr, { showTextCursor: this.textHasCursor,
showTextRectangle: this.currentElement.shape != Shapes.TEXT || !this.isWriting,
dummyStroke: this.currentElement.fill && this.currentElement.line.lineWidth == 0 });
cr.stroke();
}
},
_repaintFore: function(cr) {
if (!this.currentElement)
if (!this.currentElement || this.currentElement.eraser)
return;
this.currentElement.buildCairo(cr, { showTextCursor: this.textHasCursor,
@ -746,8 +753,10 @@ var DrawingArea = new Lang.Class({
this.currentElement.updateDrawing(x, y, controlPressed);
//this._redisplay();
this.foreLayer.queue_repaint();
if (this.currentElement.eraser)
this._redisplay();
else
this.foreLayer.queue_repaint();
this.updatePointerCursor(controlPressed);
},