feat(canvas): move object-pick action to bottom fixed toolbar
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-06 01:03:50 +08:00
parent 2a40607fc1
commit 610317f824
2 changed files with 26 additions and 7 deletions

View File

@ -26,6 +26,7 @@ import {
PenTool,
Box,
Layers,
Crosshair,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
@ -122,6 +123,7 @@ export default function CanvasEditorPage({ params }: PageProps) {
const selectNodes = useCanvasStore((state) => state.selectNodes);
const updateNode = useCanvasStore((state) => state.updateNode);
const setGenerating = useCanvasStore((state) => state.setGenerating);
const setPickerMode = useCanvasStore((state) => state.setPickerMode);
// Local state
const [isLoading, setIsLoading] = useState(true);
@ -848,6 +850,30 @@ export default function CanvasEditorPage({ params }: PageProps) {
<TooltipContent side="top">添加文本</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon"
disabled={!selectedImageNode}
onClick={() => {
if (!selectedImageNode) {
toast.info("请先选中一张图片");
return;
}
setPickerMode(true, selectedImageNode.id);
toast.info("点击图片中的物品进行拾取");
}}
className="h-9 w-9 rounded-xl"
>
<Crosshair className="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent side="top">
{selectedImageNode ? "识物" : "先选中图片后识物"}
</TooltipContent>
</Tooltip>
{siteSettingsData?.realtimeCanvasEnabled === true &&
siteSettingsData?.realtimeCanvasServiceEnabled !== false ? (
<Tooltip>

View File

@ -2199,13 +2199,6 @@ export function ImageNode({ node, isSelected }: ImageNodeProps) {
<RefreshCw className="mr-2 h-4 w-4" />
重绘
</DropdownMenuItem>
<DropdownMenuItem onClick={() => {
setPickerMode(true, node.id);
toast.info('点击图片中的物品进行拾取');
}}>
<Crosshair className="mr-2 h-4 w-4" />
拾物
</DropdownMenuItem>
<DropdownMenuItem onClick={() => handleAction('note')}>
<StickyNote className="mr-2 h-4 w-4" />
备注