Skip to content

Expanded extend options #71

@doxel-sander

Description

@doxel-sander

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()
  }
});

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