pull/2370/head
Cory LaViska 2025-02-03 16:14:40 -05:00
rodzic a7aadc93f9
commit bb8f16a2df
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -283,7 +283,8 @@ Or, if you want to snap the panel to every `100px` interval, as well as at 50% o
You can also implement a custom snap function which controls the snapping manually. To do this, you need to acquire a reference to the element in Javascript and set the `snap` property. For example, if you want to snap the divider to either `100px` from the left or `100px` from the right, you can set the `snap` property to a function encoding that logic.
```js
panel.snap = ({ pos, size }) => (pos < size / 2) ? 100 : (size - 100)
panel.snap = ({ pos, size }) => (pos < size / 2 ? 100 : size - 100);
```
Note that the `snap-threshold` property will not automatically be applied if `snap` is set to a function. Instead, the function itself must handle applying the threshold if desired, and is passed a `snapThreshold` member with its parameters.