Skip to content

Commit a782900

Browse files
committed
Adjust y positioning
1 parent c518a35 commit a782900

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

editor/src/messages/portfolio/document/overlays/utility_types_vello.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,11 @@ impl OverlayContextInternal {
983983
let mut data = vec![0u8; (PATTERN_WIDTH * PATTERN_HEIGHT * 4) as usize];
984984
let rgba = color.to_rgba8_srgb();
985985

986+
// ┌▄▄┬──┬──┬──┐
987+
// ├▀▀┼──┼──┼──┤
988+
// ├──┼──┼▄▄┼──┤
989+
// ├──┼──┼▀▀┼──┤
990+
// └──┴──┴──┴──┘
986991
// Set pixels at (0,0) and (2,2) to the specified color
987992
let pixels = [(0, 0), (2, 2)];
988993
for &(x, y) in &pixels {
@@ -1065,9 +1070,9 @@ impl OverlayContextInternal {
10651070
Pivot::End => position.x = -padding - text_width,
10661071
}
10671072
match pivot[1] {
1068-
Pivot::Start => position.y = padding + text_height * 0.8, // Account for baseline
1069-
Pivot::Middle => position.y = text_height * 0.3, // Center on x-height
1070-
Pivot::End => position.y = -padding - text_height * 0.2,
1073+
Pivot::Start => position.y = padding,
1074+
Pivot::Middle => position.y -= text_height * 0.5,
1075+
Pivot::End => position.y = -padding - text_height,
10711076
}
10721077

10731078
let text_transform = transform * DAffine2::from_translation(position);

0 commit comments

Comments
 (0)