(moveEvent: MouseEvent)
| 445 | const minHeight = convertRemToPixels(3.5) |
| 446 | const minWidth = convertRemToPixels(12) |
| 447 | const runDrag = (moveEvent: MouseEvent) => { |
| 448 | moveEvent.preventDefault() |
| 449 | |
| 450 | if (position() === 'left' || position() === 'right') { |
| 451 | const valToAdd = |
| 452 | position() === 'right' |
| 453 | ? startX - moveEvent.clientX |
| 454 | : moveEvent.clientX - startX |
| 455 | newSize = Math.round(width + valToAdd) |
| 456 | if (newSize < minWidth) { |
| 457 | newSize = minWidth |
| 458 | } |
| 459 | props.setLocalStore('width', String(Math.round(newSize))) |
| 460 | |
| 461 | const newWidth = panelElement.getBoundingClientRect().width |
| 462 | // If the panel size didn't decrease, this means we have reached the minimum width |
| 463 | // of the panel so we restore the original width in local storage |
| 464 | // Restoring the width helps in smooth open/close transitions |
| 465 | if (Number(props.localStore.width) < newWidth) { |
| 466 | props.setLocalStore('width', String(newWidth)) |
| 467 | } |
| 468 | } else { |
| 469 | const valToAdd = |
| 470 | position() === 'bottom' |
| 471 | ? startY - moveEvent.clientY |
| 472 | : moveEvent.clientY - startY |
| 473 | newSize = Math.round(height + valToAdd) |
| 474 | // If the panel size is less than the minimum height, |
| 475 | // we set the size to the minimum height |
| 476 | if (newSize < minHeight) { |
| 477 | newSize = minHeight |
| 478 | setSelectedQueryHash(null) |
| 479 | } |
| 480 | props.setLocalStore('height', String(Math.round(newSize))) |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | const unsubscribe = () => { |
| 485 | if (isResizing()) { |
nothing calls this directly
no outgoing calls
no test coverage detected