(e: MouseEvent)
| 26 | }; |
| 27 | |
| 28 | const handleDrag = (e: MouseEvent) => { |
| 29 | if (previousDragPosition.current == null) { |
| 30 | return; |
| 31 | } |
| 32 | |
| 33 | e.preventDefault(); |
| 34 | |
| 35 | let offset = 0; |
| 36 | if (isHorizontal) { |
| 37 | offset = e.clientX - previousDragPosition.current.x; |
| 38 | } else { |
| 39 | offset = e.clientY - previousDragPosition.current.y; |
| 40 | } |
| 41 | let newValue = dimension - offset; |
| 42 | if (minimumSize != null) { |
| 43 | newValue = Math.max(minimumSize, newValue); |
| 44 | } |
| 45 | if (maximumSize != null) { |
| 46 | newValue = Math.min(maximumSize, newValue); |
| 47 | } |
| 48 | setDimension(newValue); |
| 49 | previousDragPosition.current = { |
| 50 | x: e.clientX, |
| 51 | y: e.clientY, |
| 52 | }; |
| 53 | }; |
| 54 | |
| 55 | const handleDragEnd = () => { |
| 56 | previousDragPosition.current = null; |
nothing calls this directly
no outgoing calls
no test coverage detected