Skip to content

Commit

Permalink
chore: Fixes and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Aug 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 074a72b commit 71f1a7c
Showing 2 changed files with 9 additions and 11 deletions.
13 changes: 6 additions & 7 deletions crates/core/src/elements/label.rs
Original file line number Diff line number Diff line change
@@ -60,20 +60,19 @@ impl ElementUtils for LabelElement {
let area = layout_node.visible_area();
let font_style = node_ref.get::<FontStyleState>().unwrap();

let mut text_area = area;
let mut text_shadow_area = area;

for text_shadow in &font_style.text_shadows {
text_area.move_with_offsets(
text_shadow_area.move_with_offsets(
&Length::new(text_shadow.offset.x),
&Length::new(text_shadow.offset.y),
);

text_area.expand(&Size2D::new(
text_shadow.blur_sigma as f32 * scale_factor + 1.,
text_shadow.blur_sigma as f32 * scale_factor,
));
let expanded_size = text_shadow.blur_sigma.ceil() as f32 * scale_factor;

text_shadow_area.expand(&Size2D::new(expanded_size, expanded_size))
}

area.union(&text_area)
area.union(&text_shadow_area)
}
}
7 changes: 3 additions & 4 deletions crates/core/src/elements/paragraph.rs
Original file line number Diff line number Diff line change
@@ -133,10 +133,9 @@ impl ElementUtils for ParagraphElement {
&Length::new(text_shadow.offset.y),
);

text_shadow_area.expand(&Size2D::new(
text_shadow.blur_sigma.ceil() as f32 * scale_factor + 1.,
text_shadow.blur_sigma.ceil() as f32 * scale_factor,
))
let expanded_size = text_shadow.blur_sigma.ceil() as f32 * scale_factor;

text_shadow_area.expand(&Size2D::new(expanded_size, expanded_size))
}
}

0 comments on commit 71f1a7c

Please sign in to comment.