Skip to content

Zooming

Tom Wagner requested to merge ryuukyu/helvum-dev:zooming into main

This adds a new zoom-factor property and supporting controls to the graphview which enables:

  • Zooming in on it by
    • holding Ctrl and scrolling while hovering over the graphview
    • using pinch gestures on touchpad/touchscreen
    • Via a widget in the header bar (popup needs to be positioned better, and properly unparented when parent is disposed)
  • Being scrolled via
    • Scrollbars, mouse wheels, touch drag (thanks to GtkScrolledWindow)
    • middle click pan

Zooming keeps the content at:

  • the middle of the gesture centered when using a zoom gesture,
  • the middle of the screen when using the widget
  • the middle of the screen when CTRL+Scroll, but this should use the cursor instead.

Another nice thing might be do scrolling when dragging a node to the corner of the visible graphview area.

Performance is also bad right now when zoomed in far, as the entire graphview is drawn at high resolution (including slow CPU rendering via cairo), instead of just the visual portion, which can result in up to 16x the normal rendering work when using 400% zoom. Performance is somewhat acceptable now with !33 (merged) and setting overflow to gtk::Overflow::Hidden, but should be even better with !34 (merged) merged and rebased onto, which should avoid rendering the entire graph surface.

Performance is pretty good now, as we only render the visible screen.

Replaces !28 (closed), Related to #30.

Edited by Tom Wagner

Merge request reports