Commit Graph
100 Commits
Author SHA1 Message Date
Hiren Kangad e118ad632a feat: block rotate/flip for pdf-page in context menu and shortcuts 2026-03-14 11:22:29 +05:30
Hiren Kangad 07953ab18d feat: SceneManager creates pdf-page items with culling support 2026-03-14 11:21:08 +05:30
Hiren Kangad 332f12cafe feat: add PdfPageSprite — placeholder, lazy texture, page badge 2026-03-14 11:19:55 +05:30
Hiren Kangad 3511c54658 feat: add PdfPageObject type to scene format 2026-03-14 11:19:04 +05:30
Hiren Kangad 247145f545 fix: early PDF validation, type-aware errors, exact job dedup
- Move PDF page count check before MinIO upload and DB record creation
  to prevent orphaned objects when >500 page PDFs are rejected
- Use job type label (PDF page / Video) in media-worker error messages
  instead of hardcoded "Video processing failed"
- Replace LIKE-based idempotency check with exact JSON match to prevent
  page 1 matching page 11/12/etc substring collisions
2026-03-14 11:16:58 +05:30
Hiren Kangad 4b68e337cf feat: media worker dispatches pdf-thumbnail and pdf-hires jobs 2026-03-14 11:12:41 +05:30
Hiren Kangad 1250ad1b72 feat: add PDF page selection and lazy thumbnail endpoints 2026-03-14 11:11:50 +05:30
Hiren Kangad 0b56ec7f6f feat: accept PDF uploads — pdfinfo extraction, pdf_pages rows, thumbnail job queuing 2026-03-14 11:10:45 +05:30
Hiren Kangad d28998e4d7 feat: add pdf-utils.js — pdfInfo, pdfRenderPage, bufferToTempFile 2026-03-14 11:10:01 +05:30
Hiren Kangad e1aedd721b feat(db): add pdf_pages table, priority column, and helper functions 2026-03-14 11:08:45 +05:30
Hiren Kangad 0e14790990 build: add poppler-utils to Dockerfile for PDF support 2026-03-14 11:07:03 +05:30
Hiren Kangad a901833b72 fix: rotated transform box, video texture crash, paste duplication, and loading UX
- TransformBox rotates with single-item selection (Figma-style), with
  handles and resize math projected into rotated coordinate space
- Fix VideoSprite alphaMode crash by swapping texture to EMPTY before
  destroying, preventing PixiJS render loop from reading null source
- Fix Ctrl+V double-paste: internal clipboard now always takes priority
  over system clipboard PNG, with wasRecentInternalPaste() guard
- Add asset loading progress bar and suppress "Drop images here" flash
  during initial scene load
2026-03-13 17:37:21 +05:30
Hiren Kangad e7e217d3d4 fix: restrict rotation to image/video selections only
Hide rotate handles and block rotation drag for sticky, markdown,
text, drawing, and group item types. Only images and videos support
rotation.
2026-03-13 17:07:26 +05:30
Hiren Kangad 05118330d6 feat: unified composition renderer for clipboard/export
Replace the split snapshot/native renderer paths with a single
composition pipeline (compositionRenderer.ts) that:

- Loads actual source images and uses naturalWidth/Height for
  correct full-resolution sampling (fixes top-left-corner-only bug
  caused by data.w/h being capped to 600px display dimensions)
- Routes image-only selections through native Canvas 2D composition
- Falls back to viewport snapshot for mixed/unsupported selections
  with explicit warnings instead of silent degradation
- Resolves group children via itemResolver for proper group export
- Rejects group children from native composition (local coords
  incompatible with world-space drawing)
- Adds canvas size safety limits with auto-downscale
- Guards VideoSprite._drawFrame against null texture source race
  condition during zoom-triggered culling

New files:
- compositionRenderer.ts — unified composition module
- compositionRenderer.test.ts — 16 tests for entry flattening,
  bounds, dimensions, group handling

