UI: an agent's injected drag never warps the real cursor (#592 follow-up)
Control-channel pointer events (ui.drag) scrub numbers like a mouse but turn off the edge wrap, so an agent never moves the user's cursor; the TextBox case of the drag test goes (that plug-in isn't in-tree). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
This commit is contained in:
@@ -1627,7 +1627,8 @@ impl eframe::App for EffectcraftApp {
|
||||
}
|
||||
|
||||
fn raw_input_hook(&mut self, ctx: &egui::Context, raw_input: &mut egui::RawInput) {
|
||||
if !self.synthetic.is_empty() {
|
||||
let injected = !self.synthetic.is_empty();
|
||||
if injected {
|
||||
// Pointer events go one per frame so egui sees press → moves → release as a real drag.
|
||||
let pointer = |e: &egui::Event| matches!(e, egui::Event::PointerMoved(_) | egui::Event::PointerButton { .. } | egui::Event::MouseWheel { .. });
|
||||
let n = if pointer(&self.synthetic[0]) {
|
||||
@@ -1640,7 +1641,7 @@ impl eframe::App for EffectcraftApp {
|
||||
};
|
||||
raw_input.events.extend(self.synthetic.drain(..n));
|
||||
}
|
||||
if pointer_wrap::prepare_input(ctx, raw_input) {
|
||||
if pointer_wrap::prepare_input(ctx, raw_input, injected) {
|
||||
self.session.history.merge_key = None;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user