@pageboard/html 0.10.16 → 0.10.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/nouislider.js +20 -6
- package/package.json +1 -1
- package/ui/menu.css +6 -3
- package/ui/menu.js +1 -1
package/lib/nouislider.js
CHANGED
|
@@ -714,6 +714,7 @@
|
|
|
714
714
|
var hover = entry.indexOf("hover") >= 0;
|
|
715
715
|
var unconstrained = entry.indexOf("unconstrained") >= 0;
|
|
716
716
|
var dragAll = entry.indexOf("drag-all") >= 0;
|
|
717
|
+
var smoothSteps = entry.indexOf("smooth-steps") >= 0;
|
|
717
718
|
if (fixed) {
|
|
718
719
|
if (parsed.handles !== 2) {
|
|
719
720
|
throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");
|
|
@@ -728,6 +729,7 @@
|
|
|
728
729
|
tap: tap || snap,
|
|
729
730
|
drag: drag,
|
|
730
731
|
dragAll: dragAll,
|
|
732
|
+
smoothSteps: smoothSteps,
|
|
731
733
|
fixed: fixed,
|
|
732
734
|
snap: snap,
|
|
733
735
|
hover: hover,
|
|
@@ -1472,6 +1474,14 @@
|
|
|
1472
1474
|
scope_Body.removeEventListener("selectstart", preventDefault);
|
|
1473
1475
|
}
|
|
1474
1476
|
}
|
|
1477
|
+
if (options.events.smoothSteps) {
|
|
1478
|
+
data.handleNumbers.forEach(function (handleNumber) {
|
|
1479
|
+
setHandle(handleNumber, scope_Locations[handleNumber], true, true, false, false);
|
|
1480
|
+
});
|
|
1481
|
+
data.handleNumbers.forEach(function (handleNumber) {
|
|
1482
|
+
fireEvent("update", handleNumber);
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1475
1485
|
data.handleNumbers.forEach(function (handleNumber) {
|
|
1476
1486
|
fireEvent("change", handleNumber);
|
|
1477
1487
|
fireEvent("set", handleNumber);
|
|
@@ -1771,7 +1781,7 @@
|
|
|
1771
1781
|
});
|
|
1772
1782
|
}
|
|
1773
1783
|
// Split out the handle positioning logic so the Move event can use it, too
|
|
1774
|
-
function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue) {
|
|
1784
|
+
function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue, smoothSteps) {
|
|
1775
1785
|
var distance;
|
|
1776
1786
|
// For sliders with multiple handles, limit movement to the other handle.
|
|
1777
1787
|
// Apply the margin option by adding it to the handle positions.
|
|
@@ -1810,7 +1820,9 @@
|
|
|
1810
1820
|
to = Math.min(to, distance);
|
|
1811
1821
|
}
|
|
1812
1822
|
}
|
|
1813
|
-
|
|
1823
|
+
if (!smoothSteps) {
|
|
1824
|
+
to = scope_Spectrum.getStep(to);
|
|
1825
|
+
}
|
|
1814
1826
|
// Limit percentage to the 0 - 100 range
|
|
1815
1827
|
to = limit(to);
|
|
1816
1828
|
// Return false if handle can't move
|
|
@@ -1830,6 +1842,7 @@
|
|
|
1830
1842
|
var proposals = locations.slice();
|
|
1831
1843
|
// Store first handle now, so we still have it in case handleNumbers is reversed
|
|
1832
1844
|
var firstHandle = handleNumbers[0];
|
|
1845
|
+
var smoothSteps = options.events.smoothSteps;
|
|
1833
1846
|
var b = [!upward, upward];
|
|
1834
1847
|
var f = [upward, !upward];
|
|
1835
1848
|
// Copy handleNumbers so we don't change the dataset
|
|
@@ -1842,7 +1855,7 @@
|
|
|
1842
1855
|
// Step 1: get the maximum percentage that any of the handles can move
|
|
1843
1856
|
if (handleNumbers.length > 1) {
|
|
1844
1857
|
handleNumbers.forEach(function (handleNumber, o) {
|
|
1845
|
-
var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false);
|
|
1858
|
+
var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false, smoothSteps);
|
|
1846
1859
|
// Stop if one of the handles can't move.
|
|
1847
1860
|
if (to === false) {
|
|
1848
1861
|
proposal = 0;
|
|
@@ -1860,7 +1873,8 @@
|
|
|
1860
1873
|
var state = false;
|
|
1861
1874
|
// Step 2: Try to set the handles with the found percentage
|
|
1862
1875
|
handleNumbers.forEach(function (handleNumber, o) {
|
|
1863
|
-
state =
|
|
1876
|
+
state =
|
|
1877
|
+
setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o], false, smoothSteps) || state;
|
|
1864
1878
|
});
|
|
1865
1879
|
// Step 3: If a handle moved, fire events
|
|
1866
1880
|
if (state) {
|
|
@@ -1905,9 +1919,9 @@
|
|
|
1905
1919
|
}
|
|
1906
1920
|
// Test suggested values and apply margin, step.
|
|
1907
1921
|
// if exactInput is true, don't run checkHandlePosition, then the handle can be placed in between steps (#436)
|
|
1908
|
-
function setHandle(handleNumber, to, lookBackward, lookForward, exactInput) {
|
|
1922
|
+
function setHandle(handleNumber, to, lookBackward, lookForward, exactInput, smoothSteps) {
|
|
1909
1923
|
if (!exactInput) {
|
|
1910
|
-
to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false);
|
|
1924
|
+
to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false, smoothSteps);
|
|
1911
1925
|
}
|
|
1912
1926
|
if (to === false) {
|
|
1913
1927
|
return false;
|
package/package.json
CHANGED
package/ui/menu.css
CHANGED
|
@@ -45,14 +45,17 @@
|
|
|
45
45
|
display: flex;
|
|
46
46
|
flex-direction: column;
|
|
47
47
|
}
|
|
48
|
+
.right.burger .popup.item > .placer {
|
|
49
|
+
left: auto;
|
|
50
|
+
right:0;
|
|
51
|
+
}
|
|
48
52
|
.right.popup.item > .placer > div {
|
|
49
53
|
left:auto;
|
|
50
54
|
right:0;
|
|
51
55
|
}
|
|
52
56
|
.fixed.popup.item > .placer > div {
|
|
53
|
-
|
|
54
|
-
max-
|
|
55
|
-
max-height: 100%;
|
|
57
|
+
max-width: 100vw;
|
|
58
|
+
max-height: 100vh;
|
|
56
59
|
}
|
|
57
60
|
.center.popup.item > .placer > div {
|
|
58
61
|
transform: translateX(-50%);
|
package/ui/menu.js
CHANGED
|
@@ -57,7 +57,7 @@ class HTMLElementMenu extends VirtualHTMLElement {
|
|
|
57
57
|
} else {
|
|
58
58
|
const padding = this.offsetTop + this.offsetHeight;
|
|
59
59
|
const menu = tosser.lastElementChild.lastElementChild;
|
|
60
|
-
menu.style.maxHeight = `calc(
|
|
60
|
+
menu.style.maxHeight = `calc(100vh - ${padding}px)`;
|
|
61
61
|
}
|
|
62
62
|
} else if (item) {
|
|
63
63
|
this.active = item != this.active ? item : null;
|