Modified:
- clipboard.ts — uses composeSelection() instead of direct renderers
- export.ts — uses composeSelection() + getCompositionDimensions()
- Editor.tsx, useShortcutHandler.ts — pass scene for group resolution
- VideoSprite.ts — null guard on texture source in frame loop
2026-03-13 16:59:11 +05:30
Hiren Kangad 1ceafec67f refboard: fix native export pixel bounds rounding 2026-03-13 15:51:12 +05:30
Hiren Kangad 7b2fcfd6a8 refboard: add native image copy and export renderer 2026-03-13 15:48:12 +05:30
Hiren Kangad ae9b1ecefe refboard: avoid eager extract fallback for canvas snapshots 2026-03-13 15:36:12 +05:30
Hiren Kangad 80ec4808e8 refboard: await clipboard writes before copy success 2026-03-13 15:33:37 +05:30
Hiren Kangad 3dd110f491 refboard: restore clipboard copy and native paste flows 2026-03-13 15:30:23 +05:30
Hiren Kangad e9e0c25491 refboard: standardize clipboard copy on rendered canvas 2026-03-13 15:27:41 +05:30
Hiren Kangad cd8207e984 refboard: capture board previews from rendered canvas 2026-03-13 15:23:08 +05:30
Hiren Kangad c21a0c386d refboard: add corner rotation grips 2026-03-13 15:10:45 +05:30
Hiren Kangad 8d34d42377 refboard: preserve center when rotating items 2026-03-13 15:05:54 +05:30
Hiren Kangad 98fb7be77e refboard: add visible rotate controls 2026-03-13 15:01:25 +05:30
Hiren Kangad cb59fbb150 fix(crop): fix editor positioning for flipped images with asymmetric crops
The crop editor (getImageEditorGeometry) was anchoring on a view-space
point that maps differently in cropped vs uncropped local space when
flipped. For asymmetric crops + flip, the full image would appear
shifted from where the visible image was — the user saw the image
"jump" when entering crop mode.

Fix: anchor on the container's local origin instead. In the cropped
sprite, local (0,0) corresponds to source pixel (srcRect.x, srcRect.y).
Position the editor so that same source pixel maps to the same world
point in both cropped and uncropped states. This works correctly for
all flip/rotation/crop combinations.
2026-03-13 14:54:36 +05:30
Hiren Kangad 21a724c0f4 fix: address code review findings from crop/text commit
- Fix crop confirm anchor drift for rotated images by using crop corner
  world point instead of AABB min in useCanvasSetup.ts
- Document ungroup shear limitation for non-uniform scale + rotation
- Add 6 integration tests covering crop confirm and ungroup paths
2026-03-13 13:47:14 +05:30
Hiren Kangad 9a4edd90c7 refboard: complete image geometry rework — consumer adoption + tests
- Fix grouping.ts ungroup: transform display position (with flip
  compensation) through group transform, then back-calculate canonical
  data.x/y. Fixes visual jump for flipped images in rotated groups.
- Fix clipboard.ts + export.ts resolution estimation: account for
  scale when computing effective rendered width for texture ratio.
- Add imageTransforms.test.ts: 32 unit tests covering source rect,
  visible local rect, display transform, display geometry, editor
  geometry anchor preservation, crop rect round-trips, coordinate
  conversions, negative scale normalization, and world bounds invariants.
- Add vitest as dev dependency with "test" script.
- Include canonical geometry layer (imageTransforms.ts) and crop
  session rewrite (CropOverlay.ts) from prior work.
