mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Fix math.stretch
not working vertically with attachments (#5069)
This commit is contained in:
parent
1a24b29d86
commit
75f646c975
@ -73,9 +73,15 @@ pub(super) fn stretch_fragment(
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let Some(axis) = axis.or_else(|| stretch_axis(ctx, &glyph)) else {
|
||||
// Return if we attempt to stretch along an axis which isn't stretchable,
|
||||
// so that the original fragment isn't modified.
|
||||
let Some(stretch_axis) = stretch_axis(ctx, &glyph) else {
|
||||
return;
|
||||
};
|
||||
let axis = axis.unwrap_or(stretch_axis);
|
||||
if axis != stretch_axis {
|
||||
return;
|
||||
}
|
||||
|
||||
let relative_to_size = relative_to.unwrap_or_else(|| fragment.size().get(axis));
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
tests/ref/math-stretch-vertical-attach.png
Normal file
BIN
tests/ref/math-stretch-vertical-attach.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 493 B |
@ -13,8 +13,8 @@ $ H stretch(=)^"define" U + p V \
|
||||
f : X stretch(arrow.hook, size: #150%)_"injective" Y \
|
||||
V stretch(->, size: #(100% + 1.5em))^("surjection") ZZ $
|
||||
|
||||
--- math-stretch-attach ---
|
||||
// Test stretch interactions with attachments.
|
||||
--- math-stretch-horizontal-attach ---
|
||||
// Test horizontal stretch interactions with attachments.
|
||||
#set page(width: auto)
|
||||
|
||||
$stretch(stretch(=, size: #4em))_A$
|
||||
@ -28,6 +28,13 @@ $ P = Q
|
||||
U stretch(equiv)^(forall i)_"Chern-Weil" V
|
||||
stretch(equiv, size: #(120% + 2mm))^(forall i)_"Chern-Weil" W $
|
||||
|
||||
--- math-stretch-vertical-attach ---
|
||||
// Test vertical stretch interactions with attachments.
|
||||
$arrow.t$
|
||||
$stretch(arrow.t)^"map"$
|
||||
$stretch(arrow.t, size: #2em)^"map"$
|
||||
$stretch(arrow.t, size: #200%)^"map"$
|
||||
|
||||
--- math-stretch-horizontal ---
|
||||
// Test stretching along horizontal axis.
|
||||
#let ext(sym) = math.stretch(sym, size: 2em)
|
||||
|
Loading…
x
Reference in New Issue
Block a user