Skip to content

Commit

Permalink
Fix bug clicking on the item
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcconechy committed Sep 6, 2024
1 parent 729aa1f commit 6bc31f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/ids-slider/ids-slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,9 +1079,10 @@ export default class IdsSlider extends Base {
let closestValue = this.vertical ? ticks[ticks.length - 1].value : ticks[0].value;

if (!labelValueClicked) {
const threshold = Math.abs(Number(this.ticks[1].value - this.ticks[0].value) / 2);
const diff = Number(this.ticks[1].value - this.ticks[0].value);
const threshold = diff < 100 ? diff : (diff / 2);
for (let i = 0; i < this.ticks.length; i++) {
if (Math.abs(this.ticks[i].value - passedValue) <= threshold) {
if (Math.abs(this.ticks[i].value - passedValue) < threshold) {
closestValue = this.ticks[i].value;
}
}
Expand Down

0 comments on commit 6bc31f6

Please sign in to comment.