mirror of
https://github.com/simstudioai/sim.git
synced 2026-10-29 18:47:25 +08:00
fix(files): attach wheel listener before paint and guard SVG src (#4744)
* fix(files): attach wheel listener before paint and guard SVG src * chore(deps): upgrade turbo to 2.9.14
This commit is contained in:
@@ -1081,12 +1081,14 @@ function SvgPreview({ content }: { content: string }) {
|
||||
|
||||
return (
|
||||
<ZoomablePreview className='h-full' contentClassName='h-full w-full'>
|
||||
<img
|
||||
src={blobUrl}
|
||||
alt='SVG preview'
|
||||
className='max-h-full max-w-full select-none object-contain'
|
||||
draggable={false}
|
||||
/>
|
||||
{blobUrl && (
|
||||
<img
|
||||
src={blobUrl}
|
||||
alt='SVG preview'
|
||||
className='max-h-full max-w-full select-none object-contain'
|
||||
draggable={false}
|
||||
/>
|
||||
)}
|
||||
</ZoomablePreview>
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import type { MouseEvent, ReactNode } from 'react'
|
||||
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
||||
import { useCallback, useLayoutEffect, useRef, useState } from 'react'
|
||||
import { cn } from '@/lib/core/utils/cn'
|
||||
import { PreviewToolbar } from './preview-toolbar'
|
||||
import { bindPreviewWheelZoom } from './preview-wheel-zoom'
|
||||
@@ -134,7 +134,7 @@ export function ZoomablePreview({
|
||||
applyZoom(clampZoom(zoom / ZOOM_BUTTON_FACTOR))
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
const viewport = viewportRef.current
|
||||
if (!viewport) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user