mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Canvas: press-state reads that a pointer move leaves alone (FW-365 F4)
The vector tools' drain after every canvas run read `pointer::frame` only for the buttons held and the release, and the type transform box read it for the modifiers and the press. Both noted the pointer, so any pointer move ran the document area. They read `pointer::press_state` and `pointer::mods`, which only a press, a release or a modifier change moves. The pointer-over-panel trial stays held back: two craft-ui-canvas reads (the tool host, the middle-button autoscroll) still note the pointer on every canvas run.
This commit is contained in:
1 parent
da8339acf8
commit
dd80e7099a
5 files changed
+13
-10
No files matched your search
@@ -69,8 +69,10 @@ fn a_pointer_over_a_panel_replays_the_document_area() {
|
||||
for step in 1..=3 {
|
||||
h.event(Event::PointerMoved(beside + vec2(0.0, step as f32)));
|
||||
h.run_steps(1);
|
||||
// Held back: a pointer move over the docked panels still runs the document area (FW-365 F4 report, finding 3:
|
||||
// cause open). Turn these on with its fix.
|
||||
// Held back: a pointer move over the docked panels still runs the document area. Two reads in the canvas
|
||||
// note the pointer on every run: craft-ui-canvas's `ToolHost::run` (`pointer::frame`, for the tools' hover
|
||||
// position) and `Canvas::autoscroll` (`pointer::frame`, for a press or the pointer leaving during a middle-button
|
||||
// run). Turn these on once neither notes the pointer while it is away from the canvas.
|
||||
// assert_eq!(area(&h).0, 0, "hover step {step}: the document area replays");
|
||||
// assert_eq!(part_runs(&h), [], "hover step {step}: no canvas part runs");
|
||||
let _ = (area(&h), part_runs(&h));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! The Modifier Keys panel: latching Shift, ⌘ and ⌥ for touch and pen users. Code that needs the held modifiers reads
|
||||
//! `craft::ui::runtime::pointer::frame(ctx).mods`, which includes the latched keys.
|
||||
//! `craft::ui::runtime::pointer::mods(ctx)`, which includes the latched keys.
|
||||
|
||||
use craft::ui::contract::Bind;
|
||||
use craft::ui::patterns::panels::ModifierKeysPanel;
|
||||
|
||||
@@ -921,7 +921,7 @@ fn command_mods() -> Mods {
|
||||
|
||||
/// The modifiers held in the harness's last pass: the real keys plus the shell's latch (tp.T15).
|
||||
fn held(h: &Harness<'static, Box<PhotocraftApp>>) -> Mods {
|
||||
craft::ui::runtime::pointer::frame(&h.ctx).mods
|
||||
craft::ui::runtime::pointer::mods(&h.ctx)
|
||||
}
|
||||
|
||||
fn hold(h: &mut Harness<'static, Box<PhotocraftApp>>, mods: Modifiers) {
|
||||
|
||||
@@ -289,8 +289,9 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, canvas: egui::Rec
|
||||
return;
|
||||
}
|
||||
let ctx = ui.ctx().clone();
|
||||
let pointer = craft::ui::runtime::pointer::frame(&ctx);
|
||||
if whole_box(app, pointer.mods) != drawn {
|
||||
let mods = craft::ui::runtime::pointer::mods(&ctx);
|
||||
let press = craft::ui::runtime::pointer::press_state(&ctx).press;
|
||||
if whole_box(app, mods) != drawn {
|
||||
return;
|
||||
}
|
||||
let Some(frame) = frame(app) else { return };
|
||||
@@ -307,11 +308,11 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, canvas: egui::Rec
|
||||
let out = TransformOverlay::new(Label::from(&*tl!("Type transform")), session, &settings)
|
||||
.reach(reach)
|
||||
.rotate_zone(RotateZone::border(ROTATE_REACH_PT))
|
||||
.mods(Some(pointer.mods))
|
||||
.mods(Some(mods))
|
||||
.id_salt("type transform")
|
||||
.show_at(ui, canvas);
|
||||
// The press that went down on the box in this pass, or the box's first edit, starts the capture.
|
||||
let pressed = out.held.is_some() && pointer.press.is_some();
|
||||
let pressed = out.held.is_some() && press.is_some();
|
||||
if app.ui.type_transform.is_none() && !pressed && out.edits.is_empty() && out.apply.is_none() && !out.discard {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,9 +146,9 @@ pub(crate) fn drain(app: &mut PhotocraftApp, state: &mut VectorTools, _response:
|
||||
apply_pen(app, events);
|
||||
// A live shape layer takes the draft's anchors once a press is over (a release, or a key that changed the draft):
|
||||
// a drag's updates make no History steps of their own (#12909).
|
||||
let pointer = craft::ui::runtime::pointer::frame(app.ctx());
|
||||
let presses = craft::ui::runtime::pointer::press_state(app.ctx());
|
||||
let changed = app.ui.pen.as_ref().map(|p| &p.draft) != before.as_ref();
|
||||
if pointer.buttons.is_empty() && (changed || pointer.release.is_some()) {
|
||||
if presses.buttons.is_empty() && (changed || presses.release.is_some()) {
|
||||
pen::sync_live_layer_from_draft(app);
|
||||
pen::sync_live_path_from_draft(app);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user