fix(canvas): make compare toggle unobstructed and keep consistent icon
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-03-01 02:17:25 +08:00
parent 7c69ccefc2
commit db1e6138e4

View File

@ -1716,7 +1716,12 @@ export function ImageNode({ node, isSelected }: ImageNodeProps) {
{isSelected && !isMultiSelected && hasCompareSource && !isThisNodePicking && ( {isSelected && !isMultiSelected && hasCompareSource && !isThisNodePicking && (
<button <button
type="button" type="button"
className="absolute bottom-2 right-2 z-[140] inline-flex h-8 w-8 items-center justify-center rounded-full border border-white/70 bg-black/70 text-white transition-colors hover:bg-black/80" className={cn(
"absolute right-2 top-1/2 z-[180] inline-flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full border text-white transition-colors",
isCompareMode
? "border-sky-200 bg-sky-500/90 shadow-[0_0_0_2px_rgba(255,255,255,0.55)]"
: "border-white/75 bg-black/75 hover:bg-black/85"
)}
onPointerDown={(event) => { onPointerDown={(event) => {
event.stopPropagation(); event.stopPropagation();
}} }}
@ -1724,25 +1729,21 @@ export function ImageNode({ node, isSelected }: ImageNodeProps) {
event.stopPropagation(); event.stopPropagation();
setIsCompareMode((prev) => !prev); setIsCompareMode((prev) => !prev);
}} }}
title={isCompareMode ? "退出对比" : "开启对比"} title={isCompareMode ? "对比已开启" : "开启对比"}
aria-label={isCompareMode ? "退出对比" : "开启对比"} aria-label={isCompareMode ? "对比已开启" : "开启对比"}
> >
{isCompareMode ? ( <svg
<X className="h-4 w-4" /> viewBox="0 0 24 24"
) : ( className="h-5 w-5"
<svg fill="none"
viewBox="0 0 24 24" stroke="currentColor"
className="h-4 w-4" strokeWidth="2"
fill="none" strokeLinecap="round"
stroke="currentColor" strokeLinejoin="round"
strokeWidth="2" >
strokeLinecap="round" <rect x="3" y="5" width="18" height="14" rx="2" />
strokeLinejoin="round" <path d="M12 5v14" />
> </svg>
<rect x="3" y="5" width="18" height="14" rx="2" />
<path d="M12 5v14" />
</svg>
)}
</button> </button>
)} )}
</div> </div>