auto-save 2026-05-13 19:45 (~3)
This commit is contained in:
@@ -517,7 +517,6 @@ export function KeyframePanelNode({ data }: any) {
|
||||
const { getZoom } = useReactFlow()
|
||||
const panelRef = useRef<HTMLDivElement>(null)
|
||||
const [pinRect, setPinRect] = useState<{ left: number; top: number }>({ left: 24, top: 72 })
|
||||
const [pinScreenScale, setPinScreenScale] = useState(1)
|
||||
if (!d.job || d.expandedFrame === null) return null
|
||||
const active = d.job.frames.find((f) => f.index === d.expandedFrame)
|
||||
const scale = d.framePanelScale ?? 1
|
||||
@@ -532,14 +531,9 @@ export function KeyframePanelNode({ data }: any) {
|
||||
|
||||
const togglePinned = () => {
|
||||
if (!pinned) {
|
||||
const rect = panelRef.current?.getBoundingClientRect()
|
||||
if (rect) {
|
||||
setPinScreenScale(rect.width > 0 ? rect.width / panelWidth : 1)
|
||||
setPinRect({
|
||||
left: Math.max(12, Math.min(window.innerWidth - Math.min(rect.width, window.innerWidth - 24), rect.left)),
|
||||
top: Math.max(12, Math.min(window.innerHeight - 80, rect.top)),
|
||||
})
|
||||
}
|
||||
const zoom = getZoom()
|
||||
setScale(scale * zoom)
|
||||
setPinRect({ left: 16, top: 64 })
|
||||
}
|
||||
d.onFramePanelPinnedChange?.(!pinned)
|
||||
}
|
||||
@@ -550,7 +544,7 @@ export function KeyframePanelNode({ data }: any) {
|
||||
const startX = e.clientX
|
||||
const startY = e.clientY
|
||||
const startScale = scale
|
||||
const zoom = pinned ? pinScreenScale : getZoom()
|
||||
const zoom = pinned ? 1 : getZoom()
|
||||
const onMove = (ev: PointerEvent) => {
|
||||
const dx = (ev.clientX - startX) / zoom
|
||||
const dy = (ev.clientY - startY) / zoom
|
||||
@@ -581,7 +575,7 @@ export function KeyframePanelNode({ data }: any) {
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="mr-1 text-[10px] text-white/60">
|
||||
{pinned ? "已钉住 · 切图不移动" : "拖动标题栏移动 · 可钉住"}
|
||||
{pinned ? "已钉住左侧 · 不跟画布" : "拖动标题栏移动 · 可钉住"}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
@@ -591,7 +585,7 @@ export function KeyframePanelNode({ data }: any) {
|
||||
? "bg-white text-orange-600 shadow"
|
||||
: "bg-white/10 text-white/85 hover:bg-white/20 hover:text-white"
|
||||
}`}
|
||||
title={pinned ? "取消钉住,允许拖动" : "钉住面板,防止被拖动"}
|
||||
title={pinned ? "取消钉住,回到画布节点" : "钉住到左侧,脱离画布缩放"}
|
||||
>
|
||||
<Pin className="h-3 w-3" />
|
||||
</button>
|
||||
@@ -658,12 +652,7 @@ export function KeyframePanelNode({ data }: any) {
|
||||
return createPortal(
|
||||
<div
|
||||
className="fixed z-[240]"
|
||||
style={{
|
||||
left: pinRect.left,
|
||||
top: pinRect.top,
|
||||
transform: `scale(${pinScreenScale})`,
|
||||
transformOrigin: "top left",
|
||||
}}
|
||||
style={{ left: pinRect.left, top: pinRect.top }}
|
||||
>
|
||||
{panel}
|
||||
</div>,
|
||||
|
||||
Reference in New Issue
Block a user