diff --git a/src/animation/components/Editor.ts b/src/animation/components/Editor.ts index cf78131..cd96c35 100644 --- a/src/animation/components/Editor.ts +++ b/src/animation/components/Editor.ts @@ -1,4 +1,4 @@ -import {Mesh, Object3D} from "three"; +import {Color, Material, Mesh, MeshBasicMaterial, Object3D} from "three"; import IUpdatable from "@/animation/components/IUpdatable"; import {circle} from "@/animation/Helpers"; import {camera, scene} from "@/animation/Home"; @@ -9,14 +9,13 @@ import {minMax} from "@/utils"; export default class Editor implements IUpdatable { hand: Mesh - color = '#664400' radius = 3 scale = 1 z = config.editor.zMax constructor() { - this.hand = circle(this.color, 0, this.radius) + this.hand = circle('#ffffff', 0, this.radius) scene.add(this.hand) window.addEventListener('wheel', (e) => @@ -50,4 +49,16 @@ export default class Editor implements IUpdatable this.hand.position.copy(pos) return } + + get color(): string + { + return this.handMaterial.color.getHexString() + } + + set color(value: string) + { + this.handMaterial.color.setStyle(value.substr(0, 7)) + } + + get handMaterial(): MeshBasicMaterial { return (this.hand.material as MeshBasicMaterial) } } diff --git a/src/utils.ts b/src/utils.ts index 8bb1937..7f4c76f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -46,7 +46,7 @@ export type Keybinds = {[id: string]: (e: KeyboardEvent) => unknown} */ export class KeyHandler extends Vue { - keybinds?: Keybinds + keybinds: Keybinds = {} mounted(): void { @@ -60,7 +60,6 @@ export class KeyHandler extends Vue keyListener(e: KeyboardEvent): void { - if (!this.keybinds) return if (e.key in this.keybinds) { if (this.keybinds[e.key](e) !== false) diff --git a/src/views/NewHome.vue b/src/views/NewHome.vue index 8de68f3..72ac8cf 100644 --- a/src/views/NewHome.vue +++ b/src/views/NewHome.vue @@ -29,7 +29,7 @@