Adjustable divider #35
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
gtfs.zone/coloring-book#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add a continuous drag-to-resize handle between the map and the right sidebar. A thin draggable bar sits on the left edge of the right panel; users can drag it to resize freely between 300px and 900px. Width is not persisted — it resets to the 650px default on page reload. The implementation swaps the hardcoded
650pxgrid column for a CSS custom property (--panel-width) and introduces a small newPanelResizermodule (~50 lines) that owns all mouse event handling.Relevant Context
src/index.html:38—.app-containerhasgrid-cols-[1fr_650px]; that class gets removed in favour of a CSS rule using--panel-widthsrc/index.html:383—.right-paneldiv; needsrelativeadded; resizer handle is its first childsrc/styles/main.css— add one rule:.app-container { grid-template-columns: 1fr var(--panel-width, 650px); }src/modules/map-controller.ts:623—forceMapResize()debounces 350ms (designed for panel toggle); we'll also add aresizeNow()method for calling during live dragsrc/index.ts— GTFSEditor constructor; new module instantiated here (no class property needed)Phase 1: CSS Foundation
Replace the hardcoded 650px grid column with a CSS variable. The variable default preserves the current layout exactly — no visible change until JS touches it.
src/styles/main.css, add:src/index.html:38, removegrid-cols-[1fr_650px]from.app-container(the CSS rule above takes over)src/index.html:383, addrelativeto.right-panelclass list (required for the absolutely-positioned resizer child)No gotchas — the CSS variable default (650px) is identical to the removed Tailwind class.
Phase 2: Resizer Element + Module + Wiring
Add the drag handle to HTML, implement
PanelResizer, exposeresizeNow()onMapController, and wire everything intoGTFSEditor.In
src/index.html, add resizer div as the first child of.right-panel:The 8px hit area (
w-2) overlaps the existingborder-lvisually; the innerw-pxdiv provides the visible highlight on hover.Add
public resizeNow(): void { this.map?.resize(); }toMapController(after theforceMapResizemethod is fine)Create
src/modules/panel-resizer.ts:In
src/index.ts, import and instantiatePanelResizerin theGTFSEditorconstructor aftermapControlleris set up:No need to store as a class property — the module registers its own listeners.
Gotchas:
document.body.style.userSelect = 'none'during drag prevents the browser from selecting text across the rest of the UI as the mouse movesmapController.resizeNow()callsmap.resize()directly on everymousemove— this is safe for Mapbox GL JS and gives a live update of map tiles as the panel resizesgetComputedStyle(...).getPropertyValue('--panel-width')returns an empty string if unset (first drag), so the|| DEFAULT_WIDTHfallback is neededoverflow-hiddenon.right-panelclips children, but since the resizer usesabsolutepositioning it works fine within the panel bounds — it just won't bleed outsideOriginal Issue
It should be possible to expand or collapse the sidebar and map. Should it be discrete steps or continuous?