Browse Source

Make color picker actually change the active color

ssao
A.Olokhtonov 7 months ago
parent
commit
e4a10ebf30
  1. 2
      README.txt
  2. 1
      client/index.js
  3. 9
      client/webgl_listeners.js

2
README.txt

@ -34,7 +34,7 @@ Release: @@ -34,7 +34,7 @@ Release:
+ Player list
+ Follow player
+ Color picker (or at the very least an Open Color color pallete)
- EYE DROPPER!
+ EYE DROPPER!
- Dynamic svg cursor to represent the brush
- Eraser
- Line drawing

1
client/index.js

@ -220,6 +220,7 @@ async function main() { @@ -220,6 +220,7 @@ async function main() {
'stats': {},
'following_player': null,
'color_picked': null,
'wasm': {},
};

9
client/webgl_listeners.js

@ -179,6 +179,13 @@ function mousedown(e, state, context) { @@ -179,6 +179,13 @@ function mousedown(e, state, context) {
return;
}
if (state.colorpicking) {
const color_u32 = color_to_u32(state.color_picked.substring(1));
state.players[state.me].color = color_u32;
fire_event(state, color_event(color_u32));
return;
}
if (context.active_image) {
// Move selected image with left click
const image_event = image_at(state, canvasp.x, canvasp.y);
@ -224,6 +231,8 @@ function update_color_picker_color(state, context, canvasp) { @@ -224,6 +231,8 @@ function update_color_picker_color(state, context, canvasp) {
}
document.querySelector('.picker-preview-inner').style.background = color_under_cursor;
state.color_picked = color_under_cursor;
}
function mousemove(e, state, context) {

Loading…
Cancel
Save