pghero 2.7.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pghero might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- /*! nouislider - 14.0.3 - 10/10/2019 */
1
+ /*! nouislider - 14.6.1 - 8/17/2020 */
2
2
  (function(factory) {
3
3
  if (typeof define === "function" && define.amd) {
4
4
  // AMD. Register as an anonymous module.
@@ -13,7 +13,7 @@
13
13
  })(function() {
14
14
  "use strict";
15
15
 
16
- var VERSION = "14.0.3";
16
+ var VERSION = "14.6.1";
17
17
 
18
18
  //region Helper Methods
19
19
 
@@ -100,7 +100,7 @@
100
100
 
101
101
  // http://youmightnotneedjquery.com/#add_class
102
102
  function addClass(el, className) {
103
- if (el.classList) {
103
+ if (el.classList && !/\s/.test(className)) {
104
104
  el.classList.add(className);
105
105
  } else {
106
106
  el.className += " " + className;
@@ -109,7 +109,7 @@
109
109
 
110
110
  // http://youmightnotneedjquery.com/#remove_class
111
111
  function removeClass(el, className) {
112
- if (el.classList) {
112
+ if (el.classList && !/\s/.test(className)) {
113
113
  el.classList.remove(className);
114
114
  } else {
115
115
  el.className = el.className.replace(
@@ -206,13 +206,13 @@
206
206
  }
207
207
 
208
208
  // (percentage) How many percent is this value of this range?
209
- function fromPercentage(range, value) {
210
- return (value * 100) / (range[1] - range[0]);
209
+ function fromPercentage(range, value, startRange) {
210
+ return (value * 100) / (range[startRange + 1] - range[startRange]);
211
211
  }
212
212
 
213
213
  // (percentage) Where is this value on this range?
214
214
  function toPercentage(range, value) {
215
- return fromPercentage(range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0]);
215
+ return fromPercentage(range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0], 0);
216
216
  }
217
217
 
218
218
  // (value) How much is this percentage on this range?
@@ -348,7 +348,7 @@
348
348
 
349
349
  // Factor to range ratio
350
350
  that.xSteps[i] =
351
- fromPercentage([that.xVal[i], that.xVal[i + 1]], n) / subRangeRatio(that.xPct[i], that.xPct[i + 1]);
351
+ fromPercentage([that.xVal[i], that.xVal[i + 1]], n, 0) / subRangeRatio(that.xPct[i], that.xPct[i + 1]);
352
352
 
353
353
  var totalSteps = (that.xVal[i + 1] - that.xVal[i]) / that.xNumSteps[i];
354
354
  var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1);
@@ -406,14 +406,107 @@
406
406
  }
407
407
  }
408
408
 
409
- Spectrum.prototype.getMargin = function(value) {
410
- var step = this.xNumSteps[0];
409
+ Spectrum.prototype.getDistance = function(value) {
410
+ var index;
411
+ var distances = [];
412
+
413
+ for (index = 0; index < this.xNumSteps.length - 1; index++) {
414
+ // last "range" can't contain step size as it is purely an endpoint.
415
+ var step = this.xNumSteps[index];
411
416
 
412
- if (step && (value / step) % 1 !== 0) {
413
- throw new Error("noUiSlider (" + VERSION + "): 'limit', 'margin' and 'padding' must be divisible by step.");
417
+ if (step && (value / step) % 1 !== 0) {
418
+ throw new Error(
419
+ "noUiSlider (" +
420
+ VERSION +
421
+ "): 'limit', 'margin' and 'padding' of " +
422
+ this.xPct[index] +
423
+ "% range must be divisible by step."
424
+ );
425
+ }
426
+
427
+ // Calculate percentual distance in current range of limit, margin or padding
428
+ distances[index] = fromPercentage(this.xVal, value, index);
414
429
  }
415
430
 
416
- return this.xPct.length === 2 ? fromPercentage(this.xVal, value) : false;
431
+ return distances;
432
+ };
433
+
434
+ // Calculate the percentual distance over the whole scale of ranges.
435
+ // direction: 0 = backwards / 1 = forwards
436
+ Spectrum.prototype.getAbsoluteDistance = function(value, distances, direction) {
437
+ var xPct_index = 0;
438
+
439
+ // Calculate range where to start calculation
440
+ if (value < this.xPct[this.xPct.length - 1]) {
441
+ while (value > this.xPct[xPct_index + 1]) {
442
+ xPct_index++;
443
+ }
444
+ } else if (value === this.xPct[this.xPct.length - 1]) {
445
+ xPct_index = this.xPct.length - 2;
446
+ }
447
+
448
+ // If looking backwards and the value is exactly at a range separator then look one range further
449
+ if (!direction && value === this.xPct[xPct_index + 1]) {
450
+ xPct_index++;
451
+ }
452
+
453
+ var start_factor;
454
+ var rest_factor = 1;
455
+
456
+ var rest_rel_distance = distances[xPct_index];
457
+
458
+ var range_pct = 0;
459
+
460
+ var rel_range_distance = 0;
461
+ var abs_distance_counter = 0;
462
+ var range_counter = 0;
463
+
464
+ // Calculate what part of the start range the value is
465
+ if (direction) {
466
+ start_factor = (value - this.xPct[xPct_index]) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
467
+ } else {
468
+ start_factor = (this.xPct[xPct_index + 1] - value) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
469
+ }
470
+
471
+ // Do until the complete distance across ranges is calculated
472
+ while (rest_rel_distance > 0) {
473
+ // Calculate the percentage of total range
474
+ range_pct = this.xPct[xPct_index + 1 + range_counter] - this.xPct[xPct_index + range_counter];
475
+
476
+ // Detect if the margin, padding or limit is larger then the current range and calculate
477
+ if (distances[xPct_index + range_counter] * rest_factor + 100 - start_factor * 100 > 100) {
478
+ // If larger then take the percentual distance of the whole range
479
+ rel_range_distance = range_pct * start_factor;
480
+ // Rest factor of relative percentual distance still to be calculated
481
+ rest_factor = (rest_rel_distance - 100 * start_factor) / distances[xPct_index + range_counter];
482
+ // Set start factor to 1 as for next range it does not apply.
483
+ start_factor = 1;
484
+ } else {
485
+ // If smaller or equal then take the percentual distance of the calculate percentual part of that range
486
+ rel_range_distance = ((distances[xPct_index + range_counter] * range_pct) / 100) * rest_factor;
487
+ // No rest left as the rest fits in current range
488
+ rest_factor = 0;
489
+ }
490
+
491
+ if (direction) {
492
+ abs_distance_counter = abs_distance_counter - rel_range_distance;
493
+ // Limit range to first range when distance becomes outside of minimum range
494
+ if (this.xPct.length + range_counter >= 1) {
495
+ range_counter--;
496
+ }
497
+ } else {
498
+ abs_distance_counter = abs_distance_counter + rel_range_distance;
499
+ // Limit range to last range when distance becomes outside of maximum range
500
+ if (this.xPct.length - range_counter >= 1) {
501
+ range_counter++;
502
+ }
503
+ }
504
+
505
+ // Rest of relative percentual distance still to be calculated
506
+ rest_rel_distance = distances[xPct_index + range_counter] * rest_factor;
507
+ }
508
+
509
+ return value + abs_distance_counter;
417
510
  };
418
511
 
419
512
  Spectrum.prototype.toStepping = function(value) {
@@ -492,6 +585,8 @@
492
585
  or true when everything is OK. It can also modify the option
493
586
  object, to make sure all values can be correctly looped elsewhere. */
494
587
 
588
+ //region Defaults
589
+
495
590
  var defaultFormatter = {
496
591
  to: function(value) {
497
592
  return value !== undefined && value.toFixed(2);
@@ -499,6 +594,47 @@
499
594
  from: Number
500
595
  };
501
596
 
597
+ var cssClasses = {
598
+ target: "target",
599
+ base: "base",
600
+ origin: "origin",
601
+ handle: "handle",
602
+ handleLower: "handle-lower",
603
+ handleUpper: "handle-upper",
604
+ touchArea: "touch-area",
605
+ horizontal: "horizontal",
606
+ vertical: "vertical",
607
+ background: "background",
608
+ connect: "connect",
609
+ connects: "connects",
610
+ ltr: "ltr",
611
+ rtl: "rtl",
612
+ textDirectionLtr: "txt-dir-ltr",
613
+ textDirectionRtl: "txt-dir-rtl",
614
+ draggable: "draggable",
615
+ drag: "state-drag",
616
+ tap: "state-tap",
617
+ active: "active",
618
+ tooltip: "tooltip",
619
+ pips: "pips",
620
+ pipsHorizontal: "pips-horizontal",
621
+ pipsVertical: "pips-vertical",
622
+ marker: "marker",
623
+ markerHorizontal: "marker-horizontal",
624
+ markerVertical: "marker-vertical",
625
+ markerNormal: "marker-normal",
626
+ markerLarge: "marker-large",
627
+ markerSub: "marker-sub",
628
+ value: "value",
629
+ valueHorizontal: "value-horizontal",
630
+ valueVertical: "value-vertical",
631
+ valueNormal: "value-normal",
632
+ valueLarge: "value-large",
633
+ valueSub: "value-sub"
634
+ };
635
+
636
+ //endregion
637
+
502
638
  function validateFormat(entry) {
503
639
  // Any object with a to and from method is supported.
504
640
  if (isValidFormatter(entry)) {
@@ -518,6 +654,22 @@
518
654
  parsed.singleStep = entry;
519
655
  }
520
656
 
657
+ function testKeyboardPageMultiplier(parsed, entry) {
658
+ if (!isNumeric(entry)) {
659
+ throw new Error("noUiSlider (" + VERSION + "): 'keyboardPageMultiplier' is not numeric.");
660
+ }
661
+
662
+ parsed.keyboardPageMultiplier = entry;
663
+ }
664
+
665
+ function testKeyboardDefaultStep(parsed, entry) {
666
+ if (!isNumeric(entry)) {
667
+ throw new Error("noUiSlider (" + VERSION + "): 'keyboardDefaultStep' is not numeric.");
668
+ }
669
+
670
+ parsed.keyboardDefaultStep = entry;
671
+ }
672
+
521
673
  function testRange(parsed, entry) {
522
674
  // Filter incorrect input.
523
675
  if (typeof entry !== "object" || Array.isArray(entry)) {
@@ -635,11 +787,7 @@
635
787
  return;
636
788
  }
637
789
 
638
- parsed.margin = parsed.spectrum.getMargin(entry);
639
-
640
- if (!parsed.margin) {
641
- throw new Error("noUiSlider (" + VERSION + "): 'margin' option is only supported on linear sliders.");
642
- }
790
+ parsed.margin = parsed.spectrum.getDistance(entry);
643
791
  }
644
792
 
645
793
  function testLimit(parsed, entry) {
@@ -647,7 +795,7 @@
647
795
  throw new Error("noUiSlider (" + VERSION + "): 'limit' option must be numeric.");
648
796
  }
649
797
 
650
- parsed.limit = parsed.spectrum.getMargin(entry);
798
+ parsed.limit = parsed.spectrum.getDistance(entry);
651
799
 
652
800
  if (!parsed.limit || parsed.handles < 2) {
653
801
  throw new Error(
@@ -659,6 +807,8 @@
659
807
  }
660
808
 
661
809
  function testPadding(parsed, entry) {
810
+ var index;
811
+
662
812
  if (!isNumeric(entry) && !Array.isArray(entry)) {
663
813
  throw new Error(
664
814
  "noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."
@@ -679,18 +829,21 @@
679
829
  entry = [entry, entry];
680
830
  }
681
831
 
682
- // 'getMargin' returns false for invalid values.
683
- parsed.padding = [parsed.spectrum.getMargin(entry[0]), parsed.spectrum.getMargin(entry[1])];
832
+ // 'getDistance' returns false for invalid values.
833
+ parsed.padding = [parsed.spectrum.getDistance(entry[0]), parsed.spectrum.getDistance(entry[1])];
684
834
 
685
- if (parsed.padding[0] === false || parsed.padding[1] === false) {
686
- throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders.");
835
+ for (index = 0; index < parsed.spectrum.xNumSteps.length - 1; index++) {
836
+ // last "range" can't contain step size as it is purely an endpoint.
837
+ if (parsed.padding[0][index] < 0 || parsed.padding[1][index] < 0) {
838
+ throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number(s).");
839
+ }
687
840
  }
688
841
 
689
- if (parsed.padding[0] < 0 || parsed.padding[1] < 0) {
690
- throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number(s).");
691
- }
842
+ var totalPadding = entry[0] + entry[1];
843
+ var firstValue = parsed.spectrum.xVal[0];
844
+ var lastValue = parsed.spectrum.xVal[parsed.spectrum.xVal.length - 1];
692
845
 
693
- if (parsed.padding[0] + parsed.padding[1] > 100) {
846
+ if (totalPadding / (lastValue - firstValue) > 1) {
694
847
  throw new Error("noUiSlider (" + VERSION + "): 'padding' option must not exceed 100% of the range.");
695
848
  }
696
849
  }
@@ -850,6 +1003,8 @@
850
1003
  // Tests are executed in the order they are presented here.
851
1004
  var tests = {
852
1005
  step: { r: false, t: testStep },
1006
+ keyboardPageMultiplier: { r: false, t: testKeyboardPageMultiplier },
1007
+ keyboardDefaultStep: { r: false, t: testKeyboardDefaultStep },
853
1008
  start: { r: true, t: testStart },
854
1009
  connect: { r: true, t: testConnect },
855
1010
  direction: { r: true, t: testDirection },
@@ -878,42 +1033,9 @@
878
1033
  orientation: "horizontal",
879
1034
  keyboardSupport: true,
880
1035
  cssPrefix: "noUi-",
881
- cssClasses: {
882
- target: "target",
883
- base: "base",
884
- origin: "origin",
885
- handle: "handle",
886
- handleLower: "handle-lower",
887
- handleUpper: "handle-upper",
888
- touchArea: "touch-area",
889
- horizontal: "horizontal",
890
- vertical: "vertical",
891
- background: "background",
892
- connect: "connect",
893
- connects: "connects",
894
- ltr: "ltr",
895
- rtl: "rtl",
896
- draggable: "draggable",
897
- drag: "state-drag",
898
- tap: "state-tap",
899
- active: "active",
900
- tooltip: "tooltip",
901
- pips: "pips",
902
- pipsHorizontal: "pips-horizontal",
903
- pipsVertical: "pips-vertical",
904
- marker: "marker",
905
- markerHorizontal: "marker-horizontal",
906
- markerVertical: "marker-vertical",
907
- markerNormal: "marker-normal",
908
- markerLarge: "marker-large",
909
- markerSub: "marker-sub",
910
- value: "value",
911
- valueHorizontal: "value-horizontal",
912
- valueVertical: "value-vertical",
913
- valueNormal: "value-normal",
914
- valueLarge: "value-large",
915
- valueSub: "value-sub"
916
- }
1036
+ cssClasses: cssClasses,
1037
+ keyboardPageMultiplier: 5,
1038
+ keyboardDefaultStep: 10
917
1039
  };
918
1040
 
919
1041
  // AriaFormat defaults to regular format, if any.
@@ -1090,6 +1212,14 @@
1090
1212
  addClass(addTarget, options.cssClasses.vertical);
1091
1213
  }
1092
1214
 
1215
+ var textDirection = getComputedStyle(addTarget).direction;
1216
+
1217
+ if (textDirection === "rtl") {
1218
+ addClass(addTarget, options.cssClasses.textDirectionRtl);
1219
+ } else {
1220
+ addClass(addTarget, options.cssClasses.textDirectionLtr);
1221
+ }
1222
+
1093
1223
  return addNodeTo(addTarget, options.cssClasses.base);
1094
1224
  }
1095
1225
 
@@ -1279,12 +1409,16 @@
1279
1409
  step = high - low;
1280
1410
  }
1281
1411
 
1282
- // Low can be 0, so test for false. If high is undefined,
1283
- // we are at the last subrange. Index 0 is already handled.
1284
- if (low === false || high === undefined) {
1412
+ // Low can be 0, so test for false. Index 0 is already handled.
1413
+ if (low === false) {
1285
1414
  return;
1286
1415
  }
1287
1416
 
1417
+ // If high is undefined we are at the last subrange. Make sure it iterates once (#1088)
1418
+ if (high === undefined) {
1419
+ high = low;
1420
+ }
1421
+
1288
1422
  // Make sure step isn't 0, which would cause an infinite loop (#654)
1289
1423
  step = Math.max(step, 0.0000001);
1290
1424
 
@@ -1319,7 +1453,7 @@
1319
1453
  type = group.indexOf(i) > -1 ? PIPS_LARGE_VALUE : isSteps ? PIPS_SMALL_VALUE : PIPS_NO_VALUE;
1320
1454
 
1321
1455
  // Enforce the 'ignoreFirst' option by overwriting the type for 0.
1322
- if (!index && ignoreFirst) {
1456
+ if (!index && ignoreFirst && i !== high) {
1323
1457
  type = 0;
1324
1458
  }
1325
1459
 
@@ -1510,7 +1644,11 @@
1510
1644
  if (touch) {
1511
1645
  // Returns true if a touch originated on the target.
1512
1646
  var isTouchOnTarget = function(checkTouch) {
1513
- return checkTouch.target === eventTarget || eventTarget.contains(checkTouch.target);
1647
+ return (
1648
+ checkTouch.target === eventTarget ||
1649
+ eventTarget.contains(checkTouch.target) ||
1650
+ (checkTouch.target.shadowRoot && checkTouch.target.shadowRoot.contains(eventTarget))
1651
+ );
1514
1652
  };
1515
1653
 
1516
1654
  // In the case of touchstart events, we need to make sure there is still no more than one
@@ -1742,6 +1880,13 @@
1742
1880
 
1743
1881
  // Move closest handle to tapped location.
1744
1882
  function eventTap(event) {
1883
+ // Erroneous events seem to be passed in occasionally on iOS/iPadOS after user finishes interacting with
1884
+ // the slider. They appear to be of type MouseEvent, yet they don't have usual properties set. Ignore tap
1885
+ // events that have no touches or buttons associated with them.
1886
+ if (!event.buttons && !event.touches) {
1887
+ return false;
1888
+ }
1889
+
1745
1890
  // The tap event shouldn't propagate up
1746
1891
  event.stopPropagation();
1747
1892
 
@@ -1798,6 +1943,8 @@
1798
1943
 
1799
1944
  var horizontalKeys = ["Left", "Right"];
1800
1945
  var verticalKeys = ["Down", "Up"];
1946
+ var largeStepKeys = ["PageDown", "PageUp"];
1947
+ var edgeKeys = ["Home", "End"];
1801
1948
 
1802
1949
  if (options.dir && !options.ort) {
1803
1950
  // On an right-to-left slider, the left and right keys act inverted
@@ -1805,40 +1952,67 @@
1805
1952
  } else if (options.ort && !options.dir) {
1806
1953
  // On a top-to-bottom slider, the up and down keys act inverted
1807
1954
  verticalKeys.reverse();
1955
+ largeStepKeys.reverse();
1808
1956
  }
1809
1957
 
1810
1958
  // Strip "Arrow" for IE compatibility. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
1811
1959
  var key = event.key.replace("Arrow", "");
1812
- var isDown = key === verticalKeys[0] || key === horizontalKeys[0];
1813
- var isUp = key === verticalKeys[1] || key === horizontalKeys[1];
1814
1960
 
1815
- if (!isDown && !isUp) {
1961
+ var isLargeDown = key === largeStepKeys[0];
1962
+ var isLargeUp = key === largeStepKeys[1];
1963
+ var isDown = key === verticalKeys[0] || key === horizontalKeys[0] || isLargeDown;
1964
+ var isUp = key === verticalKeys[1] || key === horizontalKeys[1] || isLargeUp;
1965
+ var isMin = key === edgeKeys[0];
1966
+ var isMax = key === edgeKeys[1];
1967
+
1968
+ if (!isDown && !isUp && !isMin && !isMax) {
1816
1969
  return true;
1817
1970
  }
1818
1971
 
1819
1972
  event.preventDefault();
1820
1973
 
1821
- var direction = isDown ? 0 : 1;
1822
- var steps = getNextStepsForHandle(handleNumber);
1823
- var step = steps[direction];
1974
+ var to;
1824
1975
 
1825
- // At the edge of a slider, do nothing
1826
- if (step === null) {
1827
- return false;
1828
- }
1976
+ if (isUp || isDown) {
1977
+ var multiplier = options.keyboardPageMultiplier;
1978
+ var direction = isDown ? 0 : 1;
1979
+ var steps = getNextStepsForHandle(handleNumber);
1980
+ var step = steps[direction];
1829
1981
 
1830
- // No step set, use the default of 10% of the sub-range
1831
- if (step === false) {
1832
- step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, 10);
1833
- }
1982
+ // At the edge of a slider, do nothing
1983
+ if (step === null) {
1984
+ return false;
1985
+ }
1834
1986
 
1835
- // Step over zero-length ranges (#948);
1836
- step = Math.max(step, 0.0000001);
1987
+ // No step set, use the default of 10% of the sub-range
1988
+ if (step === false) {
1989
+ step = scope_Spectrum.getDefaultStep(
1990
+ scope_Locations[handleNumber],
1991
+ isDown,
1992
+ options.keyboardDefaultStep
1993
+ );
1994
+ }
1837
1995
 
1838
- // Decrement for down steps
1839
- step = (isDown ? -1 : 1) * step;
1996
+ if (isLargeUp || isLargeDown) {
1997
+ step *= multiplier;
1998
+ }
1840
1999
 
1841
- setHandle(handleNumber, scope_Spectrum.toStepping(scope_Values[handleNumber] + step), true, true);
2000
+ // Step over zero-length ranges (#948);
2001
+ step = Math.max(step, 0.0000001);
2002
+
2003
+ // Decrement for down steps
2004
+ step = (isDown ? -1 : 1) * step;
2005
+
2006
+ to = scope_Values[handleNumber] + step;
2007
+ } else if (isMax) {
2008
+ // End key
2009
+ to = options.spectrum.xVal[options.spectrum.xVal.length - 1];
2010
+ } else {
2011
+ // Home key
2012
+ to = options.spectrum.xVal[0];
2013
+ }
2014
+
2015
+ setHandle(handleNumber, scope_Spectrum.toStepping(to), true, true);
1842
2016
 
1843
2017
  fireEvent("slide", handleNumber);
1844
2018
  fireEvent("update", handleNumber);
@@ -1952,7 +2126,9 @@
1952
2126
  // Event is fired by tap, true or false
1953
2127
  tap || false,
1954
2128
  // Left offset of the handle, in relation to the slider
1955
- scope_Locations.slice()
2129
+ scope_Locations.slice(),
2130
+ // add the slider public API to an accessible parameter when this is unavailable
2131
+ scope_Self
1956
2132
  );
1957
2133
  });
1958
2134
  }
@@ -1961,15 +2137,19 @@
1961
2137
 
1962
2138
  // Split out the handle positioning logic so the Move event can use it, too
1963
2139
  function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue) {
2140
+ var distance;
2141
+
1964
2142
  // For sliders with multiple handles, limit movement to the other handle.
1965
2143
  // Apply the margin option by adding it to the handle positions.
1966
2144
  if (scope_Handles.length > 1 && !options.events.unconstrained) {
1967
2145
  if (lookBackward && handleNumber > 0) {
1968
- to = Math.max(to, reference[handleNumber - 1] + options.margin);
2146
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.margin, 0);
2147
+ to = Math.max(to, distance);
1969
2148
  }
1970
2149
 
1971
2150
  if (lookForward && handleNumber < scope_Handles.length - 1) {
1972
- to = Math.min(to, reference[handleNumber + 1] - options.margin);
2151
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.margin, 1);
2152
+ to = Math.min(to, distance);
1973
2153
  }
1974
2154
  }
1975
2155
 
@@ -1978,11 +2158,13 @@
1978
2158
  // handles would be unmovable.
1979
2159
  if (scope_Handles.length > 1 && options.limit) {
1980
2160
  if (lookBackward && handleNumber > 0) {
1981
- to = Math.min(to, reference[handleNumber - 1] + options.limit);
2161
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.limit, 0);
2162
+ to = Math.min(to, distance);
1982
2163
  }
1983
2164
 
1984
2165
  if (lookForward && handleNumber < scope_Handles.length - 1) {
1985
- to = Math.max(to, reference[handleNumber + 1] - options.limit);
2166
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.limit, 1);
2167
+ to = Math.max(to, distance);
1986
2168
  }
1987
2169
  }
1988
2170
 
@@ -1990,11 +2172,13 @@
1990
2172
  // edges of the slider. Padding must be > 0.
1991
2173
  if (options.padding) {
1992
2174
  if (handleNumber === 0) {
1993
- to = Math.max(to, options.padding[0]);
2175
+ distance = scope_Spectrum.getAbsoluteDistance(0, options.padding[0], 0);
2176
+ to = Math.max(to, distance);
1994
2177
  }
1995
2178
 
1996
2179
  if (handleNumber === scope_Handles.length - 1) {
1997
- to = Math.min(to, 100 - options.padding[1]);
2180
+ distance = scope_Spectrum.getAbsoluteDistance(100, options.padding[1], 1);
2181
+ to = Math.min(to, distance);
1998
2182
  }
1999
2183
  }
2000
2184
 
@@ -2443,6 +2627,12 @@
2443
2627
  target: scope_Target, // Issue #597
2444
2628
  removePips: removePips,
2445
2629
  removeTooltips: removeTooltips,
2630
+ getTooltips: function() {
2631
+ return scope_Tooltips;
2632
+ },
2633
+ getOrigins: function() {
2634
+ return scope_Handles;
2635
+ },
2446
2636
  pips: pips // Issue #594
2447
2637
  };
2448
2638
 
@@ -2474,6 +2664,9 @@
2474
2664
  // Exposed for unit testing, don't use this in your application.
2475
2665
  __spectrum: Spectrum,
2476
2666
  version: VERSION,
2667
+ // A reference to the default classes, allows global changes.
2668
+ // Use the cssClasses option for changes to one slider.
2669
+ cssClasses: cssClasses,
2477
2670
  create: initialize
2478
2671
  };
2479
2672
  });