Skip to content

Commit 3688a7f

Browse files
committed
initial migration to new sugarloaf api
1 parent 040ce04 commit 3688a7f

12 files changed

Lines changed: 338 additions & 250 deletions

File tree

frontends/rioterm/src/application.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,13 +1160,21 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
11601160

11611161
match delta {
11621162
MouseScrollDelta::LineDelta(columns, lines) => {
1163-
let layout = route.window.screen.sugarloaf.rich_text_layout(&0);
1164-
let new_scroll_px_x = columns * layout.font_size;
1165-
let new_scroll_px_y = lines * layout.font_size;
1166-
route
1163+
let current_id =
1164+
route.window.screen.ctx().current().rich_text_id;
1165+
if let Some(layout) = route
11671166
.window
11681167
.screen
1169-
.scroll(new_scroll_px_x as f64, new_scroll_px_y as f64);
1168+
.sugarloaf
1169+
.get_text_layout(&current_id)
1170+
{
1171+
let new_scroll_px_x = columns * layout.font_size;
1172+
let new_scroll_px_y = lines * layout.font_size;
1173+
route.window.screen.scroll(
1174+
new_scroll_px_x as f64,
1175+
new_scroll_px_y as f64,
1176+
);
1177+
}
11701178
}
11711179
MouseScrollDelta::PixelDelta(mut lpos) => {
11721180
match phase {

0 commit comments

Comments
 (0)