mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-28 11:47:21 -06:00
Smart Guides: Distance Guides follow what lies under a still pointer
One rule for the hover's context (PR review follow-ups): the target is recomputed where the pointer is, or cleared, whenever what lies under it can change while Alt is held. - The tool hovers only where the pointer is on the canvas itself (`on_canvas`): under a floating panel, a menu, a popup or a dialog its hover ends (Tool::hover_ended), as when the pointer leaves the canvas or a pan, zoom or view-rotation press starts. - The canvas keeps the hover's context: its rect, the view's centre, zoom and rotation, and the active document's id and revision (which moves with every edit, undo and selection change). When it changes under a still pointer, a tool that asks (Tool::wants_rehover; the Selection tool after an Alt hover) is hovered again at the pointer, so wheel, gesture, key or command scrolling and zooming, tab switches, edits and undos re-measure. - Coming back onto the canvas re-hovers the tool. canvas::tests::distance_guides_follow_what_lies_under_a_still_pointer: a floating window over the pointer (fails without the on_canvas filter), a 150 pt scroll that leaves empty artboard under it (fails without the re-hover), a square made under it. select::tests::distance_guides_need_ alt_a_selection_and_smart_guides checks wants_rehover.
This commit is contained in:
committed by
bflatastic
parent
26bf324c81
commit
7693aeb508
@@ -444,6 +444,12 @@ impl Session {
|
||||
self.with_tool_cx(view, |t, cx| t.hover_ended(cx));
|
||||
}
|
||||
|
||||
/// Whether the active tool's hover depends on what lies under a still pointer
|
||||
/// ([`vectorcraft_tools::Tool::wants_rehover`]).
|
||||
pub fn tool_wants_rehover(&self) -> bool {
|
||||
self.tool.wants_rehover()
|
||||
}
|
||||
|
||||
pub fn tool_busy(&self) -> bool {
|
||||
self.tool.busy()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user