mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
test: keep the bringer and panel width changes within the lint and RTL ratchets
The bringer tests read their items through a small type instead of any, the panel hook names its two ceilings after the panels rather than the sides, and the stored-width test runs on a window wide enough for the map's share.
This commit is contained in:
@@ -82,15 +82,15 @@ export function useResizablePanels() {
|
||||
const shownRight = clampWidth(rightWidth, resizeMaxRight)
|
||||
const resizeMaxLeft = Math.max(MIN_SIDEBAR, room - (rightHidden ? 0 : shownRight))
|
||||
// The drag listeners are bound once, so they read the live ceilings from here.
|
||||
const maxRef = useRef({ left: resizeMaxLeft, right: resizeMaxRight })
|
||||
useEffect(() => { maxRef.current = { left: resizeMaxLeft, right: resizeMaxRight } }, [resizeMaxLeft, resizeMaxRight])
|
||||
const maxRef = useRef({ dayPlan: resizeMaxLeft, places: resizeMaxRight })
|
||||
useEffect(() => { maxRef.current = { dayPlan: resizeMaxLeft, places: resizeMaxRight } }, [resizeMaxLeft, resizeMaxRight])
|
||||
|
||||
// A mouse drags through mousemove; a finger on a tablet sends touch events and
|
||||
// never a mousemove, which is why the handles used to be dead on an iPad (#1012).
|
||||
useEffect(() => {
|
||||
const moveTo = (clientX: number) => {
|
||||
if (isResizingLeft.current) setLeftWidth(remember('sidebarLeftWidth', clampWidth(clientX - 10, maxRef.current.left)))
|
||||
if (isResizingRight.current) setRightWidth(remember('sidebarRightWidth', clampWidth(window.innerWidth - clientX - 10, maxRef.current.right)))
|
||||
if (isResizingLeft.current) setLeftWidth(remember('sidebarLeftWidth', clampWidth(clientX - 10, maxRef.current.dayPlan)))
|
||||
if (isResizingRight.current) setRightWidth(remember('sidebarRightWidth', clampWidth(window.innerWidth - clientX - 10, maxRef.current.places)))
|
||||
}
|
||||
const onMove = (e: MouseEvent) => moveTo(e.clientX)
|
||||
const onTouchMove = (e: TouchEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user