Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
SelectionTransformHandles.h File Reference
#include <array>
#include <span>
#include "donner/base/Box.h"
#include "donner/base/Transform.h"
#include "donner/base/Vector2.h"
Include dependency graph for SelectionTransformHandles.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::SelectionTransformHandleIntent
 Hit-test result for selection transform handles. More...
struct  donner::editor::SelectionTransformHandleBoxes
 Visual handle boxes for one selection envelope, in document coordinates. 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::SelectionTransformCorner {
  TopLeft ,
  TopRight ,
  BottomRight ,
  BottomLeft
}
 Corner handle identity for selection resize/rotate gestures.
enum class  donner::editor::SelectionTransformHandleKind {
  None ,
  Resize ,
  Rotate
}
 Interaction kind under the pointer near selection transform handles.

Functions

Box2d donner::editor::CombinedSelectionBounds (std::span< const Box2d > selectionBoundsDoc)
 Return a combined AABB for a selection-bounds span.
Vector2d donner::editor::SelectionTransformCornerPoint (const Box2d &bounds, SelectionTransformCorner corner)
 Return the point for a corner of bounds.
SelectionTransformCorner donner::editor::OppositeSelectionTransformCorner (SelectionTransformCorner corner)
 Return the opposite corner from corner.
SelectionTransformHandleBoxes donner::editor::SelectionTransformHandleBoxesForBounds (const Box2d &boundsDoc, double pixelsPerDocUnit)
 Build document-space handle boxes with screen-stable size under pixelsPerDocUnit.
SelectionTransformHandleIntent donner::editor::HitTestSelectionTransformHandles (std::span< const Box2d > selectionBoundsDoc, const Vector2d &documentPoint, double pixelsPerDocUnit, bool includeRotate=true)
 Hit-test resize and rotate corner zones using document-space bounds and scale.
double donner::editor::PixelsPerDocUnitFromTransform (const Transform2d &canvasFromDoc)
 Return pixels per document unit from a document-to-canvas transform.
Transform2d donner::editor::TransformDocumentAroundPoint (const Vector2d &fixedDocumentPoint, const Transform2d &centeredDocumentFromDocument)
 Compose centeredDocumentFromDocument so it acts around fixedDocumentPoint instead of the document origin: translate the fixed point to the origin, apply the transform, translate back. Shared by the select tool's resize/rotate gestures and the text tool's frame rotate.
double donner::editor::AngleFromCenter (const Vector2d &center, const Vector2d &point)
 Angle of point around center in radians, measured from +x.

Function Documentation

◆ HitTestSelectionTransformHandles()

SelectionTransformHandleIntent donner::editor::HitTestSelectionTransformHandles ( std::span< const Box2d > selectionBoundsDoc,
const Vector2d & documentPoint,
double pixelsPerDocUnit,
bool includeRotate = true )
nodiscard

Hit-test resize and rotate corner zones using document-space bounds and scale.

Resize wins over rotate when zones overlap. Rotate is intentionally outside the square handle, in a small ring around each corner.

Parameters
selectionBoundsDocSelection bounds in document coordinates.
documentPointPoint to hit test in document coordinates.
pixelsPerDocUnitCurrent viewport scale.
includeRotateWhether rotate ring zones should be considered.