mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	add sizes to onDrag
This commit is contained in:
		@@ -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()`:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user