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

Expanded extend options #71

Open
doxel-sander opened this issue Jun 28, 2024 · 0 comments
Open

Expanded extend options #71

doxel-sander opened this issue Jun 28, 2024 · 0 comments

Comments

@doxel-sander
Copy link
Contributor

troika-three-text (github) recommends calling sync after any layout-changing properties, but this isn't done automatically when extending in Lunchbox.

Current:

import { extend } from 'lunchboxjs'
import { Text } from 'troika-three-text'
extend('troika-text', Text);

creates:

<!-- `text` attribute works, but not `fontSize` -->
<troika-text text="Example" fontSize="1"></troika-text>

Desired:

import { extend } from 'lunchboxjs'
import { Text } from 'troika-three-text'
extend('troika-text', Text, {
  // generic callback that fires when any attribute is changed - 
  // used to call `sync` automatically here
  onAttributeChanged: (key: string, value: string, instance: Text) => {
    instance.sync()
  }
});
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

No branches or pull requests

1 participant