Fix issue with selection fillColor opacity

This commit is contained in:
Philip Matsson
2024-10-10 14:22:28 +02:00
committed by Matthieu Baumann
parent baa8f53349
commit 1f790a4b54
4 changed files with 9 additions and 4 deletions

View File

@@ -978,6 +978,7 @@ canvas {
font-family: monospace; font-family: monospace;
line-height: 1rem; line-height: 1rem;
z-index: 100;
float: left; float: left;
} }

View File

@@ -58,7 +58,7 @@ export class CircleSelect extends FSM {
// draw the selection // draw the selection
let colorValue = (typeof options.color === 'function') ? options.color(this.startCoo, this.coo) : options.color; let colorValue = (typeof options.color === 'function') ? options.color(this.startCoo, this.coo) : options.color;
ctx.fillStyle = colorValue; ctx.fillStyle = colorValue + '7f';
ctx.strokeStyle = colorValue; ctx.strokeStyle = colorValue;
ctx.lineWidth = options.lineWidth; ctx.lineWidth = options.lineWidth;

View File

@@ -99,7 +99,6 @@ export class PolySelect extends FSM {
e.stopPropagation(); e.stopPropagation();
e.preventDefault() e.preventDefault()
btn.remove();
self.dispatch('finish'); self.dispatch('finish');
} }
}); });
@@ -125,7 +124,7 @@ export class PolySelect extends FSM {
// draw the selection // draw the selection
ctx.save(); ctx.save();
let colorValue = (typeof options.color === 'function') ? options.color() : options.color; let colorValue = (typeof options.color === 'function') ? options.color() : options.color;
ctx.fillStyle = colorValue; ctx.fillStyle = colorValue + '7f';
ctx.strokeStyle = colorValue; ctx.strokeStyle = colorValue;
ctx.lineWidth = options.lineWidth; ctx.lineWidth = options.lineWidth;
@@ -147,6 +146,7 @@ export class PolySelect extends FSM {
} }
let finish = () => { let finish = () => {
if (this.coos.length <= 2) { if (this.coos.length <= 2) {
console.warn("Invalid selection, please draw at least a 3 vertices polygon") console.warn("Invalid selection, please draw at least a 3 vertices polygon")
@@ -156,6 +156,10 @@ export class PolySelect extends FSM {
return; return;
} }
if(btn) {
btn.remove();
}
// finish the selection // finish the selection
let xMin = this.coos[0].x let xMin = this.coos[0].x
let yMin = this.coos[0].y let yMin = this.coos[0].y

View File

@@ -60,7 +60,7 @@ export class RectSelect extends FSM {
// draw the selection // draw the selection
let colorValue = (typeof options.color === 'function') ? options.color(this.startCoo, this.coo) : options.color; let colorValue = (typeof options.color === 'function') ? options.color(this.startCoo, this.coo) : options.color;
ctx.fillStyle = colorValue; ctx.fillStyle = colorValue + '7f';
ctx.strokeStyle = colorValue; ctx.strokeStyle = colorValue;
ctx.lineWidth = options.lineWidth; ctx.lineWidth = options.lineWidth;