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:
+ Player list + Player list
+ Follow player + Follow player
+ Color picker (or at the very least an Open Color color pallete) + Color picker (or at the very least an Open Color color pallete)
- EYE DROPPER! + EYE DROPPER!
- Dynamic svg cursor to represent the brush - Dynamic svg cursor to represent the brush
- Eraser - Eraser
- Line drawing - Line drawing

1
client/index.js

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

9
client/webgl_listeners.js

@ -179,6 +179,13 @@ function mousedown(e, state, context) {
return; 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) { if (context.active_image) {
// Move selected image with left click // Move selected image with left click
const image_event = image_at(state, canvasp.x, canvasp.y); const image_event = image_at(state, canvasp.x, canvasp.y);
@ -224,6 +231,8 @@ function update_color_picker_color(state, context, canvasp) {
} }
document.querySelector('.picker-preview-inner').style.background = color_under_cursor; document.querySelector('.picker-preview-inner').style.background = color_under_cursor;
state.color_picked = color_under_cursor;
} }
function mousemove(e, state, context) { function mousemove(e, state, context) {

Loading…
Cancel
Save