Skip to content

Commit

Permalink
Changed name of 'pixel' to 'value':
Browse files Browse the repository at this point in the history
  • Loading branch information
josercarcamo committed Jan 15, 2025
1 parent cf77344 commit 9eb46f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/calcite-components/src/components/slider/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -745,21 +745,21 @@ export class Slider
/**
* Translate a pixel position to value along the range
*
* @param pixel
* @param value
* @private
*/
private mapToRange(pixel: number): number {
private mapToRange(value: number): number {
const range = this.max - this.min;
const rect = this.trackEl.getBoundingClientRect();
const percent =
this.layout === "horizontal"
? (pixel - rect.left) / rect.width
: (rect.bottom - pixel) / rect.height;
? (value - rect.left) / rect.width
: (rect.bottom - value) / rect.height;
const mirror = this.shouldMirror();
const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
const value = Number(clampedValue.toFixed(decimalPlaces(this.step)));
const mappedValue = Number(clampedValue.toFixed(decimalPlaces(this.step)));

return !(this.snap && this.step) ? value : this.getClosestStep(value);
return !(this.snap && this.step) ? mappedValue : this.getClosestStep(mappedValue);
}

/**
Expand Down

0 comments on commit 9eb46f6

Please sign in to comment.