dragbar 1.0.1 → 1.0.2
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/README.md +9 -1
- package/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,14 @@ parameters:
|
|
|
37
37
|
options: {
|
|
38
38
|
id: string,
|
|
39
39
|
style: Object,
|
|
40
|
-
reflow: [[el, ratio]]
|
|
40
|
+
reflow: [[el: Element, ratio: Number]]
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
id is the id of the dragbar element. Will default to "dragbar" if none provided.
|
|
44
|
+
|
|
45
|
+
style is to override the default styles of the dragbar with your own. Supply a js style object.
|
|
46
|
+
|
|
47
|
+
reflow is to manage the reflow of any elements that get resized as a result of the dragbar. You provide a list of elements and ratios, and for each one, whenever the dragbar position updates, the element will flip its flex-direction between column and row depending on the aspect ratio of the element compared to the ratio provided.
|
|
48
|
+
|
|
49
|
+
For example: If the ratio provided is 2, then when width >= 2*height, flex-direction will be row, and when width < 2*height, flex-direction will be column.
|
|
42
50
|
```
|
package/index.js
CHANGED
|
@@ -57,7 +57,7 @@ function dragBar (id, reverse, style = {}, reflow = []) {
|
|
|
57
57
|
localStorage.setItem(id + 'DragbarWidth', container.offsetWidth/2);
|
|
58
58
|
}
|
|
59
59
|
prev.style.width = localStorage.getItem(id + 'DragbarWidth') + "px";
|
|
60
|
-
reflow.forEach(a => reflowBox(a[0], a[1]));
|
|
60
|
+
reflow.forEach(a => {a[0].style.display="flex";reflowBox(a[0], a[1]);});
|
|
61
61
|
dragbar.addEventListener('pointerdown', function (e) {
|
|
62
62
|
if (Boolean(e.buttons & (1 << 0))) {
|
|
63
63
|
isDragging = true;
|
|
@@ -132,7 +132,7 @@ function colDragbar (id, reverse, style={}, reflow = []) {
|
|
|
132
132
|
localStorage.setItem(id + 'DragbarHeight', container.offsetHeight/2);
|
|
133
133
|
}
|
|
134
134
|
prev.style.height = localStorage.getItem(id + 'DragbarHeight') + "px";
|
|
135
|
-
reflow.forEach(a => reflowBox(a[0], a[1]
|
|
135
|
+
reflow.forEach(a => {a[0].style.display="flex";reflowBox(a[0], a[1]);});
|
|
136
136
|
dragbar.addEventListener('pointerdown', function (e) {
|
|
137
137
|
if (Boolean(e.buttons & (1 << 0))) {
|
|
138
138
|
isDragging = true;
|