@progress/kendo-angular-inputs
Version:
Kendo UI for Angular Inputs Package - Everything you need to build professional form functionality (Checkbox, ColorGradient, ColorPalette, ColorPicker, FlatColorPicker, FormField, MaskedTextBox, NumericTextBox, RadioButton, RangeSlider, Slider, Switch, Te
33 lines (32 loc) • 1.38 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { trimValue, calculateHandlePosition } from '../sliders-common/sliders-util';
import { SliderModelBase } from '../sliders-common/slider-model.base';
/**
* @hidden
*/
export class SliderModel extends SliderModelBase {
handlePosition;
positionHandle(dragHandle) {
const { max, min, reverse, vertical } = this.props;
const position = vertical ? 'bottom' : reverse ? 'right' : 'left';
const trackWidth = this.trackWidth();
const value = trimValue(max, min, this.props.value);
this.handlePosition = calculateHandlePosition({
min,
max,
reverse,
value,
trackWidth
});
this.renderer.setStyle(dragHandle, position, `${this.handlePosition}px`);
}
positionSelection(selection) {
const { vertical } = this.props;
const dimension = vertical ? 'height' : 'width';
const size = this.handlePosition;
this.renderer.setStyle(selection, dimension, `${size}px`);
}
}