mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 18:54:31 +01:00
Stylus: docs name the web build as a source of the airbrush wheel
The stylus module doc and StylusFeed::set_move now say the web build reads the wheel from Pointer Events' tangentialPressure and keeps a pose for each move. The frame_moves doc comment is rewrapped.
This commit is contained in:
1 parent
71e2f35b3b
commit
32fa158676
2 files changed
+13
-11
No files matched your search
@@ -193,13 +193,14 @@ pub(super) type FrameMove = (Pos2, Option<f32>, Option<PenPose>);
|
||||
/// The positions this frame's pointer moves passed through before its last one, each with the
|
||||
/// pen force a touch event gave just before it, or the pressure the host's feed kept for that move
|
||||
/// ([`StylusFeed::take_moves`], macOS), if any, and the tilt and rotation the feed kept for that
|
||||
/// move (empty when the pen read neither), if any, with touch events too (the web build's pen). The last move is the pointer's position; the
|
||||
/// tilt and rotation the feed kept for it come second, if any. A mouse's moves count too, with no
|
||||
/// pressure: a fast mouse stroke otherwise keeps one position a frame, a sample every few pixels,
|
||||
/// too few for a low Fidelity to follow the hand (#3328). With `release`, the moves stop at that
|
||||
/// button's button-up in this frame, if it came: the moves after it are hover, and the button-up's
|
||||
/// position is the pointer's. The last move before it is left out only when it is at that
|
||||
/// position; its tilt and rotation come second either way.
|
||||
/// move (empty when the pen read neither), if any, with touch events too (the web build's pen).
|
||||
/// The last move is the pointer's position; the tilt and rotation the feed kept for it come
|
||||
/// second, if any. A mouse's moves count too, with no pressure: a fast mouse stroke otherwise keeps
|
||||
/// one position a frame, a sample every few pixels, too few for a low Fidelity to follow the hand
|
||||
/// (#3328). With `release`, the moves stop at that button's button-up in this frame, if it came:
|
||||
/// the moves after it are hover, and the button-up's position is the pointer's. The last move
|
||||
/// before it is left out only when it is at that position; its tilt and rotation come second
|
||||
/// either way.
|
||||
pub(super) fn frame_moves(ui: &Ui, stylus: Option<&StylusFeed>, release: Option<egui::PointerButton>) -> (Vec<FrameMove>, Option<PenPose>) {
|
||||
let samples = stylus.map(StylusFeed::take_moves).unwrap_or_default();
|
||||
ui.input(|i| {
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
//! each pointer message of a pen before winit handles it. The canvas uses the pressure when a
|
||||
//! frame's events carry no touch force, and the tilt and rotation for each press, drag and release.
|
||||
//! An airbrush pen's finger wheel comes with the tilt and rotation ([`PenPose::wheel`]) where the
|
||||
//! host reads it: from XInput2 on X11 and from AppKit on macOS. The app does not read it on
|
||||
//! Windows, whose pointer messages have no field for it, or in the web build.
|
||||
//! host reads it: from XInput2 on X11, from AppKit on macOS and from Pointer Events'
|
||||
//! `tangentialPressure` in the web build. The app does not read it on Windows, whose pointer
|
||||
//! messages have no field for it.
|
||||
//!
|
||||
//! The feed also says which end of the pen moved. Turning the pen to its eraser end selects the
|
||||
//! Eraser tool, and turning it back to the tip selects the tool used before
|
||||
@@ -157,8 +158,8 @@ impl StylusFeed {
|
||||
}
|
||||
|
||||
/// Like [`Self::set_sample`], for a pen sample that comes with one pointer move of the window,
|
||||
/// read before the window handles the move (macOS): its pressure, tilt and rotation are also
|
||||
/// kept for that move ([`Self::take_moves`]).
|
||||
/// read before the window handles the move (macOS and the web build): its pressure, tilt,
|
||||
/// rotation and wheel are also kept for that move ([`Self::take_moves`]).
|
||||
pub fn set_move(&self, sample: PenSample) {
|
||||
self.set_sample(Some(sample));
|
||||
let mut pen = self.lock();
|
||||
|
||||
Reference in new issue
Block a user