Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/runtime/canvas-layout-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ function buildPlacementPreview(tool: ReturnType<typeof uiActiveTool>): PendingPl
: undefined
const color =
tool.kind === 'add-sticky' ? getToolDefaults()['add-sticky'].color : undefined
const textSize =
tool.kind === 'add-text' ? getToolDefaults()['add-text'].textSize : undefined
const customSize = tool.kind === 'add-page' ? tool.customSize === true : false
const sourcePageId = tool.kind === 'add-page' ? tool.sourcePageId : undefined
// shapeKind moved to tool defaults per ADR 0009 — preview reads the persisted
Expand All @@ -324,6 +326,7 @@ function buildPlacementPreview(tool: ReturnType<typeof uiActiveTool>): PendingPl
shapeKind,
textStyle,
color,
textSize,
width: isText
? DEFAULT_TEXT_WIDTH
: isFile
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/canvas-bg/CanvasGridSurface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ export function PlacementPreviewLayer({
shapeKind?: string
textStyle?: TextEntityStyle
color?: string
textSize?: number
zoom?: number
left: number
top: number
width: number
Expand All @@ -128,12 +130,16 @@ export function PlacementPreviewLayer({
const isShape = preview.entityKind === 'shape'
const isStickyPreview = isTextEntity && preview.textStyle === 'sticky'
if (isTextEntity && preview.textStyle === 'plain') {
const scaledFontSize = (preview.textSize ?? 14) * (preview.zoom ?? 1)
const scaledLineHeight = scaledFontSize * 1.5
return (
<div
className="pointer-events-none absolute select-none text-[12px] leading-[18px] font-normal"
className="pointer-events-none absolute select-none font-normal"
style={{
left: preview.left,
top: preview.top,
fontSize: scaledFontSize,
lineHeight: `${scaledLineHeight}px`,
color: isDark ? 'rgba(231, 229, 228, 0.58)' : 'rgba(28, 25, 23, 0.48)',
fontFamily: 'system-ui, sans-serif',
}}
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/canvas-bg/canvasBgSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export function buildPendingPlacementPreview(
shapeKind: layoutData.pendingPlacement.shapeKind,
textStyle: layoutData.pendingPlacement.textStyle,
color: layoutData.pendingPlacement.color,
textSize: layoutData.pendingPlacement.textSize,
zoom: layoutData.zoom,
left: layoutData.canvasOrigin.x + layoutData.pan.x + snappedX * layoutData.zoom,
top: layoutData.canvasOrigin.y + layoutData.pan.y + snappedY * layoutData.zoom,
width: layoutData.pendingPlacement.width * layoutData.zoom,
Expand Down
2 changes: 2 additions & 0 deletions src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ export interface PendingPlacement {
textStyle?: TextEntityStyle
/** Stored color of the in-flight placement (sticky fill, etc.) so the preview can match the picker. */
color?: string
/** Text size in canvas units for plain-text placement preview. */
textSize?: number
width: number
height: number
}
Expand Down
Loading