- Add image geometry rework plan document.
2026-03-13 13:37:42 +05:30
Hiren Kangad c874e34577 refboard: export cropped images from visible frame 2026-03-13 13:05:31 +05:30
Hiren Kangad 407fa82915 refboard: fix flipped image crop coordinate mapping 2026-03-13 13:03:37 +05:30
Hiren Kangad cd9db8816c refboard: cull images by visible bounds 2026-03-13 12:59:20 +05:30
Hiren Kangad dc283124d7 refboard: centralize image visible frame transforms 2026-03-13 12:58:29 +05:30
Hiren Kangad 768de39463 refboard: use full image geometry in crop mode 2026-03-13 12:50:13 +05:30
Hiren Kangad ddd395444d refboard: resize images from visible bounds 2026-03-13 12:46:48 +05:30
Hiren Kangad 50dbb4e0cf refboard: anchor crop apply to selected region 2026-03-13 12:42:16 +05:30
Hiren Kangad 267deefc10 refboard: preserve image position when applying crop 2026-03-13 12:39:24 +05:30
Hiren Kangad 18c968b54f refboard: fix cropped image offset transforms 2026-03-13 12:36:57 +05:30
Hiren Kangad 4dc338cdb6 refboard: rebase cropped image rendering to visible frame 2026-03-13 12:33:03 +05:30
Hiren Kangad f6a937f598 refboard: use visible bounds for image layout ops 2026-03-13 12:25:29 +05:30
Hiren Kangad 5c13def2d2 refboard: improve crop preview and cropped bounds focus 2026-03-13 12:15:22 +05:30
Hiren Kangad 4f8e3984b2 refboard: fix crop pointer coordinate mapping 2026-03-13 12:04:57 +05:30
Hiren Kangad c78325227f refboard: drive crop drag from DOM pointer events 2026-03-13 11:57:26 +05:30
Hiren Kangad 421ad176d4 refboard: align crop drag handling with transform box 2026-03-13 11:48:13 +05:30
Hiren Kangad e1b97d52f8 refboard: route crop drag events through viewport 2026-03-13 11:41:03 +05:30
Hiren Kangad 8e23c3e884 refboard: hide transform box during crop mode 2026-03-13 11:37:03 +05:30
Hiren Kangad f978153a83 fix: improve text sharpness on zoom with tighter buckets and reliable init
Fix text staying blurry on zoom by ensuring the first setZoomBucket call
always applies (PixiJS v8 defaults to auto-resolution which skipped the
initial bucket=1 assignment), listening on both 'moved' and 'zoomed'
viewport events, and tightening bucket thresholds from 6 to 9 levels.
2026-03-13 11:33:57 +05:30
Hiren Kangad 470693266e refboard: stabilize crop interaction bounds 2026-03-13 11:31:18 +05:30
Hiren Kangad accbe2e0f3 fix(markdown): polish editor UX — side panel, overlay sync, paste segregation
- Move markdown editor from canvas overlay to side panel (70% width)
  for better performance and editing experience
- Add @blocknote/mantine for full BlockNoteView with default UI components
- Fix socket reconnect loop caused by unstable pasteOpts object reference
  (memoize with useMemo)
- Add ResizeObserver to markdown overlay cards for automatic height sync
- Call mdOverlay.refreshAll() on every canvas change so overlays track
  pack/grid/arrange/save operations
- Paste goes to BlockNote editor when contentEditable is focused
- Simplify toolbar: single color picker (accent + auto-derived bg),
  title/name field, width presets S/M/L
