Calendar widget content does not scale with size — text becomes unreadable when calendar is enlarged #76
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#76
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?
Bug
When the calendar widget is resized to a larger size, the text content (day names, date numbers, times, header title, view-mode badge) does not scale with the calendar dimensions. Cells (
cellW,cellH) grow proportionally withwidth/height, but font sizes and chrome elements stay fixed, so the content looks tiny inside the enlarged cells and is hard to read.Reproduction
Reproducible in all three view modes (
month,week,day).Root cause
In
crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.jseverything in the chrome and content uses hardcoded pixel values:headerH = 36(fixed header bar)fontSize: 13, badgefontSize: 9, nav arrowsfontSize: 14fontSize: 10, date numberfontSize: 11, today circleradius: 13fontSize: 10, time labelfontSize: 9fontSize: 108,16) are fixedMeanwhile cell sizes are computed from
width/height:Result: text/cells diverge as the widget grows.
Expected behavior
Text, header height, paddings, and decorative elements (today indicator, current-time marker) should scale with the calendar size so the widget remains readable at any reasonable size, similar to how the other Konva widgets (kanban, mindmap) handle their resize.
A simple approach: derive a scale factor from
width/heightagainst the default 420×340 baseline (clamped to a sensible range, e.g.[0.85, 3.0]) and multiply font sizes, header height, today-circle radius, and inner paddings by that factor. Theredrawpath is already wired up viaproperties.js,tools.js, andobjects.js(resize listeners), so only therenderCalendar/renderMonthView/renderWeekView/renderDayViewfunctions need to become size-aware.Affected file
crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.jsAcceptance criteria
getMinSize()minimums) still look correct — no clipped text or overlapping rows.month,week,day) get the same treatment.Implementation Spec for Issue #76
Objective
Make the calendar widget's content (text, header, decorative elements, paddings) scale with its width/height so it stays readable when resized larger or smaller from the default 420x340 baseline.
Requirements
month,week,day) get the same treatment.getMinSize()minimums) still render correctly.Files to Modify
crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.js- introduce a scale factor and apply it acrossrenderCalendar/renderMonthView/renderWeekView/renderDayView.Implementation Plan
Step 1: Add a scale factor and apply it across all renderers
Files:
crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.jsDerive a uniform scale factor inside
renderCalendar(group, width, height):Apply
scaleto the following currently-hardcoded values:renderCalendar(header chrome):headerH:36 * scalefontSize: 13 * scale, vertical y offset scales toofontSize: 9 * scale, x/y offsets scalefontSize: 14 * scale, x/y offsets scalewidth: max(32, 40 * scale),height: headerHcontentY = headerH + 4):4 * scalecontentH = height - headerH - 8):8 * scalerenderMonthView:8->8 * scale(also affectscellW = (width - 16*scale) / 7)fontSize: 10->10 * scalecellHfloor changes fromMath.max(14, ...)toMath.max(14 * scale, ...)fontSize: 11->11 * scaletextYvertical-center math uses the scaled font heightradius: 13 * scalerenderWeekView:timeW: 40 * scale16->16 * scalefontSize: 10->10 * scalehourHfloor:Math.max(10 * scale, contentH / 12)fontSize: 9->9 * scalerenderDayView:timeW: 50 * scalehourHfloor:Math.max(10 * scale, contentH / 14)fontSize: 10->10 * scaleradius: 4 * scale, linestrokeWidth: 1.5 * scaleDependencies: none.
Acceptance Criteria
getMinSize()(month 280x260, week 320x220, day 200x280), no text overlaps and rows still fit.month,week,day) get the same scaling treatment.Notes
[0.85, 3.0]so calendars below default size still look readable (nothing tiny) and very large calendars don't get absurdly huge text.Math.min(width/BASE_W, height/BASE_H)so neither axis overflows the layout.cargo test --workspace --libshould still pass since this only touches a static asset.Test Results
cargo test --workspace --lib: 4 lib targets ran (hero_whiteboard_app, hero_whiteboard_examples, hero_whiteboard_sdk, hero_whiteboard_ui), 0 tests / 0 passed / 0 failed each (no Rust unit tests for these crates).cargo clippy --workspace -- -D warnings: clean (no warnings).cargo check --workspace: clean.node --check calendar.js: parses cleanly.Note: the change only touches a static JS asset (
crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.js); there are no JS unit tests in the repo and no Rust code paths changed. Visual verification by resizing a calendar in the running UI is the recommended manual check.Implementation Summary
Changes
crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.js(+70 / -47 lines)renderCalendar:scale = clamp(min(width/420, height/340), 0.85, 3.0).scale. Nav hit-rect width is floored at 32 px so it stays clickable when scale < 1.renderMonthView,renderWeekView,renderDayViewacceptscaleand apply it to font sizes, paddings, time-gutter widths, hour-row floor, today-circle radius, and the now-marker line / dot.Verification
cargo test --workspace --libpasses (4 lib targets, 0 tests).cargo clippy --workspace -- -D warningsclean.node --check calendar.jsparses cleanly.Notes / caveats
[0.85, 3.0]keeps the original look at default 420x340 (scale=1) and prevents both tiny-text-at-min-size and absurd-text-at-very-large-size.getMinSize().