mirror of https://github.com/wayvr-org/wayvr.git
fix wrapped text flying around
This commit is contained in:
parent
a3e3101ab0
commit
a8262c1de4
|
|
@ -1,5 +1,4 @@
|
||||||
use std::{
|
use std::{
|
||||||
ffi::OsStr,
|
|
||||||
io::Read,
|
io::Read,
|
||||||
os::unix::net::UnixStream,
|
os::unix::net::UnixStream,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
ContentType, FontSystem, GlyphDetails, GpuCacheStatus, SwashCache, TextArea,
|
|
||||||
custom_glyph::{CustomGlyphCacheKey, RasterizeCustomGlyphRequest, RasterizedCustomGlyph},
|
custom_glyph::{CustomGlyphCacheKey, RasterizeCustomGlyphRequest, RasterizedCustomGlyph},
|
||||||
text_atlas::{GlyphVertex, TextAtlas, TextPipeline},
|
text_atlas::{GlyphVertex, TextAtlas, TextPipeline},
|
||||||
|
ContentType, FontSystem, GlyphDetails, GpuCacheStatus, SwashCache, TextArea,
|
||||||
};
|
};
|
||||||
use cosmic_text::{Color, SubpixelBin, SwashContent};
|
use cosmic_text::{Color, SubpixelBin, SwashContent};
|
||||||
use etagere::{AllocId, size2};
|
use etagere::{size2, AllocId};
|
||||||
use glam::{Mat4, Vec2, Vec3};
|
use glam::{Mat4, Vec2, Vec3};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
|
@ -159,6 +159,14 @@ impl TextRenderer {
|
||||||
start_y_physical <= text_area.bounds.bottom && text_area.bounds.top <= end_y_physical
|
start_y_physical <= text_area.bounds.bottom && text_area.bounds.top <= end_y_physical
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ensure layout is up to date before reading
|
||||||
|
// `set_size()` in draw() sets dirty flags but doesn't trigger shape_until_scroll
|
||||||
|
// without this, layout_runs() on &Buffer returns stale layouts
|
||||||
|
{
|
||||||
|
let mut buf = text_area.buffer.borrow_mut();
|
||||||
|
buf.shape_until_scroll(font_system, false);
|
||||||
|
}
|
||||||
|
|
||||||
let buffer = text_area.buffer.borrow();
|
let buffer = text_area.buffer.borrow();
|
||||||
|
|
||||||
let layout_runs = buffer
|
let layout_runs = buffer
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{cell::RefCell, rc::Rc};
|
use std::{cell::RefCell, rc::Rc};
|
||||||
|
|
||||||
use cosmic_text::{Attrs, AttrsList, BorrowedWithFontSystem, Buffer, Metrics, Shaping, Wrap};
|
use cosmic_text::{Attrs, AttrsList, BorrowedWithFontSystem, Buffer, Metrics, Scroll, Shaping, Wrap};
|
||||||
use slotmap::Key;
|
use slotmap::Key;
|
||||||
use taffy::AvailableSpace;
|
use taffy::AvailableSpace;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue