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

Platform-specific render-pane pinch gesture capture. On macOS this installs a local magnify-event monitor and feeds synthetic zoom scroll events into the existing editor queue. More...

#include <vector>
#include "donner/editor/RenderPaneGesture.h"
Include dependency graph for PinchEventMonitor.h:

Namespaces

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

Functions

double donner::editor::PinchMagnificationToScrollDelta (double magnification, double wheelZoomStep)
 Convert an NSEvent magnification delta into the equivalent vertical scroll delta for the existing wheel-zoom model.
bool donner::editor::InstallPinchEventMonitor (GLFWwindow *window, std::vector< RenderPaneScrollEvent > *events, double wheelZoomStep)
 Install the native pinch monitor for the editor window.

Detailed Description

Platform-specific render-pane pinch gesture capture. On macOS this installs a local magnify-event monitor and feeds synthetic zoom scroll events into the existing editor queue.

Function Documentation

◆ InstallPinchEventMonitor()

bool donner::editor::InstallPinchEventMonitor ( GLFWwindow * window,
std::vector< RenderPaneScrollEvent > * events,
double wheelZoomStep )
nodiscard

Install the native pinch monitor for the editor window.

On macOS this registers an NSEventMaskMagnify local monitor that pushes synthetic zoom-marked scroll events into events. Other platforms provide a stub that returns false.

Parameters
windowGLFW window that owns the render pane.
eventsScroll-event queue drained by the render pane each frame.
wheelZoomStepMultiplicative zoom step per +1.0 scroll unit.
Returns
True if the native monitor was installed or was already active for this process.

◆ PinchMagnificationToScrollDelta()

double donner::editor::PinchMagnificationToScrollDelta ( double magnification,
double wheelZoomStep )
nodiscard

Convert an NSEvent magnification delta into the equivalent vertical scroll delta for the existing wheel-zoom model.

The classifier interprets zoom as pow(wheelZoomStep, scrollDeltaY). Pinch magnification instead reports the multiplicative zoom delta as 1 + magnification, so this helper computes the inverse mapping.

Parameters
magnificationCocoa magnification delta (e.g. 0.2 for 20% pinch-out).
wheelZoomStepMultiplicative zoom step per +1.0 scroll unit.
Returns
Synthetic scrollDelta.y that yields the same zoom factor, or 0.0 for degenerate inputs.