pub enum EditRoute {
Idle,
Hovered {
id: RouteId,
},
Selected {
id: RouteId,
anchor: Pos2,
},
DraggingEdge {
id: RouteId,
direction: RouteDirection,
start_cursor: Pos2,
end_cursor: Pos2,
session: Option<RouteEditSession>,
},
DraggingWaypoint {
id: RouteId,
cursor: Pos2,
session: Option<RouteEditSession>,
},
}Variants§
Idle
Hovered
Selected
Fields
DraggingEdge
While dragging an edge, start_cursor/end_cursor accumulate the raw
(sub-grid) drag deltas. The working corner positions are snapped each
frame from these cursors, so small per-frame deltas don’t get rounded
to zero before they accumulate past a grid step.
Fields
direction: RouteDirectionsession: Option<RouteEditSession>The edit plan for the two boundary corners, built lazily on the
first Dragging frame — after the select→drag tool switch and its
re-route, which would otherwise invalidate a plan made earlier.
None until then. While it lives, the document is never written:
the drag previews into derived state and commits once on release.
DraggingWaypoint
Implementations§
Source§impl EditRoute
impl EditRoute
Sourcepub(crate) fn drag_from(
data: &Drawing<'_>,
id: RouteId,
pos: Pos2,
) -> Option<Self>
pub(crate) fn drag_from( data: &Drawing<'_>, id: RouteId, pos: Pos2, ) -> Option<Self>
Begin editing route id already mid-drag, as if it had been selected and
the drag started on it. Lets the select/resize tools hand off a drag that
lands on a route edge, skipping the separate click-to-select step. Returns
None if pos isn’t on a draggable part of the route.
Borrows the drawing immutably, which is the whole of the “lazy” in lazy edge drag: starting a drag cannot stage waypoints, because it has no way to write — a staged plan would be thrown away by the select→drag tool switch’s re-route, and this signature makes staging one unrepresentable.
Sourcefn preview_drag(
&mut self,
data: &mut Drawing<'_>,
event: Option<Event>,
phase: &PreviewPhase,
)
fn preview_drag( &mut self, data: &mut Drawing<'_>, event: Option<Event>, phase: &PreviewPhase, )
Advance a live drag by this frame’s event and relay the wire through
its working corners, into derived state only — no autoroute, so the
segment goes exactly where the user drags it. The plan is built on the
first frame that actually drags, after the select→drag tool switch has
re-routed (which would invalidate a plan staged earlier); an event-less
repaint re-relays the plan it already has.
fn render<C: Canvas>( &self, data: &Drawing<'_>, interaction: &Interaction, painter: &mut Style<'_, C>, )
Trait Implementations§
Source§impl ToolTrait for EditRoute
impl ToolTrait for EditRoute
fn name(&self) -> ToolName
Source§fn selection(&self) -> Option<Deletable>
fn selection(&self) -> Option<Deletable>
Source§fn overlay_anchor(&self) -> Option<Pos2>
fn overlay_anchor(&self) -> Option<Pos2>
Source§fn preview<C: Canvas>(
&mut self,
data: &mut Drawing<'_>,
interaction: &Interaction,
_painter: &mut Style<'_, C>,
phase: &PreviewPhase,
)
fn preview<C: Canvas>( &mut self, data: &mut Drawing<'_>, interaction: &Interaction, _painter: &mut Style<'_, C>, phase: &PreviewPhase, )
Self::widget paints, on every frame of a drag —
including one carrying no event at all, which is what a repaint
mid-drag looks like.fn widget<C: Canvas>( &mut self, data: &mut Drawing<'_>, interaction: &Interaction, painter: &mut Style<'_, C>, ) -> Option<Transition>
Auto Trait Implementations§
impl Freeze for EditRoute
impl RefUnwindSafe for EditRoute
impl Send for EditRoute
impl Sync for EditRoute
impl Unpin for EditRoute
impl UnsafeUnpin for EditRoute
impl UnwindSafe for EditRoute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more