CSS rule cleaning; fixed canvas clear issues; added rotation global
This commit is contained in:
@@ -10,8 +10,6 @@ div { padding: 0.5em; }
|
|||||||
#menu { background-color: #FFDAB9; height: -webkit-fill-available; }
|
#menu { background-color: #FFDAB9; height: -webkit-fill-available; }
|
||||||
#script { background-color: #B0C4DE; height: -webkit-fill-available; }
|
#script { background-color: #B0C4DE; height: -webkit-fill-available; }
|
||||||
#menu > .script-block { background-color: #FF7F4F !important; }
|
#menu > .script-block { background-color: #FF7F4F !important; }
|
||||||
#script > .script-block,
|
|
||||||
.script-nest > .script-block { background-color: #1E90FF !important; }
|
|
||||||
#script .script-nest { background-color: #B0C4DE !important; }
|
#script .script-nest { background-color: #B0C4DE !important; }
|
||||||
|
|
||||||
.flex-parent {
|
.flex-parent {
|
||||||
@@ -41,4 +39,5 @@ div { padding: 0.5em; }
|
|||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.script-block { background-color: #1E90FF !important; }
|
||||||
.script-nest { background-color: #FFDAB9; }
|
.script-nest { background-color: #FFDAB9; }
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ const resetCanvasState = () => {
|
|||||||
clearCanvas();
|
clearCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetRotation = () => { Painter.rotation = 0; }
|
const resetRotation = () => { Painter.rotation = ROTATION; }
|
||||||
const clearCanvas = () => { Painter.canvasContext.clearRect(0, 0, canvas.width, canvas.height); }
|
|
||||||
|
|
||||||
const resetCanvasBrush = () => {
|
const resetCanvasBrush = () => {
|
||||||
setDefaultBrushSize();
|
setDefaultBrushSize();
|
||||||
@@ -13,6 +12,11 @@ const resetCanvasBrush = () => {
|
|||||||
setBrushToCenter();
|
setBrushToCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clearCanvas = () => {
|
||||||
|
Painter.canvasContext.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
Painter.canvasContext.beginPath();
|
||||||
|
}
|
||||||
|
|
||||||
const setDefaultBrushSize = () => {
|
const setDefaultBrushSize = () => {
|
||||||
Painter.brushSize = BRUSH_SIZE;
|
Painter.brushSize = BRUSH_SIZE;
|
||||||
Painter.canvasContext.lineWidth = BRUSH_SIZE;
|
Painter.canvasContext.lineWidth = BRUSH_SIZE;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ window.onload = (eve) => {
|
|||||||
|
|
||||||
clearBttn.onclick = (eve) => {
|
clearBttn.onclick = (eve) => {
|
||||||
clearScriptNode();
|
clearScriptNode();
|
||||||
clearCanvas();
|
resetCanvasState();
|
||||||
}
|
}
|
||||||
|
|
||||||
saveBttn.onclick = (eve) => { saveScript(); }
|
saveBttn.onclick = (eve) => { saveScript(); }
|
||||||
|
|||||||
@@ -14,13 +14,14 @@ const ScriptElms = {
|
|||||||
|
|
||||||
const BRUSH_SIZE = 2;
|
const BRUSH_SIZE = 2;
|
||||||
const BRUSH_COLOR = "#000000";
|
const BRUSH_COLOR = "#000000";
|
||||||
|
const ROTATION = 0;
|
||||||
|
|
||||||
let Painter = {
|
let Painter = {
|
||||||
canvas: null,
|
canvas: null,
|
||||||
canvasContext: null,
|
canvasContext: null,
|
||||||
brushSize: BRUSH_SIZE,
|
brushSize: BRUSH_SIZE,
|
||||||
brushColor: BRUSH_COLOR,
|
brushColor: BRUSH_COLOR,
|
||||||
rotation: 0,
|
rotation: ROTATION,
|
||||||
x1: 0,
|
x1: 0,
|
||||||
y1: 0,
|
y1: 0,
|
||||||
isBrushLifted: false
|
isBrushLifted: false
|
||||||
|
|||||||
Reference in New Issue
Block a user