Implement color picker for primary/secondary working colors (#70)

* feat/color-picker: rework

* feat(161) lint

* feat(161) Remove response handlers

* feat(161) fix rgb <-> hsv conversion

* feat(161) inverse swatchs and add checkered bg

* feat(161) remove temporary color assignment

* feat(161) move cursor outside of the box

* feat(161) @Keavon feedbacks

* feat(161) lint

* feat(161) fix opacity-picker color

* feat(161) --saturation-picker-color
This commit is contained in:
Chrs Msln
2021-05-27 23:59:52 +02:00
committed by Keavon Chambers
parent a70605b514
commit b56dfd746f
4 changed files with 329 additions and 31 deletions
@@ -154,6 +154,7 @@
height: 100%;
svg {
background: #ffffff;
width: 100%;
height: 100%;
}
@@ -222,10 +223,6 @@ export default defineComponent({
}
todo(toolIndex);
},
async updatePrimaryColor(c: { r: number; g: number; b: number; a: number }) {
const { update_primary_color, Color } = await wasm;
update_primary_color(new Color(c.r, c.g, c.b, c.a));
},
},
mounted() {
registerResponseHandler(ResponseType.UpdateCanvas, (responseData: Response) => {
@@ -239,9 +236,6 @@ export default defineComponent({
window.addEventListener("keyup", (e: KeyboardEvent) => this.keyUp(e));
window.addEventListener("keydown", (e: KeyboardEvent) => this.keyDown(e));
// TODO: Implement an actual UI for chosing colors (this is completely temporary)
this.updatePrimaryColor({ r: 247 / 255, g: 76 / 255, b: 0 / 255, a: 0.6 });
},
data() {
return {