MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / renderRangeSlider

Method renderRangeSlider

core/src/components/range/range.tsx:776–976  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

774 }
775
776 private renderRangeSlider() {
777 const {
778 min,
779 max,
780 step,
781 handleKeyboard,
782 activatedKnob,
783 focusedKnob,
784 hoveredKnob,
785 pressedKnob,
786 disabled,
787 pin,
788 ratioLower,
789 ratioUpper,
790 pinFormatter,
791 inheritedAttributes,
792 } = this;
793
794 let barStart = `${ratioLower * 100}%`;
795 let barEnd = `${100 - ratioUpper * 100}%`;
796
797 const rtl = isRTL(this.el);
798
799 const start = rtl ? 'right' : 'left';
800 const end = rtl ? 'left' : 'right';
801
802 const tickStyle = (tick: any) => {
803 return {
804 [start]: tick[start],
805 };
806 };
807
808 if (this.dualKnobs === false) {
809 /**
810 * When the value is less than the activeBarStart or the min value,
811 * the knob will display at the start of the active bar.
812 */
813 if (this.valA < (this.activeBarStart ?? this.min)) {
814 /**
815 * Sets the bar positions relative to the upper and lower limits.
816 * Converts the ratio values into percentages, used as offsets for left/right styles.
817 *
818 * The ratioUpper refers to the knob position on the bar.
819 * The ratioLower refers to the end position of the active bar (the value).
820 */
821 barStart = `${ratioUpper * 100}%`;
822 barEnd = `${100 - ratioLower * 100}%`;
823 } else {
824 /**
825 * Otherwise, the knob will display at the end of the active bar.
826 *
827 * The ratioLower refers to the start position of the active bar (the value).
828 * The ratioUpper refers to the knob position on the bar.
829 */
830 barStart = `${ratioLower * 100}%`;
831 barEnd = `${100 - ratioUpper * 100}%`;
832 }
833 }

Callers 1

renderMethod · 0.95

Calls 7

onStartMethod · 0.95
onEndMethod · 0.95
isRTLFunction · 0.90
valueToRatioFunction · 0.85
renderKnobFunction · 0.85
getKnobPositionFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected