-
-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inverted Connects for unconstrained behavior
This implementation allows connects to invert when handles pass each other in unconstrained behavior. Added possibility to manually update connects via updateOptions without having to destroy and recreate the slider (which would lose the drag). Also added invertConnects to the API for more control. Set behavior to "unconstrained-invert-connects" to enable this feature.
- Loading branch information
Showing
4 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var invertConnectsValues = document.getElementById('invert-connects-values'); | ||
|
||
invertConnectsSlider.noUiSlider.on('update', function (values) { | ||
var minToHHMM = function(mins) { | ||
var pad = function(n) { return ('0'+n).slice(-2); }; | ||
return [mins / 60 ^ 0, mins % 60].map(pad).join(':'); | ||
}; | ||
invertConnectsValues.innerHTML = values.map(minToHHMM).join(' - '); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var invertConnectsSlider = document.getElementById('invert-connects'); | ||
|
||
noUiSlider.create(invertConnectsSlider, { | ||
start: [20*60, 8*60], | ||
behaviour: 'unconstrained-invert-connects', | ||
step: 15, | ||
connect: true, | ||
range: { | ||
'min': 0, | ||
'max': 24*60 | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters