fix unaligned debug in node graph
This commit is contained in:
parent
93a2252a58
commit
ad81cce0c6
|
|
@ -751,6 +751,9 @@ impl EditorApp {
|
||||||
fn new(cc: &eframe::CreationContext, layouts: Vec<LayoutDefinition>, theme: Theme) -> Self {
|
fn new(cc: &eframe::CreationContext, layouts: Vec<LayoutDefinition>, theme: Theme) -> Self {
|
||||||
let current_layout = layouts[0].layout.clone();
|
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
|
// Load application config
|
||||||
let config = AppConfig::load();
|
let config = AppConfig::load();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -626,11 +626,15 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
|
||||||
// Allocate the rect and render the graph editor within it
|
// Allocate the rect and render the graph editor within it
|
||||||
ui.allocate_ui_at_rect(rect, |ui| {
|
ui.allocate_ui_at_rect(rect, |ui| {
|
||||||
// Check for scroll input to override library's default zoom behavior
|
// 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 modifiers = ui.input(|i| i.modifiers);
|
||||||
let has_ctrl = modifiers.ctrl || modifiers.command;
|
let has_ctrl = modifiers.ctrl || modifiers.command;
|
||||||
|
|
||||||
// When ctrl is held, check for raw scroll events in the events list
|
// 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
|
// Sum up scroll events from the raw event list
|
||||||
ui.input(|i| {
|
ui.input(|i| {
|
||||||
let mut total_scroll = egui::Vec2::ZERO;
|
let mut total_scroll = egui::Vec2::ZERO;
|
||||||
|
|
|
||||||
|
|
@ -1759,8 +1759,10 @@ impl TimelinePane {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Distinguish between mouse wheel (discrete) and trackpad (smooth)
|
// Distinguish between mouse wheel (discrete) and trackpad (smooth)
|
||||||
|
// Only handle scroll when mouse is over the timeline area
|
||||||
let mut handled = false;
|
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 {
|
for event in &i.raw.events {
|
||||||
if let egui::Event::MouseWheel { unit, delta, modifiers, .. } = event {
|
if let egui::Event::MouseWheel { unit, delta, modifiers, .. } = event {
|
||||||
match unit {
|
match unit {
|
||||||
|
|
@ -1787,10 +1789,10 @@ impl TimelinePane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}); }
|
||||||
|
|
||||||
// Handle scroll_delta for trackpad panning (when Ctrl not held)
|
// 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);
|
let scroll_delta = ui.input(|i| i.smooth_scroll_delta);
|
||||||
if scroll_delta.x.abs() > 0.0 || scroll_delta.y.abs() > 0.0 {
|
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)
|
// Horizontal scroll: pan timeline (inverted: positive delta scrolls left/earlier in time)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue