Skip to content

Conversation

trusktr
Copy link
Member

@trusktr trusktr commented Jul 29, 2024

Model elements (for example <lume-gltf-model> now extend from a base Model class that defines the event types for them. We've added a LoadEvent with that is dispatched with the name "load", just like "load" events for built-in elements like <img>, <iframe>, etc.

The benefit of this is that we are closer to DOM standards with this change, and users of web frameworks can hook into events for 3D elements in the same way they do with built-in elements in their favorite web framework's template syntax. For example, a React user can hook into the load event for a 3D elements just the same as they would for an <img> element:

function MyReactComponent() {
  return <>
    <img onload={() => console.log('img loaded')} />
    <lume-gltf-model onload={() => console.log('lume-gltf-model loaded')} />
  </>
}

trusktr added 3 commits July 28, 2024 22:45
…xtend from a base Model class that defines the event types for them
* develop:
  undo the temporary change to local examples importmap
…possible model types, let each model class specify its model type
@trusktr trusktr marked this pull request as ready for review August 18, 2024 22:39
…vent for `sizechange`, fully deprecate the `Events` object and usage of `.on`.

Deprecations:

Using `.on()` for events is fully deprecated, and the method will be removed in a version after 0.3.0. Use `.addEventListener()` instead (or your favorite web framework's template event syntax).

- `el.on('sizechange', ({x, y, z}) => {})` becomes `el.addEventListener('sizechange', ({target: {calculatedSize: {x, y, z}}}) => {})` (or just read from the element inside the event handler instead of reading from `event.target`).
- `el.on('MODEL_LOAD', ({model}) => {})` becomes `el.addEventListener('load', ({target: {threeModel: model}}) => {})`
- `el.on('MODEL_ERROR', error => {})` becomes `el.addEventListener('error', ({error}) => {})`
- `el.on('PROGRESS', event => {})` becomes `el.addEventListener('progress', event => {})` (`event` is the same)

The `el.emit()` method is also deprecated to be removed in a version
after 0.3.0, use `el.dispatchEvent()` instead. Along with `.on()` and
`.emit()`, the events mentioned will be removed in a future release
after 0.3.0.
… examples to React 19 and ensure that event prop types work as expected
trusktr added 14 commits August 28, 2024 20:03
`Settable`, update threejs minimum version requirement and fix some type
errors, delete the `Scene.physicallyCorrectLights` property

BREAKING: `Scene.physicallyCorrectLights` has been removed, light mode
is always physically correct now, as it has been deprecated in Three.js
and is being removed. If you had this value as false (that was the
default) the lighting of your scene may appear darker now and will need
adjustment. Lighting uses physically-correct units (candela, based on
world units in meters) which mainly means that you'll typically need
higher values for light `intensity` values, for example, depending on
the size of your scene, try 100 or 1000 instead of 1. This is a nice
step ahead for more better and more realistic lighting by default.
…Fling`, the logic will be usable for other purposes next
refactor: use upwardRoots in some more spots to improve selector refs so they all search in upwards roots

refactor: make model elements and behaviors have common base classes to make them easier to reference with a common type

feat: show a skeleton helper on a model element when it has its `debug` attribute set to true
* cleanups:
  chore: better organization for three utils
  refactor: split out the drag handling from `FlingRotation` into `DragFling`, the logic will be usable for other purposes next
  refactor: simplify `*Fling` classes by making them extend from `Settable`, update threejs minimum version requirement and fix some type errors, delete the `Scene.physicallyCorrectLights` property
…ts that use the same texture share the texture by default
…igger a texture update every time the DOM changes but the projectors didn't
…ents, prevent `LoadingIcon` from touching DOM APIs in SSR environments
…he next microtask instead of the next animation frame, add a .passive property to ScrollFling that when set to true will use passive wheel events
* develop:
  update examples importmap dependency versions for githack
  update camera-rig example
  update docs, update examples importmap
  fix examples importmap
  v0.3.0-alpha.44
  update @lume/cli version and fix type errors
  get first-person-shooter deployed (first-person-shooter-20950.nodechef.com)
  get first-person-shooter working on latest lume and meteor
  Update lume/cli and lume/element, update decorator usage accordingly. With this we were able to make some double `__underscored` properties actually `#private` but still reactive. We also renamed some `__underscored` properties to be public in `CompositionTracker` because they could be useful in subclasses. Add a unit test file for the live-code package.
  update TypeScript and fix/improve some types as needed
  Update `lowclass`, `@lume/element`, and `three` versions (`@types/three` and `three` in `yarn.lock`)
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