format cleanup

This commit is contained in:
2026-11-01 00:50:50 -05:00
parent fcee92d88b
commit 9315c903a8
2 changed files with 23 additions and 23 deletions
+22 -22
View File
@@ -26,7 +26,7 @@ class BaseInputScriptElement extends BaseScriptElement {
`; `;
} }
action() { console.log( this.value ); } action() { console.log("Input Value: ", this.value ); }
} }
class RepeatElement extends BaseInputScriptElement { class RepeatElement extends BaseInputScriptElement {
@@ -60,26 +60,26 @@ class RepeatElement extends BaseInputScriptElement {
} }
class LeftElement extends BaseInputScriptElement { class LeftElement extends BaseInputScriptElement {
get prefix() { return 'Left'; } get prefix() { return 'Left'; }
get defaultValue() { return '5'; } get defaultValue() { return '5'; }
get postfix() { return 'degrees'; } get postfix() { return 'degrees'; }
constructor() { super(); } constructor() { super(); }
action(Painter) { Painter.rotation -= this.value; } action(Painter) { Painter.rotation -= this.value; }
} }
class RightElement extends BaseInputScriptElement { class RightElement extends BaseInputScriptElement {
get prefix() { return 'Right'; } get prefix() { return 'Right'; }
get defaultValue() { return '5'; } get defaultValue() { return '5'; }
get postfix() { return 'degrees'; } get postfix() { return 'degrees'; }
constructor() { super(); } constructor() { super(); }
action(Painter) { Painter.rotation += this.value; } action(Painter) { Painter.rotation += this.value; }
} }
class ForwardElement extends BaseInputScriptElement { class ForwardElement extends BaseInputScriptElement {
get prefix() { return 'Forward'; } get prefix() { return 'Forward'; }
get defaultValue() { return '10'; } get defaultValue() { return '10'; }
get postfix() { return 'steps'; } get postfix() { return 'steps'; }
constructor() { super(); } constructor() { super(); }
action(Painter) { action(Painter) {
let magnitude = this.value let magnitude = this.value
let radians = Painter.rotation * (Math.PI / 180); let radians = Painter.rotation * (Math.PI / 180);
@@ -100,10 +100,10 @@ class ForwardElement extends BaseInputScriptElement {
} }
class BackElement extends BaseInputScriptElement { class BackElement extends BaseInputScriptElement {
get prefix() { return 'Back'; } get prefix() { return 'Back'; }
get defaultValue() { return '10'; } get defaultValue() { return '10'; }
get postfix() { return 'steps'; } get postfix() { return 'steps'; }
constructor() { super(); } constructor() { super(); }
action(Painter) { action(Painter) {
let magnitude = this.value let magnitude = this.value
let radians = (Painter.rotation + 180) % 360; let radians = (Painter.rotation + 180) % 360;
@@ -125,9 +125,9 @@ class BackElement extends BaseInputScriptElement {
class CircleElement extends BaseInputScriptElement { class CircleElement extends BaseInputScriptElement {
get prefix() { return 'Circle'; } get prefix() { return 'Circle'; }
get defaultValue() { return '20'; } get defaultValue() { return '20'; }
get postfix() { return 'radius'; } get postfix() { return 'radius'; }
constructor() { super(); } constructor() { super(); }
action(Painter) { action(Painter) {
Painter.canvasContext.beginPath(); Painter.canvasContext.beginPath();
Painter.canvasContext.arc(Painter.x1, Painter.y1, this.value, 0, 2 * Math.PI); Painter.canvasContext.arc(Painter.x1, Painter.y1, this.value, 0, 2 * Math.PI);
@@ -159,9 +159,9 @@ class BackToCenterElement extends BaseScriptElement {
class BrushSizeElement extends BaseInputScriptElement { class BrushSizeElement extends BaseInputScriptElement {
get prefix() { return 'Brush Size'; } get prefix() { return 'Brush Size'; }
get defaultValue() { return 24; } get defaultValue() { return 24; }
get postfix() { return 'px'; } get postfix() { return 'px'; }
constructor() { super(); } constructor() { super(); }
connectedCallback() { connectedCallback() {
this.innerHTML = ` this.innerHTML = `
<li> <li>
@@ -172,15 +172,15 @@ class BrushSizeElement extends BaseInputScriptElement {
`; `;
} }
action(Painter) { action(Painter) {
Painter.brushSize = this.value; Painter.brushSize = this.value;
Painter.canvasContext.lineWidth = this.value; Painter.canvasContext.lineWidth = this.value;
} }
} }
class BrushColorElement extends BaseInputScriptElement { class BrushColorElement extends BaseInputScriptElement {
get prefix() { return 'Brush Color'; } get prefix() { return 'Brush Color'; }
get defaultValue() { return '#000000'; } get defaultValue() { return '#000000'; }
constructor() { super(); } constructor() { super(); }
connectedCallback() { connectedCallback() {
this.innerHTML = ` this.innerHTML = `
<li> <li>
+1 -1
View File
@@ -1,4 +1,4 @@
const ScriptElms = { const ScriptElms = {
"brush-size-element": BrushSizeElement, "brush-size-element": BrushSizeElement,
"brush-color-element": BrushColorElement, "brush-color-element": BrushColorElement,
"back-to-center-element": BackToCenterElement, "back-to-center-element": BackToCenterElement,