- Guard normalize/flip operations to skip markdown and sticky items
- Fix title not updating on card preview (pass name prop, bump revision)
- Fix preview not refreshing after editor save (revision counter + overlay refresh)
2026-03-13 11:21:28 +05:30
Hiren Kangad a7579a9ff5 refboard: add manual board preview refresh button 2026-03-13 11:21:28 +05:30
Hiren Kangad b350951bf1 refboard: merge crop mode polish with markdown editor 2026-03-13 11:21:28 +05:30
Hiren Kangad 04d499b755 fix(markdown): address code review findings — updateItem, height measurement, CSS injection, paste fallback, resize sprite update 2026-03-13 11:21:28 +05:30
Hiren Kangad dfdfd07a1d feat(markdown): add contextual toolbar for background color, accent color, and width presets 2026-03-13 11:21:28 +05:30
Hiren Kangad aa3112a5bc feat(markdown): add paste detection with PasteChoicePopup for text/markdown/image
Simplify Ctrl+V shortcut to only handle recent internal copies, letting
native paste events flow to setupPaste for external clipboard content.
Extend setupPaste with text/HTML detection and popup callbacks. Wire
PasteChoicePopup in Editor.tsx with markdown (turndown HTML-to-MD),
plain text, and image paste choices.
2026-03-13 11:21:28 +05:30
Hiren Kangad 375e7adc4a feat(markdown): add PasteChoicePopup component for paste-as choice 2026-03-13 11:21:28 +05:30
Hiren Kangad 11fc3c6d8e feat(markdown): horizontal-only resize with ResizeConstraint enum in TransformBox 2026-03-13 11:21:28 +05:30
Hiren Kangad b1163c3232 feat(markdown): integrate undo/redo for edit mode and checkbox toggles 2026-03-13 11:21:28 +05:30
Hiren Kangad 6118193f19 feat(markdown): add MARKDOWN tool, toolbar button, and m/6 shortcuts 2026-03-13 11:21:28 +05:30
Hiren Kangad 2d5396ef09 feat(markdown): add double-click → edit mode via SelectionManager callback 2026-03-13 11:21:27 +05:30
Hiren Kangad 02597abc9d fix: suppress canvas shortcuts when contenteditable is focused (BlockNote) 2026-03-13 11:21:27 +05:30
Hiren Kangad 2cede1ae95 feat(markdown): add MarkdownEditView with lazy BlockNote editor + dark theme styles 2026-03-13 11:21:27 +05:30
Hiren Kangad 10135463b1 feat(markdown): wire MarkdownOverlay into canvas lifecycle with React portals 2026-03-13 11:21:27 +05:30
Hiren Kangad ced187bbd3 feat(markdown): add MarkdownReadView component with dark theme and checkbox toggling 2026-03-13 11:21:27 +05:30
Hiren Kangad 0d40b2b973 feat(markdown): add MarkdownOverlay DOM overlay manager 2026-03-13 11:21:27 +05:30
Hiren Kangad de527954da feat(markdown): add MarkdownSprite and register in SceneManager
Creates MarkdownSprite (Graphics-only background rect with header bar)
and wires it into SceneManager._createItem() under case 'markdown'.
2026-03-13 11:21:27 +05:30
Hiren Kangad f989a8111b feat(markdown): add markdownDefaults module with constants and extractTitle 2026-03-13 11:21:27 +05:30
Hiren Kangad 50c34a409f feat(markdown): add MarkdownObject type to scene format 2026-03-13 11:21:27 +05:30
Hiren Kangad cc38adb1d6 chore: add markdown block dependencies (react-markdown, blocknote, turndown) 2026-03-13 11:21:27 +05:30
Hiren Kangad dd1578110b refboard: support rotated image crop editing 2026-03-13 11:21:27 +05:30
Hiren Kangad 9502f89a06 refboard: tighten rotated image hit testing 2026-03-13 11:21:27 +05:30
Hiren Kangad 12410c0098 refboard: stabilize image flip and crop transforms 2026-03-13 11:21:27 +05:30
Hiren Kangad c40304464f chore: add .worktrees/ and .superpowers/ to .gitignore 2026-03-13 11:21:27 +05:30
Hiren Kangad 75a975447b chore: commit pending workspace changes 2026-03-13 08:43:44 +05:30
Hiren Kangad f77ac59e6c fix(sticky): make size presets absolute again 2026-03-13 00:50:21 +05:30
Hiren Kangad 9f69eae308 refine(sticky): reduce preset sizes and remove pan tool shortcuts 2026-03-13 00:46:37 +05:30
Hiren Kangad ce1cc60d67 fix(sticky): restore zoom-aware preset creation and live editing sync 2026-03-13 00:42:32 +05:30
Hiren Kangad 2d05226ddd fix(sticky): fixed-size creation, shared presets module, live resize sync
Fixes three review findings:

1. Sticky creation no longer zoom-adapts — always creates at M preset
   (28px/260w) in world space. Consistent at any zoom level.

2. Preset definitions extracted to stickyPresets.ts (shared domain module).
   TextFormatToolbar and tools.ts both import from there — no more
   canvas→component dependency inversion.

3. TextEditor.onLiveResize callback syncs spatial index and transform
   box as sticky background grows during typing.
