Skip to content

Modular mouse and touch handling #8

@vorg

Description

@vorg

Currently we depend on pex-sys/Window.addEventListener or manually calling gui.onMouseMove callbacks. It would be good to move to shared library between pex-sys,pex-gui and pex-cam.

Requirements:

  • works with mouse and touch (ideally using PointerEvents)
  • works in plask and borwser (can be via pex-gl.canvas)
  • has clear prioritisation (e.g. gui/GUI before cam/Arcball)
  • can cancel events or mark as handled (so Arcball doesn't move when i move the slider)
  • can filter events / record
  • allows implementing gestures
  • can map/filter/transform events (e.g. limit mouse movement to a viewport)

Ideal scenario:

  • create stream of events for a canvas
  • pass stream to a Logger
  • pass stream to GUI
  • pass stream to Arcball
  • on canvas.mousedown new event is added to the stream
  • Logger responds to a change, console.logs the event and leaves it in the stream
  • GUI responds to the change, if click is inside a slider the event is consumed, otherwise it's passed to the Arcball

Questions:

  • am i reinventing the wheel and try to compensate for lack of event bubbling that I would have for free when using HTML based GUI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions