fix: fixed-layout dragging adder materials check canDrop (#163)

This commit is contained in:
xiamidaxia 2025-04-25 15:06:41 +08:00 committed by GitHub
parent 61c7ad1a7a
commit 02a70f4b48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 7 deletions

View File

@ -41,12 +41,6 @@
margin-right: 8px;
}
.port-if {
position: absolute;
right: 0px;
top: 36px;
}
.mouse-pad-option-icon {
display: flex;
justify-content: center;

View File

@ -1,7 +1,22 @@
import React from 'react';
import { FlowDragLayer, usePlayground } from '@flowgram.ai/fixed-layout-editor';
import { UIDragNodeContainer } from './styles';
export default function DraggingAdder(): JSX.Element {
export default function DraggingAdder(props: any): JSX.Element {
const playground = usePlayground();
const layer = playground.getLayer(FlowDragLayer);
if (!layer) return <></>;
if (
layer.options.canDrop &&
!layer.options.canDrop({
dragNodes: layer.dragEntities || [],
dropNode: props.from,
isBranch: false,
})
) {
return <></>;
}
return <UIDragNodeContainer />;
}