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

Multiple problems in TurnRatio Playground #9676

Open
OffByOne37 opened this issue Sep 8, 2023 · 4 comments
Open

Multiple problems in TurnRatio Playground #9676

OffByOne37 opened this issue Sep 8, 2023 · 4 comments
Assignees

Comments

@OffByOne37
Copy link
Contributor

The Playground example for Range is wrong!

Problem 1: There is a typo, it should be
//% turnRatio.shadow=turnRatioPicker
with a big R instead of
//% turnratio.shadow=turnRatioPicker

Problem 2: Min Max can't be specified here. I think the Problem is in the file field_turnratio

constructor(value_: any, params: FieldTurnRatioOptions, opt_validator?: Function) { super(String(value_), '-200', '200', '1', '10', 'TurnRatio', opt_validator); this.params = params; (this as any).sliderColor_ = '#a8aaa8'; }

It looks like the min max values are preset with -200 and 200.

@OffByOne37 OffByOne37 changed the title Typo in TurnRatio Playground Multiple problems in TurnRatio Playground Sep 8, 2023
@abchatra
Copy link
Collaborator

abchatra commented Sep 8, 2023

@OffByOne37 feel free to do a PR if you want. @kimprice take a peek?

@OffByOne37
Copy link
Contributor Author

Yeah made a PR for the typo.

Looked a bit more on the second error but do not have enough time to thouroughly check it. But it seems like there is the need to add this

export interface FieldTurnRatioOptions extends Blockly.FieldCustomOptions { min?: number; max?: number; }

and
/** * Class for a color wheel field. * @param {number|string} value The initial content of the field. * @param {Function=} opt_validator An optional function that is called * to validate any constraints on what the user entered. Takes the new * text as an argument and returns either the accepted text, a replacement * text, or null to abort the change. * @extends {Blockly.FieldNumber} * @constructor */ constructor( value_: any, params: FieldTurnRatioOptions, opt_validator?: Function ) { super( String(value_), params.min, params.max, "1", "10", "TurnRatio", opt_validator ); this.params = params; (this as any).sliderColor_ = "#a8aaa8"; }

But as I said, this is only an assumption from my side, and I would need to look further.

@kimprice kimprice self-assigned this Sep 11, 2023
@kimprice
Copy link
Contributor

@OffByOne37 I checked your suggestion and unfortunately it does not solve the problem. We'll need to look into this further.

@OffByOne37
Copy link
Contributor Author

Too bad, as I said it was only a guess, did not have enough time.

If I have time I will try again to find a solution.

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

3 participants