2026-03-13 00:31:44 +05:30
Hiren Kangad 706b00cf35 feat(sticky): proportional card width per text size preset
Each S/M/L/XL/XXL preset now sets both fontSize and card width:
S(20px/200w), M(28px/260w), L(36px/320w), XL(48px/400w), XXL(60px/480w).

Creation picks preset based on zoom, toolbar toggle updates both.
Wider size toggle buttons for XL/XXL labels, font name maxWidth 110px.
Backward compatible — existing stickies keep original width.
2026-03-13 00:26:09 +05:30
Hiren Kangad b081ed7169 refactor(sticky): fixed-width card with S/M/L/XL/XXL font presets
Stickies are now fixed-width cards — no resize handles shown.
Text size controlled via 5 presets (10/14/18/24/32px).
On creation, zoom-aware screenToWorld snaps to nearest preset.
Height auto-adjusts from content. Plain text resize unchanged.

Removes: sticky width bake, live reflow drag, min width constraint.
Backward compatible — existing stickies map to nearest preset.
2026-03-13 00:18:41 +05:30
Hiren Kangad 1631185e4f feat(sticky): S/M/L text size toggle, live reflow resize, min width
Sticky UX overhaul — clear separation between card resize and text size:

- S/M/L toggle (12/14/18px) in contextual toolbar for sticky text size
- TransformBox: horizontal-only resize for stickies with live text
  reflow during drag (no more stretch-then-snap)
- Hide vertical handles (tc/bc) for sticky-only selections
- Minimum sticky width of 80px enforced in both drag and bake
- TextEditor: sticky background auto-resizes as user types
- textLimits.ts comment corrected to match actual usage

Plain text unchanged: resize gesture scales fontSize via bake.
Fully backward compatible — existing stickies map to nearest preset.
2026-03-13 00:12:23 +05:30
Hiren Kangad a20cab3fcd refactor: extract TextCore shared text engine + sticky width-only resize
TextCore.ts: shared text rendering with dirty-check caching, zoom-bucket
resolution, and optional word-wrap. TextSprite and StickySprite now
compose TextCore instead of duplicating text logic.

Sticky resize now bakes width only (fontSize stays stable), so dragging
a sticky wider/narrower reflows text with auto-adjusted height — like
a resizable text box.
2026-03-12 23:53:06 +05:30
Hiren Kangad d9c1f4c600 fix(sticky): bake scale into fontSize + width on sticky resize
Sticky text was blurry after scaling because sx/sy stretched the
texture without re-rasterizing. Now bakes fontSize and card width
on drag-end (same as plain text), so StickySprite recomputes layout
at native resolution.
2026-03-12 23:44:43 +05:30
Hiren Kangad eb4591dca0 fix: remove font-size clamp from resize-bake path
Direct manipulation (scaling text up/down) should respect user intent
without artificial caps. Clamps remain on creation defaults only.
2026-03-12 23:38:47 +05:30
Hiren Kangad 150bb91a27 refactor: centralize font-size clamps in textLimits.ts
Single source of truth for font-size constraints (text 6–160, sticky
8–96) used by creation defaults, resize-bake, and any future mutation
paths. Replaces scattered hardcoded min/max values.
2026-03-12 23:35:25 +05:30
Hiren Kangad 1ac727ea60 feat: zoom-bucket text sharpness + remove fontSize toolbar controls
Add TextSharpnessManager for crisp text rendering at all zoom levels:
- Discrete zoom buckets (0.5–3x) avoid texture churn on small zoom changes
- Initial bucket applied to all items on setup and newly created items
  via SceneManager.onItemCreated callback (fixes blurry-on-load)
- Visibility check uses getItemWorldBounds for correct grouped item coords
- TextSprite/StickySprite gain setZoomBucket() for resolution control

