Closed crumblingstatue closed 3 years ago
Thanks for the idea! I do agree something like this would improve usability. I'm thinking how to handle platforms where the display picker is unsupported like WASM. I guess the shortcut would only work when there is a display picker and otherwise it would be a nop.
Here is a cleaner implementation
diff --git a/src/app/mod.rs b/src/app/mod.rs
index af82d59..87f4c0b 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -656,6 +656,9 @@ impl App {
) {
if let Some(picker) = self.display_picker.clone() {
if let Ok(color) = picker.get_color_under_cursor() {
+ if ui.ctx().input().key_pressed(egui::Key::P) {
+ self.picker.set_cur_color(color);
+ }
ui.horizontal(|mut ui| {
ui.label("Color at cursor: ");
self.color_box_label_side(&color, vec2(25., 25.), &mut ui, tex_allocator);
Yes, that is the way. It would have to be handled inside of the platform specific code handle_zoom_picker
.
Another usability idea: Use key_down instead of key_pressed, so the user can hold down the picker key to continuously change the color. It makes precision picking easier.
I wonder if key_down
can be differentiated from key_pressed
, then it could perhaps set a color immediately on key_pressed
and spawn a zoomed picker on key_down
showing the area around the mouse. On release it would save the color to saved colors.
That's an interesting idea!
Thank you, it's working well!
I couldn't find any such key.
I would like something to the effect of