File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,6 +160,7 @@ onMounted(() => {
160160.card__render-inner {
161161 transform-origin : top left ;
162162 pointer-events : none ;
163+ image-rendering : -webkit-optimize-contrast ;
163164}
164165
165166.card__placeholder {
Original file line number Diff line number Diff line change 11declare module '@zumer/snapdom' {
2+ interface SnapdomOptions {
3+ scale ?: number
4+ }
25 interface ToBlobOptions {
36 type ?: string
47 scale ?: number
58 }
69 interface SnapdomResult {
710 toBlob ( options ?: ToBlobOptions ) : Promise < Blob >
11+ toCanvas ( options ?: { scale ?: number } ) : Promise < HTMLCanvasElement >
812 toPng ( ) : Promise < HTMLImageElement >
913 }
10- export function snapdom ( element : HTMLElement ) : Promise < SnapdomResult >
14+ export function snapdom ( element : HTMLElement , options ?: SnapdomOptions ) : Promise < SnapdomResult >
1115}
Original file line number Diff line number Diff line change @@ -205,10 +205,10 @@ async function exportPng() {
205205 const origT = wrapper ! .style .transform
206206 wrapper ! .style .transform = ' none'
207207
208- // Capture with snapdom at native resolution
209- const result = await snapdom (thumb ) as any
210- const canvas = await result .toCanvas ()
211- const blob = await new Promise <Blob >((resolve ) => canvas .toBlob ((b : Blob ) => resolve (b ), ' image/png' ))
208+ // Capture at exact CSS pixel dimensions (scale:1 avoids retina 2x)
209+ const result = await snapdom (thumb , { scale: 1 })
210+ const canvas = await result .toCanvas ({ scale: 1 } )
211+ const blob = await new Promise <Blob >((resolve ) => canvas .toBlob ((b ) => resolve (b ! ), ' image/png' ))
212212
213213 // Restore transform
214214 wrapper ! .style .transform = origT
Original file line number Diff line number Diff line change @@ -37,8 +37,9 @@ async function captureCanvas(id: string): Promise<{ id: string; canvas: HTMLCanv
3737 }))
3838
3939 const { snapdom } = await import (' @zumer/snapdom' )
40- const result = await snapdom (thumb ) as any
41- const c = await result .toCanvas () as HTMLCanvasElement
40+ // scale:1 ensures we capture at exact CSS pixel dimensions (not retina 2x)
41+ const result = await snapdom (thumb , { scale: 1 })
42+ const c = await result .toCanvas ({ scale: 1 }) as HTMLCanvasElement
4243
4344 // Restore
4445 if (scaleEl ) scaleEl .style .transform = origTransform
You can’t perform that action at this time.
0 commit comments