a whole load of work in progress
This commit is contained in:
parent
caec0b8ac9
commit
26ba098183
63 changed files with 3234 additions and 321 deletions
37
static/brush-editor.js
Normal file
37
static/brush-editor.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
const defaultBrush = `
|
||||
; This is your brush.
|
||||
; Feel free to edit it to your liking!
|
||||
(stroke
|
||||
8 ; thickness
|
||||
(rgba 0.0 0.0 0.0 1.0) ; color
|
||||
(vec)) ; position
|
||||
`.trim();
|
||||
|
||||
export class BrushEditor extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.classList.add("rkgk-panel");
|
||||
|
||||
this.textArea = this.appendChild(document.createElement("pre"));
|
||||
this.textArea.classList.add("text-area");
|
||||
this.textArea.textContent = defaultBrush;
|
||||
this.textArea.contentEditable = true;
|
||||
this.textArea.spellcheck = false;
|
||||
this.textArea.addEventListener("input", () => {
|
||||
this.dispatchEvent(
|
||||
Object.assign(new Event(".codeChanged"), {
|
||||
newCode: this.textArea.value,
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
get code() {
|
||||
return this.textArea.textContent;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("rkgk-brush-editor", BrushEditor);
|
Loading…
Add table
Add a link
Reference in a new issue