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

Ability to manually select the binding view type #602

Closed
Sija opened this issue Feb 17, 2024 · 4 comments
Closed

Ability to manually select the binding view type #602

Sija opened this issue Feb 17, 2024 · 4 comments

Comments

@Sija
Copy link

Sija commented Feb 17, 2024

ATM it seems it's not possible to override the view selected for the values passed to the Pane.addBinding function. In some cases the heuristics behind the automatic view selection (which are based on the value type and content), are not working as expected, and such ability would provide an escape-hatch, or just a more stable behaviour.

Refs #601

@cocopon
Copy link
Owner

cocopon commented Feb 17, 2024

You can use view: 'text' for disabling color detection:

https://tweakpane.github.io/docs/input-bindings/#color

image

@Sija
Copy link
Author

Sija commented Feb 17, 2024

I tried but it doesn't work for lists.

@cocopon
Copy link
Owner

cocopon commented Feb 17, 2024

Hm, can you share the code and the Tweakpane version? It works fine on the document with the latest Tweakpane.

image

https://tweakpane.github.io/docs/

p = new Tweakpane.Pane();

// without view: 'text'
p.addBinding(
  {foo: '#f00'}, 'foo',
  {
    options: {red: '#f00', blue: '#00f'},
  }
) 

// with view: 'text'
p.addBinding(
  {foo: '#f00'}, 'foo',
  {
    view: 'text',
  }
) 

// with options and view: 'text'
p.addBinding(
  {foo: '#f00'}, 'foo',
  {
    options: {red: '#f00', blue: '#00f'},
    view: 'text',
  }
) 

@Sija
Copy link
Author

Sija commented Feb 17, 2024

I was setting view: "list", with view: "text" though it works correctly, thanks!

@cocopon cocopon closed this as completed Feb 18, 2024
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

2 participants