ActiveDrag

sealed interface ActiveDrag

What an in-progress drag inside Edit is doing. Modeled as two distinct cases (rather than a flatter handful of nullable fields) so "dragging an existing vertex" and "dragging a not-yet-real new vertex into existence" can't be represented at the same time or confused with each other.

Inheritors

Types

Link copied to clipboard
data class ExistingVertex(val vertexId: VertexId, val origin: GeoPosition, val span: VertexSpan? = null) : DrawMode.Edit.ActiveDrag

vertexId (an existing vertex) is being repositioned. origin is fixed at the position the drag started from — the "old" position for the single com.tcsappdev.worldwinddraw.core.history.commands.MoveVertexCommand that gets recorded once the gesture finishes (see DrawEngineReducer).

Link copied to clipboard

The marker being edited is being moved. origin is where it was when the drag began: the "old" position of the single com.tcsappdev.worldwinddraw.core.history.commands.MoveMarkerCommand recorded when the gesture finishes. Unlike a new vertex, the marker really exists, so it follows the drag live (through preview commands) like an existing vertex does.

Link copied to clipboard
data class NewVertex(val edgeIndex: Int, val position: GeoPosition, val ringIndex: Int = 0) : DrawMode.Edit.ActiveDrag

A midpoint handle on edge edgeIndex (of ring ringIndex, 0 for a shape with only one) is being dragged into a new vertex. Deliberately does NOT touch com.tcsappdev.worldwinddraw.core.repository.EntityRepository while dragging — position only drives a live rendering preview (see DrawLayer). Only one com.tcsappdev.worldwinddraw.core.history.commands.AddVertexCommand, built with the final position, is ever recorded — inserting provisionally at drag-start and moving it on every step would need a second, different command for undo (remove) than for redo (re-insert at the right position), which is exactly the kind of state a pure reducer can't safely fake.