Viewer - Drawing Tools
    Preparing search index...

    Interface IEdgeControl

    A control point that is attached to an edge between two points. The control point is defined by the indices of the two points and a direction vector.

    The control sits at the midpoint of the edge and can only be dragged along the given direction. When dragged, both point1 and point2 are shifted by the same delta (symmetric displacement).

    interface IEdgeControl {
        direction: vec3;
        point1: number;
        point2: number;
        position: vec3;
        type: "edge";
        cancel(moveTemporary: MoveTemporaryFn): void;
        end(getPosition: GetPositionFn): void;
        move(
            ray: IRay,
            moveTemporary: MoveTemporaryFn,
            restrictedPosition?: vec3,
            applyConstraints?: ApplyConstraintsFn,
        ): vec3 | undefined;
        refreshAll(getPosition: GetPositionFn): void;
        refreshForMovedPoint(
            movedIndex: number,
            getPosition: GetPositionFn,
        ): boolean;
        start(getPosition: GetPositionFn): boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    direction: vec3

    Drag direction in the DT's local space. The direction does not need to be perpendicular to the edge; any direction is permitted. The actual displacement for a given mouse move is determined by the closest-point projection of the mouse ray onto the axis dragStartMidpoint + t * direction.

    The direction is updated whenever the edge orientation changes relative to its initial orientation, so that the control's movement remains consistent with the user's drag direction even after rotations.

    point1: number

    The index of the first point that defines the edge to which this control is attached.

    point2: number

    The index of the second point that defines the edge to which this control is attached.

    position: vec3
    type: "edge"

    Methods

    • Cancel the drag, restoring all affected geometry points to their pre-drag positions.

      Parameters

      • moveTemporary: MoveTemporaryFn

      Returns void

    • Commit the drag and refresh any derived state from the committed geometry.

      Parameters

      • getPosition: GetPositionFn

      Returns void

    • Move the control during drag. Returns the updated visual position of the control, or undefined if no movement was possible (e.g. degenerate geometry).

      Parameters

      • ray: IRay
      • moveTemporary: MoveTemporaryFn
      • OptionalrestrictedPosition: vec3

        Optional pre-computed restriction-constrained position. When provided the control should derive its movement from this world-space point rather than from a raw line-line closest-point computation on the ray.

      • OptionalapplyConstraints: ApplyConstraintsFn

        Optional constraint evaluator. When provided, edge controls use it to find the tightest valid scalar t before moving both endpoints, guaranteeing they always translate rigidly together.

      Returns vec3 | undefined

    • Refreshes all derived state from the current geometry (e.g. after undo/redo).

      Parameters

      • getPosition: GetPositionFn

      Returns void

    • Called when a single point in the geometry has moved (not during a drag). Returns true if this control was affected and its visual position changed.

      Parameters

      • movedIndex: number
      • getPosition: GetPositionFn

      Returns boolean

    • Begin a drag interaction. Snapshots any required initial state. Returns false if the control cannot be dragged at this time.

      Parameters

      • getPosition: GetPositionFn

      Returns boolean