Skip to content

Commit 86a9778

Browse files
authored
Change eyedropper to use correct message (#327)
1 parent 399111d commit 86a9778

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

core/editor/src/tool/tools/eyedropper.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::consts::SELECTION_TOLERANCE;
2-
use crate::frontend::FrontendMessage;
32
use crate::message_prelude::*;
43
use crate::tool::{ToolActionHandlerData, ToolMessage};
54
use glam::DVec2;
@@ -32,14 +31,11 @@ impl<'a> MessageHandler<ToolMessage, ToolActionHandlerData<'a>> for Eyedropper {
3231

3332
if let Some(path) = data.0.document.intersects_quad_root(quad).last() {
3433
if let Ok(layer) = data.0.document.layer(path) {
35-
if let Some(fill) = layer.style.fill() {
36-
if let Some(color) = fill.color() {
37-
let (primary, secondary) = match action {
38-
ToolMessage::Eyedropper(EyedropperMessage::LeftMouseDown) => (color, data.1.secondary_color),
39-
ToolMessage::Eyedropper(EyedropperMessage::RightMouseDown) => (data.1.primary_color, color),
40-
_ => (data.1.primary_color, data.1.secondary_color),
41-
};
42-
responses.push_back(FrontendMessage::UpdateWorkingColors { primary, secondary }.into());
34+
if let Some(color) = layer.style.fill().and_then(|fill| fill.color()) {
35+
match action {
36+
ToolMessage::Eyedropper(EyedropperMessage::LeftMouseDown) => responses.push_back(ToolMessage::SelectPrimaryColor(color).into()),
37+
ToolMessage::Eyedropper(EyedropperMessage::RightMouseDown) => responses.push_back(ToolMessage::SelectSecondaryColor(color).into()),
38+
_ => {}
4339
}
4440
}
4541
}

0 commit comments

Comments
 (0)