Almost finished recangle tool

There's a Math.round bug, sometimes the opacity is off.
This commit is contained in:
unsettledgames
2020-03-06 23:21:42 +01:00
parent 0786f99d76
commit fd37518e55
11 changed files with 149 additions and 19 deletions

View File

@ -3,13 +3,10 @@ let startX;
let startY;
let endX;
let endY;
let workingLayer;
function startRectSelection(mouseEvent) {
// Putting the vfx layer on top of everything
VFXCanvas.style.zIndex = MAX_Z_INDEX;
// Saving the layer the user is working on
workingLayer = currentLayer;
// Saving the start coords of the rect
let cursorPos = getCursorPosition(mouseEvent);
@ -92,6 +89,7 @@ function drawRect(x, y) {
// Clearing the vfx canvas
vfxContext.clearRect(0, 0, VFXCanvas.width, VFXCanvas.height);
vfxContext.lineWidth = 1;
vfxContext.fillStyle = "black";
vfxContext.setLineDash([4]);
// Drawing the rect