Clip text to viewport bounds instead of layout bounds
This commit is contained in:
parent
99899d49cc
commit
936d480267
23 changed files with 177 additions and 115 deletions
|
|
@ -120,9 +120,13 @@ impl Pipeline {
|
|||
horizontal_alignment,
|
||||
vertical_alignment,
|
||||
color,
|
||||
viewport,
|
||||
) = match section {
|
||||
Text::Paragraph {
|
||||
position, color, ..
|
||||
position,
|
||||
color,
|
||||
viewport,
|
||||
..
|
||||
} => {
|
||||
use crate::core::text::Paragraph as _;
|
||||
|
||||
|
|
@ -137,10 +141,14 @@ impl Pipeline {
|
|||
paragraph.horizontal_alignment(),
|
||||
paragraph.vertical_alignment(),
|
||||
*color,
|
||||
*viewport,
|
||||
)
|
||||
}
|
||||
Text::Editor {
|
||||
position, color, ..
|
||||
position,
|
||||
color,
|
||||
viewport,
|
||||
..
|
||||
} => {
|
||||
use crate::core::text::Editor as _;
|
||||
|
||||
|
|
@ -155,6 +163,7 @@ impl Pipeline {
|
|||
alignment::Horizontal::Left,
|
||||
alignment::Vertical::Top,
|
||||
*color,
|
||||
*viewport,
|
||||
)
|
||||
}
|
||||
Text::Cached(text) => {
|
||||
|
|
@ -173,6 +182,7 @@ impl Pipeline {
|
|||
text.horizontal_alignment,
|
||||
text.vertical_alignment,
|
||||
text.color,
|
||||
text.viewport,
|
||||
)
|
||||
}
|
||||
};
|
||||
|
|
@ -195,13 +205,8 @@ impl Pipeline {
|
|||
alignment::Vertical::Bottom => bounds.y - bounds.height,
|
||||
};
|
||||
|
||||
let section_bounds = Rectangle {
|
||||
x: left,
|
||||
y: top,
|
||||
..bounds
|
||||
};
|
||||
|
||||
let clip_bounds = layer_bounds.intersection(§ion_bounds)?;
|
||||
let clip_bounds =
|
||||
layer_bounds.intersection(&(viewport * scale_factor))?;
|
||||
|
||||
Some(glyphon::TextArea {
|
||||
buffer,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue