Tune LibTV composer size and image dragging
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-04-18 22:03:20 +08:00
parent d8517449ac
commit 4838bbe73e

View File

@ -30,6 +30,7 @@ import {
import { useRouter } from "next/navigation";
import {
type ChangeEvent as ReactChangeEvent,
type DragEvent as ReactDragEvent,
type MouseEvent as ReactMouseEvent,
type PointerEvent as ReactPointerEvent,
type ReactNode,
@ -329,7 +330,7 @@ const OFFICIAL_NODE_GAP = 100;
const OFFICIAL_TEXT_RESOURCE_HEIGHT = 232;
const OFFICIAL_TEXT_RESOURCE_WIDTH = 350;
const OFFICIAL_IMAGE_TOOLBAR_SCALE = 0.7;
const OFFICIAL_COMPOSER_SCALE = 0.47;
const OFFICIAL_COMPOSER_SCALE = 0.6;
const PROMPT_COMPOSER_BASE_WIDTH = 895;
const PROMPT_COMPOSER_BASE_HEIGHT = 286;
const PRESET_COMPOSER_BASE_HEIGHT = 238;
@ -989,6 +990,10 @@ function getNodeMediaUrl(node: CloneNode | null | undefined) {
return Array.isArray(urls) && typeof urls[0] === "string" ? urls[0] : "";
}
function preventNativeImageDrag(event: ReactDragEvent<HTMLImageElement>) {
event.preventDefault();
}
function getPresetMode(node: CloneNode | null | undefined): ActiveStarterScene {
const value = getDraftString(node, "targetPreset");
if (
@ -4502,7 +4507,13 @@ function CloneCanvasNode({
>
{previewUrl ? (
<>
<img alt="" className="absolute inset-0 h-full w-full object-cover opacity-28" src={previewUrl} />
<img
alt=""
className="pointer-events-none absolute inset-0 h-full w-full object-cover opacity-28"
draggable={false}
onDragStart={preventNativeImageDrag}
src={previewUrl}
/>
<span className="absolute inset-0 bg-white/62" />
</>
) : null}
@ -4837,7 +4848,9 @@ function PresetMediaCanvasNode({ node, selected }: { node: CloneNode; selected:
{mediaUrl ? (
<img
alt={node.title}
className={cn("h-full w-full", node.title === "角色三视图" ? "object-contain" : "object-cover")}
className={cn("pointer-events-none h-full w-full", node.title === "角色三视图" ? "object-contain" : "object-cover")}
draggable={false}
onDragStart={preventNativeImageDrag}
src={mediaUrl}
style={{ transform: `rotate(${rotation}deg)` }}
/>