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

Common step, min, max parameters for Point input #417

Closed
Lutymane opened this issue Jul 4, 2022 · 3 comments
Closed

Common step, min, max parameters for Point input #417

Lutymane opened this issue Jul 4, 2022 · 3 comments
Milestone

Comments

@Lutymane
Copy link

Lutymane commented Jul 4, 2022

Hello,

It'll be very handy to be able to specify the mentioned parameters in options when both dimensions have same constrains instead of duplicating them for x and y.

So current way is:

const PARAMS = {
  offset: {x: 20, y: 30},
};

const pane = new Pane();
pane.addInput(PARAMS, 'offset', {
  x: {step: 1, min: 0, max: 4},
  y: {step: 1, min: 0, max: 4},
});

Desired:

const PARAMS = {
  offset: {x: 20, y: 30},
};

const pane = new Pane();
pane.addInput(PARAMS, 'offset', {
  step: 20, min: 0, max: 4
});

So the check would be something like params.x.step ?? params.step meaning root level params would act as fallback, while specifying them per property would override defaults

@alijaya
Copy link

alijaya commented Sep 2, 2022

For workaround I guess you could do it like this:

const opts = {step: 20, min: 0, max: 4};
pane.addInput(PARAMS, 'offset', {
  x: opts, // in case using all default value
  y: {...opts, step: 1} // in case want to override it
});

@cocopon
Copy link
Owner

cocopon commented Mar 10, 2023

Implemented in #514 and will be released in the next major version.

@cocopon cocopon mentioned this issue Mar 11, 2023
24 tasks
@cocopon
Copy link
Owner

cocopon commented Aug 6, 2023

Released in v4.0.0.

@cocopon cocopon closed this as completed Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants