preview method
List<(EntityKind, GeometryPayload)>
preview(
- DraftDocument d,
- Handle group,
- Grip grip,
- Vector2 world,
What drag would draw, in world: the pieces a reshape preview paints,
computed once per pointer move, never per frame. Empty when there is
nothing to show. world is only read during the call.
Implementation
@override
List<(EntityKind, GeometryPayload)> preview(
DraftDocument d, Handle group, Grip grip, Vector2 world) {
if (!identical(d, _draggingDocument) || !identical(grip, _draggingGrip)) {
_dragging = _Label.of(d, group);
_draggingDocument = d;
_draggingGrip = grip;
}
final s = _dragging;
if (s == null) return const [];
final next = s.labelAt(world, aperture());
if (next == null) return const [];
final (dx, dy) = next;
return [
(
EntityKind.line,
linePayload(
s.poleW, s.toWorld.transformPoint(s.poleL + Vector2(dx, dy))),
),
];
}