21#include <JuceHeader.h>
111 void setZoom(
float factor, juce::Point<float> normalizedPanOffset = {});
156 void mouseWheelMove(
const juce::MouseEvent&,
const juce::MouseWheelDetails&)
override;
158 void mouseMagnify(
const juce::MouseEvent&,
float scaleFactor)
override;
197 juce::Rectangle<float> computeBaseContentBounds()
const;
199 juce::Rectangle<float> getContentBounds()
const;
206 void applyZoomAtScreenPoint(
float newFactor, juce::Point<float> screenFocus);
208 juce::Rectangle<float> m_boundsRealRef;
211 float m_zoomFactor = 1.0f;
212 juce::Point<float> m_zoomPanOffset;
215 juce::Point<float> m_pinchPos[2] = {};
216 bool m_pinchDown[2] = {
false,
false };
217 float m_pinchStartDistance = 0.0f;
218 float m_pinchStartZoom = 1.0f;
219 bool m_pinchActive =
false;
Abstract base class for all three overlaid visualisation layers in UmsciControlComponent.
void mouseMagnify(const juce::MouseEvent &, float scaleFactor) override
Trackpad pinch-to-zoom (macOS).
float getZoomFactor() const
ControlsSize
Visual size of source/speaker icons. Multiplier accessible via getControlsSizeMultiplier().
void setZoom(float factor, juce::Point< float > normalizedPanOffset={})
Silently applies zoom without firing onViewportZoomChanged. Used by UmsciControlComponent to synchron...
virtual void onZoomChanged()
Called after any zoom state change.
void mouseDoubleClick(const juce::MouseEvent &) override
Double-click resets zoom to 1.0 via resetZoom().
bool processPinchGesture(const juce::MouseEvent &e, bool isDown, bool isUp)
JUCE-level two-touch pinch-zoom fallback for platforms where neither mouseMagnify nor a native gestur...
virtual ~UmsciPaintNControlComponentBase() override
std::array< float, 3 > GetRealCoordinateForPoint(const juce::Point< float > &screenPoint)
Inverse of GetPointForRealCoordinate — converts a screen pixel point back to a 3D real-world coordina...
void mouseWheelMove(const juce::MouseEvent &, const juce::MouseWheelDetails &) override
Mouse-wheel zooms about the cursor position.
std::function< void(float, juce::Point< float >)> onViewportZoomChanged
Fired after every user-initiated zoom/pan change (wheel, pinch, double-click). Parameters: (newFactor...
ControlsSize getControlsSize() const
void simulatePinchZoom(float scaleFactor, juce::Point< float > centre)
Applies an incremental pinch-zoom step, as if the user performed a native pinch gesture centred at ce...
juce::Point< float > GetPointForRealCoordinate(const std::array< float, 3 > &realCoordinate)
Converts a 3D real-world coordinate to a 2D screen pixel point.
virtual void setControlsSize(ControlsSize size)
Updates the icon size; derived classes may override to re-prerender.
void resetZoom()
Resets zoom to 1.0 / no pan and fires onViewportZoomChanged.
void setBoundsRealRef(const juce::Rectangle< float > &boundsRealRef)
Sets the real-world rectangle that the component's pixel bounds map to.
float getControlsSizeMultiplier() const
Returns a multiplier (e.g. 0.5 / 1.0 / 1.5) for S/M/L icon sizes.
UmsciPaintNControlComponentBase()