MCPcopy Create free account
hub / github.com/experdot/pointer / handleResetView

Function handleResetView

src/renderer/src/components/common/ImageEditor.tsx:252–265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

250
251 // 重置视图到初始适应大小
252 const handleResetView = () => {
253 const canvas = canvasRef.current
254 const container = containerRef.current
255 if (!canvas || !container) return
256
257 const containerWidth = container.clientWidth - 40
258 const containerHeight = container.clientHeight - 40
259 const scaleX = containerWidth / canvas.width
260 const scaleY = containerHeight / canvas.height
261 const initialScale = Math.min(scaleX, scaleY, 1)
262
263 setScale(initialScale)
264 setOffset({ x: 0, y: 0 })
265 }
266
267 // 绘制箭头的辅助函数
268 const drawArrow = (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected