Skip to content

Commit 463edc4

Browse files
committed
make the "pipstep" prop actually reactive
I found that it was only partially reactive and not updating the pipstep value if the values (min/max) changed
1 parent 2d1358a commit 463edc4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/RangePips.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
export let vertical = false;
1010
1111
// range pips / values props
12-
export let pipstep = ((max - min) / step >= ( vertical ? 50 : 100 ) ? (max - min) / ( vertical ? 10 : 20 ) : 1);
12+
export let pipstep = undefined;
1313
export let all = true;
1414
export let first = undefined;
1515
export let last = undefined;
@@ -24,10 +24,12 @@
2424
export let focus = undefined;
2525
export let percentOf = undefined;
2626
27-
$: pipCount = parseInt((max - min) / (step * pipstep), 10);
27+
$: pipStep = pipstep || ((max - min) / step >= ( vertical ? 50 : 100 ) ? (max - min) / ( vertical ? 10 : 20 ) : 1);
28+
29+
$: pipCount = parseInt((max - min) / (step * pipStep), 10);
2830
2931
$: pipVal = function(val) {
30-
return min + val * step * pipstep;
32+
return min + val * step * pipStep;
3133
};
3234
3335
$: isSelected = function(val) {

0 commit comments

Comments
 (0)