mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
fixed rectangle symmetry on update color
This commit is contained in:
@@ -49,6 +49,10 @@ class RectangleTool extends ResizableTool {
|
|||||||
this.startMousePos[0] = Math.floor(mousePos[0] / currFile.zoom) + 0.5;
|
this.startMousePos[0] = Math.floor(mousePos[0] / currFile.zoom) + 0.5;
|
||||||
this.startMousePos[1] = Math.floor(mousePos[1] / currFile.zoom) + 0.5;
|
this.startMousePos[1] = Math.floor(mousePos[1] / currFile.zoom) + 0.5;
|
||||||
|
|
||||||
|
this.drawRect(this.startMousePos[0], this.startMousePos[1],
|
||||||
|
this.startMousePos[0], this.startMousePos[1]
|
||||||
|
);
|
||||||
|
|
||||||
new HistoryState().EditCanvas();
|
new HistoryState().EditCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +99,6 @@ class RectangleTool extends ResizableTool {
|
|||||||
currFile.currentLayer.context.fillRect(startRectX, startRectY, endRectX - startRectX, endRectY - startRectY);
|
currFile.currentLayer.context.fillRect(startRectX, startRectY, endRectX - startRectX, endRectY - startRectY);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearCanvas(tmpContext);
|
|
||||||
|
|
||||||
if (currFile.hSymmetricLayer.isEnabled) {
|
if (currFile.hSymmetricLayer.isEnabled) {
|
||||||
if (typeof this.horizontalMirrorCoordinates != 'undefined') {
|
if (typeof this.horizontalMirrorCoordinates != 'undefined') {
|
||||||
|
|
||||||
@@ -109,8 +111,7 @@ class RectangleTool extends ResizableTool {
|
|||||||
endMirrorRectX,
|
endMirrorRectX,
|
||||||
startMirrorRectX,
|
startMirrorRectX,
|
||||||
endMirrorRectY,
|
endMirrorRectY,
|
||||||
startMirrorRectY,
|
startMirrorRectY
|
||||||
tmpContext
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,8 +128,7 @@ class RectangleTool extends ResizableTool {
|
|||||||
endMirrorRectX,
|
endMirrorRectX,
|
||||||
startMirrorRectX,
|
startMirrorRectX,
|
||||||
endMirrorRectY,
|
endMirrorRectY,
|
||||||
startMirrorRectY,
|
startMirrorRectY
|
||||||
tmpContext
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,12 +144,13 @@ class RectangleTool extends ResizableTool {
|
|||||||
endMirrorRectX,
|
endMirrorRectX,
|
||||||
startMirrorRectX,
|
startMirrorRectX,
|
||||||
endMirrorRectY,
|
endMirrorRectY,
|
||||||
startMirrorRectY,
|
startMirrorRectY
|
||||||
tmpContext
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.clearCanvas(tmpContext);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,9 +159,8 @@ class RectangleTool extends ResizableTool {
|
|||||||
* @param startMirrorRectX
|
* @param startMirrorRectX
|
||||||
* @param endMirrorRectY
|
* @param endMirrorRectY
|
||||||
* @param startMirrorRectY
|
* @param startMirrorRectY
|
||||||
* @param tmpContext
|
|
||||||
*/
|
*/
|
||||||
handleMirrorRectDrawing(endMirrorRectX, startMirrorRectX, endMirrorRectY, startMirrorRectY, tmpContext) {
|
handleMirrorRectDrawing(endMirrorRectX, startMirrorRectX, endMirrorRectY, startMirrorRectY) {
|
||||||
const mirrorCoordinates = this.adjustCoordinates(
|
const mirrorCoordinates = this.adjustCoordinates(
|
||||||
endMirrorRectX,
|
endMirrorRectX,
|
||||||
startMirrorRectX,
|
startMirrorRectX,
|
||||||
@@ -187,15 +187,12 @@ class RectangleTool extends ResizableTool {
|
|||||||
endMirrorRectY - startMirrorRectY
|
endMirrorRectY - startMirrorRectY
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.clearCanvas(tmpContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the layer preview and clears the tmp canvas
|
/** Updates the layer preview and clears the tmp canvas
|
||||||
* @param {*} tmpContext tmp canvas context
|
* @param {*} tmpContext tmp canvas context
|
||||||
*/
|
*/
|
||||||
clearCanvas(tmpContext) {
|
clearCanvas(tmpContext) {
|
||||||
// Update the layer preview
|
|
||||||
currFile.currentLayer.updateLayerPreview();
|
|
||||||
// Clearing the tmp canvas
|
// Clearing the tmp canvas
|
||||||
tmpContext.clearRect(0, 0, currFile.TMPLayer.canvas.width, currFile.TMPLayer.canvas.height);
|
tmpContext.clearRect(0, 0, currFile.TMPLayer.canvas.width, currFile.TMPLayer.canvas.height);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user