TimelineEditing.h header
#include <ew/app/TimelineEditing.h>
Namespace ew::app
TimelineResize struct
struct ew::app::TimelineResize
The (start, duration) an event takes after one of its edges is dragged (TL-55). A pure value so the resize maths – which the bar's "resizable by its ends" promise rests on – is machine- checkable, never trapped in a mouse handler or a paintEvent.
Members
qint64 ew::app::TimelineResize::startMinute = 0
The event's new start, in minutes since the story epoch.
qint64 ew::app::TimelineResize::durationMinutes = 0
The event's new duration in minutes; never negative.
bool operator==(const TimelineResize &, const TimelineResize &)=default
Value equality over both fields, for testing and change detection.
Functions
std::vector< qint64 > ew::app::multiDragStarts(const std::vector< qint64 > &originalStarts, qint64 delta)
Each event's new start when a multi-selection is dragged as one (TL-59). Every selected event moves by the SAME delta – the delta the grabbed anchor event resolves to after snapping – so the group keeps its shape and the offsets between events are preserved exactly ("push the
whole siege two weeks later", not scatter it). originalStarts are the selected events' starts in any order; the result is parallel to it. A delta of 0 returns the starts unchanged. Distances add with saturation so an extreme start plus a delta pins at the qint64 limit rather than wrapping. Pure.
TimelineResize ew::app::resizeTimelineEvent(qint64 startMinute, qint64 durationMinutes, bool draggingStartEdge, qint64 newEdgeInstant)
Computes an event's (start, duration) after an edge-drag resize (TL-55). Dragging the START edge to newEdgeInstant holds the END fixed and moves the start; dragging the END edge holds the start and moves the end. The duration never goes negative: dragging an edge past the opposite one pins it there (a zero-duration instant) rather than flipping the event inside out, so a bar can be squeezed to nothing but never turned back-to-front. durationMinutes is assumed non-negative (the shape of any drawn bar). Pure.
qint64 ew::app::snapInstant(qint64 candidate, const std::vector< qint64 > &targets, qint64 toleranceInstants)
Snaps a dragged instant to the nearest snap target within toleranceInstants (TL-56) – another event's start or end, a calendar boundary, whatever the caller supplies in targets. Returns the nearest target when it lies within the tolerance band, else candidate unchanged, so a snap never pulls the value further than the caller's on-screen radius and "these begin
together" becomes true rather than approximately true. targets need not be sorted and may be empty; on a distance tie the smaller target wins so the result is deterministic. A non-positive toleranceInstants disables snapping (the held-modifier "defeat" path passes 0), returning candidate. Distances are computed without signed overflow, so an astronomically distant target is simply never near. Pure.