Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: events (WIP) #831

Closed
wants to merge 1 commit into from
Closed

refactor: events (WIP) #831

wants to merge 1 commit into from

Conversation

andretchen0
Copy link
Contributor

  • (fix) BREAKING - remove event.intersects – use event.intersections
  • (fix) BREAKING - remove event.stopPropagating – use event.stopPropagation
  • (fix) BREAKING – from TresCanvas, don't emit pointer/click events bubbled from Tres objects
  • (fix) BREAKING – event.delta is now reset to 0 following a click.
  • (fix) BREAKING – pointerleave handlers were sent previous intersections at event.intersections, now current intersections.
  • (fix) BREAKING – @dblclick now fires whenever the canvas dblclick is emitted. Any TresObject with an @dblclick handler will receive the event if it is under the pointer. (Previously objects not under the initial click did not receive the @dblclick.)
  • (fix) event.pointer is now defined – previously typed but was undefined in implementation.
  • (fix) event.unprojectedPoint is now properly calculated. Was previously left as TODO.
  • (fix) event.eventObject holds the object that registered the event handler. Was previously typed but undefined in implementation.
  • (fix) use Vue-style ("flatcase") event names, e.g. @pointerdown. Keep support for old-style ("kebab-case") event names, e.g. @pointer-down, and warn. Mixing both on the same object is not supported and may lead to handlers being overwritten.
  • (fix) @pointer{leave,out} was fired multiple times on a single "leave" – Issue pointer-{leave,out} fired multiple times on single "leave" #801
  • (feat) BREAKING – pointermissed fires when the object that registered the handler is missed – previously only fired when ALL objects were missed
  • (feat) add filtering/sorting for intersections, prior to handling events. :events={filter: (intersections) => ...}
  • (feat) support Vue event modifiers – stop, prevent, self, once. (Tres cannot support passive and does not currently support capture.)
  • (feat) via :events-target prop, allow users to specify an HTML addEventListener target – allows Tres to respond to events, even if there's an overlay on the canvas.
  • (feat) via :events-enabled prop, allow eventManager to be enabled/disabled while Tres is running.
  • (feat) via :events prop, allow eventManager functions to be set/overwritten (non-reactive).
  • (feat) via :events prop, allow events system to be disabled completely: <TresCanvas :events="null" /> (non-reactive)
  • (feat) pointer{leave,out} is triggered (if necessary) just prior to object removal.
  • (feat) :blocking="true" makes a subtree "solid"; objects behind objects in the subtree will not be "hit".
  • (perf) meshes without events on self/ancestors are no longer hit-tested by default.
  • (refactor) context.eventManager now creates its own raycaster(s) or no raycaster – depending on needs. It does not use context.raycaster.
  • (refactor) BREAKING – remove the useRaycaster composable.
  • (refactor) BREAKING – remove the useEventManager composable.
  • (refactor) eventsManager is dependency-inverted. Users can set/modify its internal functions.

* (fix) BREAKING - remove `event.intersects` – use `event.intersections`
* (fix) BREAKING - remove `event.stopPropagating` – use `event.stopPropagation`
* (fix) BREAKING – from TresCanvas, don't emit pointer/click events bubbled from Tres objects
* (fix) BREAKING – `event.delta` is now reset to `0` following a `click`.
* (fix) BREAKING – `pointerleave` handlers were sent previous intersections at `event.intersections`, now current intersections.
* (fix) BREAKING – `@dblclick` now fires whenever the canvas `dblclick` is emitted. Any TresObject with an `@dblclick` handler will receive the event if it is under the pointer. (Previously objects not under the initial click did not receive the `@dblclick`.)
* (fix) `event.pointer` is now defined – previously typed but was `undefined` in implementation.
* (fix) `event.unprojectedPoint` is now properly calculated. Was previously left as `TODO`.
* (fix) `event.eventObject` holds the object that registered the event handler. Was previously typed but `undefined` in implementation.
* (fix) use Vue-style ("flatcase") event names, e.g. `@pointerdown`. Keep support for old-style ("kebab-case") event names, e.g. `@pointer-down`, and warn. Mixing both on the same object is not supported and may lead to handlers being overwritten.
* (fix) `@pointer{leave,out}` was fired multiple times on a single "leave" – Issue #801
* (feat) BREAKING – `pointermissed` fires when the object that registered the handler is missed – previously only fired when ALL objects were missed
* (feat) add filtering/sorting for intersections, prior to handling events. `:events={filter: (intersections) => ...}`
* (feat) support Vue event modifiers – `stop, prevent, self, once`. (Tres cannot support `passive` and does not currently support `capture`.)
* (feat) via `:events-target` prop, allow users to specify an HTML `addEventListener` target – allows Tres to respond to events, even if there's an overlay on the canvas.
* (feat) via `:events-enabled` prop, allow `eventManager` to be enabled/disabled while Tres is running.
* (feat) via `:events` prop, allow `eventManager` functions to be set/overwritten (non-reactive).
* (feat) via `:events` prop, allow events system to be disabled completely: `<TresCanvas :events="null" />` (non-reactive)
* (feat) `pointer{leave,out}` is triggered (if necessary) just prior to object removal.
* (feat) `:blocking="true"` makes a subtree "solid"; objects behind objects in the subtree will not be "hit".
Copy link

netlify bot commented Sep 12, 2024

Deploy Preview for tresjs-docs ready!

Name Link
🔨 Latest commit 46545d5
🔍 Latest deploy log https://app.netlify.com/sites/tresjs-docs/deploys/66e37769420e4100081130f3
😎 Deploy Preview https://deploy-preview-831--tresjs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@andretchen0 andretchen0 deleted the refactor/events branch September 28, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant