Skip to content

Support eventMode on display objects to opt out of pointer hit testing #56

Description

@RSamaium

Context

While integrating pointer-based projectile aiming in RPGJS, we hit a case where a decorative reticle rendered after an interactive map capture layer could intercept pointer events.

The workaround is to keep the transparent capture layer as the last child, so it stays above the decorative reticle for Pixi hit testing. That works, but it couples event behavior to template/render order.

Proposal

Expose Pixi's eventMode as a supported display object prop, for example:

<Container eventMode="none">
  <Circle radius={7} color="#2563eb" alpha={0.16} />
  <Circle radius={3} color="#2563eb" alpha={0.65} />
</Container>

Expected behavior:

  • eventMode="none" makes decorative elements opt out of pointer hit testing.
  • Existing event props such as pointerdown, pointermove, and click should continue to set eventMode = "static" when no explicit eventMode is provided.
  • If an explicit eventMode is provided, CanvasEngine should respect it instead of overriding it automatically.

Use case

For map-level interactions, a component may need:

<Rect pointermove={trackPointer} pointerdown={shootAtPointer} />
<Container eventMode="none">
  <!-- visual-only cursor/reticle/preview -->
</Container>

This lets the visual overlay render above gameplay elements without stealing pointer events from the interaction layer.

Notes

DisplayObject already manages pointer event props and sets eventMode = "static" when handlers exist. This issue is specifically about exposing explicit control for cases where an element is visual-only or where advanced users need Pixi's native event modes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions