Set text fill color to the primary color (#521)
* Fix text has no fill * Use primary color for text fill * Use correct text color when editing * Change fallback text color to gray
This commit is contained in:
parent
5ea4654f53
commit
cb9a37b638
|
|
@ -9,6 +9,7 @@ use crate::misc::{HintData, HintGroup, HintInfo, KeysGroup};
|
|||
use crate::viewport_tools::tool::{DocumentToolData, Fsm, ToolActionHandlerData};
|
||||
|
||||
use glam::{DAffine2, DVec2};
|
||||
use graphene::color::Color;
|
||||
use graphene::intersection::Quad;
|
||||
use graphene::layers::style::{self, Fill, Stroke};
|
||||
use graphene::Operation;
|
||||
|
|
@ -253,7 +254,7 @@ impl Fsm for TextToolFsmState {
|
|||
transform: DAffine2::ZERO.to_cols_array(),
|
||||
insert_index: -1,
|
||||
text: r#""#.to_string(),
|
||||
style: style::PathStyle::new(Some(style::Stroke::new(tool_data.primary_color, 0.)), None),
|
||||
style: style::PathStyle::new(None, Some(Fill::new(tool_data.primary_color))),
|
||||
size: font_size as f64,
|
||||
}
|
||||
.into(),
|
||||
|
|
|
|||
|
|
@ -197,7 +197,6 @@
|
|||
overflow: visible;
|
||||
|
||||
div {
|
||||
color: black;
|
||||
background: none;
|
||||
cursor: text;
|
||||
border: none;
|
||||
|
|
|
|||
|
|
@ -43,13 +43,17 @@ impl LayerData for Text {
|
|||
if self.editable {
|
||||
let _ = write!(
|
||||
svg,
|
||||
r#"<foreignObject transform="matrix({})"></foreignObject>"#,
|
||||
r#"<foreignObject transform="matrix({})" style="color: {}"></foreignObject>"#,
|
||||
transform
|
||||
.to_cols_array()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, entry)| { entry.to_string() + if i == 5 { "" } else { "," } })
|
||||
.collect::<String>(),
|
||||
match self.style.fill() {
|
||||
Some(fill) => format!("#{}", fill.color().rgba_hex()),
|
||||
None => "gray".to_string(),
|
||||
}
|
||||
);
|
||||
} else {
|
||||
let mut path = self.to_bez_path();
|
||||
|
|
|
|||
Loading…
Reference in New Issue