Files
Genarrative/packages/image-canvas-react/src/SelectionOverlay.tsx
T
menghao 03a4410272
Project CI / Repository checks (push) Successful in 1m5s
Project CI / Frontend tests (push) Successful in 3m20s
Project CI / Backend tests (push) Successful in 4m1s
Project CI / Native shell tests (push) Failing after 11m56s
game agent无限画布开发 (#136)
主要工作是共享同一套“画布内核与通用 UI 源码”,网站和 Tauri 只分别实现宿主适配层。

---------

Co-authored-by: 段舒康 <kdletters@qq.com>
Co-authored-by: kdletters <kdletters@qq.com>
Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/136
Co-authored-by: menghao <mh18530625731@163.com>
Co-committed-by: menghao <mh18530625731@163.com>
2026-08-12 10:54:16 +08:00

33 lines
840 B
TypeScript

import type {
CanvasMarqueeState,
CanvasViewport,
} from '@genarrative/image-canvas-core';
export function SelectionOverlay({
className = '',
marquee,
viewport,
}: {
className?: string;
marquee: CanvasMarqueeState | null;
viewport: CanvasViewport;
}) {
if (!marquee) return null;
return (
<div
className={`genarrative-image-canvas__selection-overlay ${className}`.trim()}
aria-hidden="true"
style={{
left:
(Math.min(marquee.startX, marquee.currentX) - viewport.x) /
viewport.scale,
top:
(Math.min(marquee.startY, marquee.currentY) - viewport.y) /
viewport.scale,
width: Math.abs(marquee.currentX - marquee.startX) / viewport.scale,
height: Math.abs(marquee.currentY - marquee.startY) / viewport.scale,
}}
/>
);
}