fix unaligned debug in node graph

This commit is contained in:
Skyler Lehmkuhl 2026-02-11 19:30:11 -05:00
parent 93a2252a58
commit ad81cce0c6
3 changed files with 13 additions and 4 deletions

View File

@ -751,6 +751,9 @@ impl EditorApp {
fn new(cc: &eframe::CreationContext, layouts: Vec<LayoutDefinition>, theme: Theme) -> Self {
let current_layout = layouts[0].layout.clone();
// Disable egui's "Unaligned" debug overlay (on by default in debug builds)
cc.egui_ctx.style_mut(|style| style.debug.show_unaligned = false);
// Load application config
let config = AppConfig::load();

View File

@ -626,11 +626,15 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
// Allocate the rect and render the graph editor within it
ui.allocate_ui_at_rect(rect, |ui| {
// Check for scroll input to override library's default zoom behavior
// Only handle scroll when mouse is over the node graph area
let pointer_over_graph = ui.rect_contains_pointer(rect);
let modifiers = ui.input(|i| i.modifiers);
let has_ctrl = modifiers.ctrl || modifiers.command;
// When ctrl is held, check for raw scroll events in the events list
let scroll_delta = if has_ctrl {
let scroll_delta = if !pointer_over_graph {
egui::Vec2::ZERO
} else if has_ctrl {
// Sum up scroll events from the raw event list
ui.input(|i| {
let mut total_scroll = egui::Vec2::ZERO;

View File

@ -1759,8 +1759,10 @@ impl TimelinePane {
}
// Distinguish between mouse wheel (discrete) and trackpad (smooth)
// Only handle scroll when mouse is over the timeline area
let mut handled = false;
ui.input(|i| {
let pointer_over_timeline = response.hovered() || ui.rect_contains_pointer(header_rect);
if pointer_over_timeline { ui.input(|i| {
for event in &i.raw.events {
if let egui::Event::MouseWheel { unit, delta, modifiers, .. } = event {
match unit {
@ -1787,10 +1789,10 @@ impl TimelinePane {
}
}
}
});
}); }
// Handle scroll_delta for trackpad panning (when Ctrl not held)
if !handled {
if pointer_over_timeline && !handled {
let scroll_delta = ui.input(|i| i.smooth_scroll_delta);
if scroll_delta.x.abs() > 0.0 || scroll_delta.y.abs() > 0.0 {
// Horizontal scroll: pan timeline (inverted: positive delta scrolls left/earlier in time)