Draw selection overlay later

main
kts of kettek 2024-02-24 12:55:31 -08:00
parent 33c36990e2
commit 17e0b41b2d
1 changed files with 6 additions and 6 deletions

View File

@ -139,12 +139,6 @@
ctx.drawImage(file.canvas.canvas, offsetX, offsetY)
ctx.restore()
// Draw our selection overlay.
if (file.selection.active) {
ctx.imageSmoothingEnabled = false
ctx.drawImage(file.selection.marchingCanvas, offsetX*zoom, offsetY*zoom)
}
// FIXME: Reorganize overlay drawing to have two types: regular composition, such as this pixel brush preview, and difference composition for cursors and bounding boxes.
// Draw brush preview.
if (currentTool instanceof BrushTool) {
@ -203,6 +197,12 @@
ctx.stroke()
}
// Draw our selection overlay.
if (file.selection.active) {
ctx.imageSmoothingEnabled = false
ctx.drawImage(file.selection.marchingCanvas, offsetX*zoom, offsetY*zoom)
}
// Draw our overlay with difference composition so visibility is better.
ctx.save()
ctx.globalCompositeOperation = 'difference'