From e56e29fd643488a529bcb992ebc68702a513f4d6 Mon Sep 17 00:00:00 2001 From: Nathan Cahill Date: Tue, 7 Jul 2020 10:56:14 +0200 Subject: [PATCH] add sizes to onDrag --- packages/splitjs/README.md | 2 +- packages/splitjs/src/split.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/splitjs/README.md b/packages/splitjs/README.md index 1e38ae2d3..bd32b4b8e 100644 --- a/packages/splitjs/README.md +++ b/packages/splitjs/README.md @@ -305,7 +305,7 @@ Both `elementStyle` and `gutterStyle` are called continously while dragging, so Callbacks that can be added on drag (fired continously), drag start and drag end. If doing more than basic operations in `onDrag`, add a debounce function to rate limit the callback. -`onDragStart` and `onDragEnd` are passed the initial and final sizes of the split since it's a common pattern to access the sizes this way. +`onDrag`, `onDragStart` and `onDragEnd` are passed the initial and final sizes of the split since it's a common pattern to access the sizes this way. Their function signature looks like this, where `sizes` is an array of percentage values like returned by `getSizes()`: diff --git a/packages/splitjs/src/split.js b/packages/splitjs/src/split.js index c0b51795b..6b7182963 100644 --- a/packages/splitjs/src/split.js +++ b/packages/splitjs/src/split.js @@ -309,7 +309,7 @@ const Split = (idsOption, options = {}) => { // Call the drag callback continously. Don't do anything too intensive // in this callback. - getOption(options, 'onDrag', NOOP)() + getOption(options, 'onDrag', NOOP)(getSizes()) } // Cache some important sizes when drag starts, so we don't have to do that