Skip to content

Commit 11ade00

Browse files
authored
Merge pull request #3365 from jasongrout/round
Validate selection slider values
2 parents 29b58ea + 05f63a0 commit 11ade00

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/controls/src/widget_int.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export abstract class BaseIntSliderView extends DescriptionView {
219219
direction: orientation === 'horizontal' ? 'ltr' : 'rtl',
220220
format: {
221221
from: (value: string): number => Number(value),
222-
to: (value: number): number => value,
222+
to: (value: number): number => this._validate_slide_value(value),
223223
},
224224
});
225225

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

291291
$slider: any;

packages/controls/src/widget_selection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ export class SelectionSliderView extends DescriptionView {
765765
direction: orientation === 'horizontal' ? 'ltr' : 'rtl',
766766
format: {
767767
from: (value: string): number => Number(value),
768-
to: (value: number): number => value,
768+
to: (value: number): number => Math.round(value),
769769
},
770770
});
771771

0 commit comments

Comments
 (0)