Remove fontSize +/- controls from contextual toolbar — font size is now
controlled purely through direct manipulation (resize → bake).
2026-03-12 23:23:30 +05:30
Hiren Kangad 9fac16e6a4 feat: contextual text formatting toolbar + resize fontSize baking
- Remove persistent font-size slider from main toolbar (tools only)
- Lock in zoom-aware creation defaults as named constants
- Split contextual toolbar by object type: text vs sticky
  - Text: fontSize + fontFamily + text color
  - Sticky: fontSize + fontFamily + text color + note fill color
  - Mixed selection: hide toolbar
- Bake scale into fontSize on text resize (reset sx/sy to 1)
- Sticky resize stays layout-driven (no font change)
2026-03-12 22:47:48 +05:30
Hiren Kangad 83e753bb69 perf: remove thumbnail generation from hot autosave path
extract.canvas(viewport) snapshots the entire viewport to a WebGL
texture on the main thread. When viewport dimensions × devicePixelRatio
exceed GPU limits, this causes texImage2D errors and ~1000ms stalls
that block focus, typing, and scroll. Thumbnails can be generated on
idle or server-side instead.
2026-03-12 22:24:59 +05:30
Hiren Kangad 93c7c792db fix(text): use requestAnimationFrame for editor open timing
queueMicrotask fires before the click event settles, causing the
textarea to blur immediately and trigger empty-text cleanup.
requestAnimationFrame waits one paint frame — enough for the pointer
event to fully resolve without the sluggishness of setTimeout(50).
2026-03-12 22:15:20 +05:30
Hiren Kangad d365049470 perf(text): remove 50ms editor delay + zoom-aware creation defaults
Replace setTimeout(50) with queueMicrotask for TEXT tool editor open
(matching STICKY tool). Add screenToWorld helper for zoom-aware font
sizes and sticky card dimensions. Remove unused Text/TextStyle imports.
2026-03-12 22:09:12 +05:30
Hiren Kangad 5158938eb3 refactor(text): update Editor TextFormatToolbar to use TextSprite API 2026-03-12 22:09:12 +05:30
Hiren Kangad 2efcd0e622 refactor(text): update TextEditor to use TextSprite API 2026-03-12 22:09:12 +05:30
Hiren Kangad 2e24500746 feat(text): wire TextSprite into SceneManager, eliminate inline text mutation 2026-03-12 22:09:12 +05:30
Hiren Kangad d85de4ba9e feat(text): add TextSprite with dirty-check caching 2026-03-12 22:09:12 +05:30
Hiren Kangad f12b75395a perf(sticky): remove creation delay + add dirty-checking to StickySprite
- Replace 50ms setTimeout with queueMicrotask for editor open
- Skip updateFromData() entirely when no inputs changed
- Cache background redraw inputs, skip Graphics clear+redraw when shape unchanged
- Separate text-only, style-only, and bg-only update paths
2026-03-12 22:09:12 +05:30
Hiren Kangad 565b7c6c19 fix(sticky): prevent crash on editor re-entry during sticky lifecycle
Clear editor state before scene callbacks to prevent blur timer or
startEditing re-entry from calling updateFromData on a destroyed sprite.
Guard all display object access with .destroyed checks.
2026-03-12 22:09:12 +05:30
Hiren Kangad a191f74c31 fix(sticky): wire fontSize from toolbar slider + update shortcuts help 2026-03-12 22:09:12 +05:30
Hiren Kangad a7faf004ae feat(sticky): enable double-click editing for sticky notes 2026-03-12 22:09:12 +05:30
Hiren Kangad e183e4b9d2 feat(sticky): extend TextEditor to support sticky note editing 2026-03-12 22:09:12 +05:30
Hiren Kangad 6eb78a2608 feat(sticky): add sticky note button to toolbar 2026-03-12 22:09:12 +05:30
Hiren Kangad 17680a4d8f feat(sticky): add STICKY tool type with click-to-place handler 2026-03-12 22:09:12 +05:30
Hiren Kangad 9fc62dbdc7 feat(sticky): wire StickySprite into SceneManager create/update 2026-03-12 22:09:12 +05:30
Hiren Kangad 92f6200f4b feat(sticky): add StickySprite renderer 2026-03-12 22:09:12 +05:30