MVP eyedropper tool for fill colors (#300)

* Implement eyedropper for layer fill colors

* Add shortcut for eyedropper

* Add right mouse sampling for secondary color
This commit is contained in:
Henry Sloan
2021-07-24 18:29:32 -04:00
committed by Keavon Chambers
parent 03c5847d7e
commit 7d3239ecac
4 changed files with 49 additions and 5 deletions

View File

@@ -19,6 +19,9 @@ impl Fill {
pub fn new(color: Color) -> Self {
Self { color: Some(color) }
}
pub fn color(&self) -> Option<Color> {
self.color
}
pub fn none() -> Self {
Self { color: None }
}
@@ -41,6 +44,12 @@ impl Stroke {
pub fn new(color: Color, width: f32) -> Self {
Self { color, width }
}
pub fn color(&self) -> Color {
self.color
}
pub fn width(&self) -> f32 {
self.width
}
pub fn render(&self) -> String {
format!(r##" stroke="#{}"{} stroke-width="{}""##, self.color.rgb_hex(), format_opacity("stroke", self.color.a()), self.width)
}