Skip to content

Commit

Permalink
noUiSlider 14.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Jun 27, 2020
1 parent f442a1d commit 6e68e7e
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 14.6.0 (*2020-06-27*)
- Added: `keyboardPageMultiplier` and `keyboardDefaultStep` options (#1083);
- Fixed: Ignore erroneous tap events for iOS (#1057, #1079);

### 14.5.0 (*2020-05-20*)
- Added: Support for `margin`, `padding` and `limit` on non-linear sliders (#911, #1030, #1031, #1071);

Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 14.5.0 - 5/11/2020 */
/*! nouislider - 14.6.0 - 6/27/2020 */
/* Functional styling;
* These styles are required for noUiSlider to function.
* You don't need to change these rules to apply your design.
Expand Down
41 changes: 36 additions & 5 deletions distribute/nouislider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 14.5.0 - 5/11/2020 */
/*! nouislider - 14.6.0 - 6/27/2020 */
(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
Expand All @@ -13,7 +13,7 @@
})(function() {
"use strict";

var VERSION = "14.5.0";
var VERSION = "14.6.0";

//region Helper Methods

Expand Down Expand Up @@ -654,6 +654,22 @@
parsed.singleStep = entry;
}

function testKeyboardPageMultiplier(parsed, entry) {
if (!isNumeric(entry)) {
throw new Error("noUiSlider (" + VERSION + "): 'keyboardPageMultiplier' is not numeric.");
}

parsed.keyboardPageMultiplier = entry;
}

function testKeyboardDefaultStep(parsed, entry) {
if (!isNumeric(entry)) {
throw new Error("noUiSlider (" + VERSION + "): 'keyboardDefaultStep' is not numeric.");
}

parsed.keyboardDefaultStep = entry;
}

function testRange(parsed, entry) {
// Filter incorrect input.
if (typeof entry !== "object" || Array.isArray(entry)) {
Expand Down Expand Up @@ -987,6 +1003,8 @@
// Tests are executed in the order they are presented here.
var tests = {
step: { r: false, t: testStep },
keyboardPageMultiplier: { r: false, t: testKeyboardPageMultiplier },
keyboardDefaultStep: { r: false, t: testKeyboardDefaultStep },
start: { r: true, t: testStart },
connect: { r: true, t: testConnect },
direction: { r: true, t: testDirection },
Expand Down Expand Up @@ -1015,7 +1033,9 @@
orientation: "horizontal",
keyboardSupport: true,
cssPrefix: "noUi-",
cssClasses: cssClasses
cssClasses: cssClasses,
keyboardPageMultiplier: 5,
keyboardDefaultStep: 10
};

// AriaFormat defaults to regular format, if any.
Expand Down Expand Up @@ -1856,6 +1876,13 @@

// Move closest handle to tapped location.
function eventTap(event) {
// Erroneous events seem to be passed in occasionally on iOS/iPadOS after user finishes interacting with
// the slider. They appear to be of type MouseEvent, yet they don't have usual properties set. Ignore tap
// events that have no touches or buttons associated with them.
if (!event.buttons && !event.touches) {
return false;
}

// The tap event shouldn't propagate up
event.stopPropagation();

Expand Down Expand Up @@ -1943,7 +1970,7 @@
var to;

if (isUp || isDown) {
var multiplier = 5;
var multiplier = options.keyboardPageMultiplier;
var direction = isDown ? 0 : 1;
var steps = getNextStepsForHandle(handleNumber);
var step = steps[direction];
Expand All @@ -1955,7 +1982,11 @@

// No step set, use the default of 10% of the sub-range
if (step === false) {
step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, 10);
step = scope_Spectrum.getDefaultStep(
scope_Locations[handleNumber],
isDown,
options.keyboardDefaultStep
);
}

if (isLargeUp || isLargeDown) {
Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions distribute/nouislider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nouislider",
"version": "14.5.0",
"version": "14.6.0",
"main": "distribute/nouislider.js",
"style": "distribute/nouislider.min.css",
"license": "MIT",
Expand Down

0 comments on commit 6e68e7e

Please sign in to comment.