Skip to content

Commit

Permalink
Merge pull request #3365 from jasongrout/round
Browse files Browse the repository at this point in the history
Validate selection slider values
  • Loading branch information
ibdafna authored Feb 1, 2022
2 parents 29b58ea + 05f63a0 commit 11ade00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/controls/src/widget_int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export abstract class BaseIntSliderView extends DescriptionView {
direction: orientation === 'horizontal' ? 'ltr' : 'rtl',
format: {
from: (value: string): number => Number(value),
to: (value: number): number => value,
to: (value: number): number => this._validate_slide_value(value),
},
});

Expand Down Expand Up @@ -285,7 +285,7 @@ export abstract class BaseIntSliderView extends DescriptionView {
* and applying it to the other views on the page.
*/
_validate_slide_value(x: number): number {
return Math.floor(x);
return Math.round(x);
}

$slider: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/controls/src/widget_selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ export class SelectionSliderView extends DescriptionView {
direction: orientation === 'horizontal' ? 'ltr' : 'rtl',
format: {
from: (value: string): number => Number(value),
to: (value: number): number => value,
to: (value: number): number => Math.round(value),
},
});

Expand Down

0 comments on commit 11ade00

Please sign in to comment.