mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-18 08:07:26 +00:00
Present mode: comment mode drops only the prototype's presses; hover and the wheel still work (#2209)
The pointer stayed off the prototype entirely in comment mode, which also stopped wheel scrolling and hover triggers. Only a press is now kept from it (a click there places a comment). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Model-Effort: Opus 5.5 drove and wrote (review fix)
This commit is contained in:
1 parent
e7dfc815d1
commit
fba314a340
2 files changed
+12
-2
No files matched your search
@@ -162,13 +162,16 @@ fn fire_pads(p: &mut Presenter, doc: &Document, root: NodeId, pads: &[String], n
|
||||
/// player takes the keyboard; `pane`: it plays in the preview pane (which always fits).
|
||||
pub(super) struct InputMode {
|
||||
pub over_area: bool,
|
||||
/// Presses reach the prototype: false in the presenter's comment mode, where a click places a
|
||||
/// comment (hover and the wheel still work).
|
||||
pub clicks: bool,
|
||||
pub keys_on: bool,
|
||||
pub pane: bool,
|
||||
pub now: f64,
|
||||
}
|
||||
|
||||
pub(super) fn input(p: &mut Presenter, ctx: &egui::Context, l: &Layout, mode: InputMode) {
|
||||
let InputMode { over_area, keys_on, pane, now } = mode;
|
||||
let InputMode { over_area, clicks, keys_on, pane, now } = mode;
|
||||
let (pos, pressed, released, down, wheel, velocity, dt, keys) = ctx.input(|i| {
|
||||
let keys: Vec<(egui::Key, egui::Modifiers)> = i
|
||||
.events
|
||||
@@ -190,6 +193,7 @@ pub(super) fn input(p: &mut Presenter, ctx: &egui::Context, l: &Layout, mode: In
|
||||
)
|
||||
});
|
||||
let keys = if keys_on { keys } else { Vec::new() };
|
||||
let pressed = pressed && clicks;
|
||||
// Controller buttons pressed while a link notice shows are dropped, as keys are.
|
||||
let pads = std::mem::take(&mut p.pads);
|
||||
let pads = if p.link_notice.is_none() { pads } else { Vec::new() };
|
||||
|
||||
@@ -64,7 +64,13 @@ pub(super) fn player(p: &mut Presenter, ui: &mut Ui, rect: Rect, now: f64, chrom
|
||||
p,
|
||||
&ctx,
|
||||
&l,
|
||||
InputMode { over_area: over && p.link_notice.is_none() && !(p.view.comments && !chrome.pane), keys_on: keys, pane: chrome.pane, now },
|
||||
InputMode {
|
||||
over_area: over && p.link_notice.is_none(),
|
||||
clicks: !(p.view.comments && !chrome.pane),
|
||||
keys_on: keys,
|
||||
pane: chrome.pane,
|
||||
now,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
p.pads.clear();
|
||||
|
||||
Reference in new issue
Block a user