Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
RenderPaneGesture.h File Reference

Headless classification for render-pane scroll gestures. main.cc feeds raw GLFW scroll events into this helper so tests can cover pan vs. zoom routing without depending on ImGui or GLFW. More...

#include <optional>
#include "donner/base/Box.h"
#include "donner/base/Vector2.h"
#include "donner/editor/ViewportState.h"
Include dependency graph for RenderPaneGesture.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::RenderPaneScrollEvent
 Raw scroll event captured from the windowing layer. More...
struct  donner::editor::RenderPaneGestureContext
 Per-frame state needed to route a raw scroll event. More...
struct  donner::editor::RenderPaneGestureAction
 Output of ClassifyRenderPaneScrollGesture. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Enumerations

enum class  donner::editor::RenderPaneGestureActionType {
  Pan ,
  Zoom
}
 The viewport mutation a scroll gesture should apply.

Functions

std::optional< RenderPaneGestureActiondonner::editor::ClassifyRenderPaneScrollGesture (const RenderPaneScrollEvent &event, const RenderPaneGestureContext &context, double wheelZoomStep, double panPixelsPerScrollUnit)
 Route a raw scroll event to either pan or zoom.
void donner::editor::ApplyRenderPaneGesture (ViewportState &viewport, const RenderPaneGestureAction &action)
 Apply a classified gesture action to the viewport.

Detailed Description

Headless classification for render-pane scroll gestures. main.cc feeds raw GLFW scroll events into this helper so tests can cover pan vs. zoom routing without depending on ImGui or GLFW.

Function Documentation

◆ ApplyRenderPaneGesture()

void donner::editor::ApplyRenderPaneGesture ( ViewportState & viewport,
const RenderPaneGestureAction & action )

Apply a classified gesture action to the viewport.

Parameters
viewportViewport state to mutate.
actionGesture action previously returned by ClassifyRenderPaneScrollGesture.

◆ ClassifyRenderPaneScrollGesture()

std::optional< RenderPaneGestureAction > donner::editor::ClassifyRenderPaneScrollGesture ( const RenderPaneScrollEvent & event,
const RenderPaneGestureContext & context,
double wheelZoomStep,
double panPixelsPerScrollUnit )
nodiscard

Route a raw scroll event to either pan or zoom.

Bare scroll inside the pane pans. Cmd/Ctrl-modified vertical scroll zooms around the cursor using the existing wheel-zoom step model. Events outside the pane, zero-delta events, and wheel input while a mouse-drag pan is active are ignored.

Parameters
eventRaw scroll event from GLFW.
contextPer-frame pane bounds and mouse-pan state.
wheelZoomStepMultiplicative zoom step per +1.0 wheel unit.
panPixelsPerScrollUnitScreen pixels to pan per +1.0 scroll unit.
Returns
The viewport mutation to apply, if any.