Skip to content

[Bug] Harden FlyCamera input ownership, focus, and cursor capture #782

Description

@JeanPhilippeKernel

Type

  • Bug
  • Feature
  • Refactor / cleanup
  • Task / chore

Overview

The controller self-gates on pointer position in the viewport, but production editor navigation must also respect UI keyboard ownership, modals, text fields, drag operations, focus loss, and cursor-capture transitions. Current state handling can retain transient input across transitions and orbit does not exit when Alt alone is released.

Context

InputManager is polled directly by FlyCameraController. Editor event routing cannot by itself prevent the controller from reading those actions. ZUI is the authoritative source for UI capture and modal state.

Related: #245 and ZEngine/docs/future-plan/fly-camera-redesign.md.

What needs to be done

  1. Define the camera input-ownership contract with ZUI for pointer, keyboard, modal, and text-field capture.
  2. Suppress camera actions whenever ZUI owns the relevant input.
  3. Reset mouse deltas and transient button/action state when cursor capture changes.
  4. Release cursor capture and force idle state on focus loss, modal activation, and shutdown.
  5. Clear stale movement, focus, and bookmark edges at every state transition.
  6. Exit orbit when its activation modifier is released.
  7. Cover transitions with deterministic tests.

Resources

  • ZEngine/ZEngine/Controllers/FlyCameraController.cpp
  • ZEngine/ZEngine/Input/InputManager.cpp
  • Tetragrama/Editor.cpp
  • ZEngine/ZEngine/UI/ZUIContext.h
  • ZEngine/docs/future-plan/fly-camera-redesign.md

Testing

  • Simulate Idle, Hover, and Fly transitions.
  • Verify cursor capture is restored after RMB release and focus loss.
  • Verify text input, modal UI, and drag operations suppress navigation.
  • Verify releasing Alt exits orbit even if LMB remains down.

Acceptance criteria

  • UI-owned input never drives the camera.
  • Focus loss, modal activation, and shutdown cannot leave the cursor captured.
  • No movement, focus, or bookmark action remains latched after a transition.
  • Orbit exits immediately when Alt is released.
  • Tests cover the state and capture transitions.
  • Builds without warnings in Debug and Release.
  • All relevant unit tests pass.
  • No regression in existing functionality.

Estimated effort

2–3 days

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Critical path — blocks other workarea-controllersarea-uiarea-windowWork on Window systembugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions