mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Added fill mode for the rectangle tool
You can select the fill mode by clicking again on the rect button once you select it. Also added new icons.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
var rectangleSize = 1;
|
||||
var prevRectangleSie = rectangleSize;
|
||||
var emptySVG = document.getElementById("empty-button-svg");
|
||||
var fullSVG = document.getElementById("full-button-svg");
|
||||
|
||||
var drawMode = 'empty';
|
||||
var isDrawingRect = false;
|
||||
@@ -70,19 +72,10 @@ function endRectDrawing(mouseEvent) {
|
||||
line(endRectX, endRectY, startRectX, endRectY, rectangleSize);
|
||||
line(startRectX, endRectY, startRectX, startRectY, rectangleSize);
|
||||
|
||||
/*
|
||||
// Drawing the final rectangle
|
||||
currentLayer.context.lineWidth = rectangleSize;
|
||||
currentLayer.context.strokeStyle = currentGlobalColor;
|
||||
if (drawMode == 'fill') {
|
||||
currentLayer.context.fillRect(startRectX, startRectY, endRectX - startRectX, endRectY - startRectY);
|
||||
}
|
||||
|
||||
// Drawing the rect
|
||||
currentLayer.context.beginPath();
|
||||
console.log("Coords: " + startRectX + ", " + startRectY);
|
||||
currentLayer.context.imageSmoothingEnabled = false;
|
||||
currentLayer.context.rect(startRectX, startRectY, endRectX - startRectX, endRectY - startRectY);
|
||||
currentLayer.context.setLineDash([]);
|
||||
currentLayer.context.stroke();
|
||||
*/
|
||||
// Clearing the vfx canvas
|
||||
vfxContext.clearRect(0, 0, VFXCanvas.width, VFXCanvas.height);
|
||||
}
|
||||
@@ -106,6 +99,17 @@ function drawRectangle(x, y) {
|
||||
vfxContext.stroke();
|
||||
}
|
||||
|
||||
function setRectToolSvg() {
|
||||
if (drawMode == 'empty') {
|
||||
emptySVG.setAttribute("display", "visible");
|
||||
fullSVG.setAttribute("display", "none");
|
||||
}
|
||||
else {
|
||||
emptySVG.setAttribute("display", "none");
|
||||
fullSVG.setAttribute("display", "visible");
|
||||
}
|
||||
}
|
||||
|
||||
function applyChanges() {
|
||||
VFXCanvas.style.zIndex = MIN_Z_INDEX;
|
||||
}
|
Reference in New Issue
Block a user