fix(calendar): live-redraw during resize and view-aware minimums #24

Merged
AhmedHanafy725 merged 1 commit from development_calendar_resize_glitches into development 2026-04-21 11:36:50 +00:00
Member

Summary

Fixes the two calendar resize glitches reported in issue #18: aspect-ratio distortion during the drag (children visibly stretched until release), and broken renders at odd aspect ratios (rows collapsing on top of each other).

Closes #18

Changes

  • crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.js
    • Added getMinSize(viewMode) returning per-view minimums (month 280x260, week 320x220, day 200x280) and exported it from the module.
    • Defensive floors so rows never collapse: cellH = Math.max(14, (contentH - 20) / 6) in the month view; hourH = Math.max(10, ...) in the week and day views.
  • crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.js
    • applyTransform calendar branch now clamps to WhiteboardCalendar.getMinSize(node._calState.viewMode) instead of the hardcoded 240x200.
  • crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.js
    • Added a transformer.on('transform', ...) handler that, for calendar nodes, applies the live scale to the bg, clamps to the view-aware minimum, resets the group scale to 1, and calls WhiteboardCalendar.redraw(node) on every tick. Scoped to calendars only so other types stay cheap.

Test Results

  • cargo check --workspace: pass
  • cargo clippy --workspace -- -D warnings: pass
  • cargo fmt --check: pass
  • cargo test --workspace --lib: 0 passed / 0 failed (workspace has no Rust unit tests)

Changes are entirely vanilla JS; UI behavior needs manual verification in the browser.

Manual verification

  • Dragging any resize anchor on a calendar: grid redraws live, no stretched cells, no snap on release.
  • Calendar cannot shrink below the view-aware minimum for its current view.
  • Switching view in the properties panel then resizing uses the new view's minimums.
  • Month grid at the minimum size shows all six possible week rows without overlap; week/day views show their hour rows without overlap.
  • Nav arrows, Prev/Today/Next buttons, double-click view cycling, undo/redo, and multi-user sync still work.
  • No regression in resizing of other object types.
## Summary Fixes the two calendar resize glitches reported in issue #18: aspect-ratio distortion during the drag (children visibly stretched until release), and broken renders at odd aspect ratios (rows collapsing on top of each other). ## Related Issue Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/18 ## Changes - `crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.js` - Added `getMinSize(viewMode)` returning per-view minimums (month 280x260, week 320x220, day 200x280) and exported it from the module. - Defensive floors so rows never collapse: `cellH = Math.max(14, (contentH - 20) / 6)` in the month view; `hourH = Math.max(10, ...)` in the week and day views. - `crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.js` - `applyTransform` calendar branch now clamps to `WhiteboardCalendar.getMinSize(node._calState.viewMode)` instead of the hardcoded 240x200. - `crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.js` - Added a `transformer.on('transform', ...)` handler that, for calendar nodes, applies the live scale to the bg, clamps to the view-aware minimum, resets the group scale to 1, and calls `WhiteboardCalendar.redraw(node)` on every tick. Scoped to calendars only so other types stay cheap. ## Test Results - `cargo check --workspace`: pass - `cargo clippy --workspace -- -D warnings`: pass - `cargo fmt --check`: pass - `cargo test --workspace --lib`: 0 passed / 0 failed (workspace has no Rust unit tests) Changes are entirely vanilla JS; UI behavior needs manual verification in the browser. ## Manual verification - [ ] Dragging any resize anchor on a calendar: grid redraws live, no stretched cells, no snap on release. - [ ] Calendar cannot shrink below the view-aware minimum for its current view. - [ ] Switching view in the properties panel then resizing uses the new view's minimums. - [ ] Month grid at the minimum size shows all six possible week rows without overlap; week/day views show their hour rows without overlap. - [ ] Nav arrows, Prev/Today/Next buttons, double-click view cycling, undo/redo, and multi-user sync still work. - [ ] No regression in resizing of other object types.
fix(calendar): live-redraw during resize and view-aware minimums
All checks were successful
CI / build (pull_request) Successful in 2m18s
9bc0641173
Fixes two visible resize glitches on the calendar widget:

- Children no longer look stretched mid-drag. A transformer 'transform'
  handler now applies the live scale to bg, clamps to per-view minimums,
  resets group scale to 1, and redraws the calendar children every tick.
- Per-view minimum sizes prevent broken renders at odd aspect ratios
  (month 280x260, week 320x220, day 200x280), exposed via a new
  WhiteboardCalendar.getMinSize helper and consumed by both the live
  transform handler and the existing applyTransform release path.
- Defensive Math.max floors on cellH and hourH keep rows from collapsing
  even if a legacy persisted bg lands under the minimum.

#18
AhmedHanafy725 merged commit 9eec495ce9 into development 2026-04-21 11:36:50 +00:00
AhmedHanafy725 deleted branch development_calendar_resize_glitches 2026-04-21 11:36:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_whiteboard!24
No description provided.