清理冗余代码及频繁日志输出
This commit is contained in:
@@ -559,26 +559,19 @@ export function useBehaviorTreeEditor() {
|
|||||||
|
|
||||||
// 全局拖拽结束处理
|
// 全局拖拽结束处理
|
||||||
const handleGlobalDragEnd = (event: DragEvent) => {
|
const handleGlobalDragEnd = (event: DragEvent) => {
|
||||||
console.log('🔚 全局拖拽结束,是否正在拖拽条件:', conditionAttachment.dragState.isDraggingCondition);
|
|
||||||
if (conditionAttachment.dragState.isDraggingCondition) {
|
if (conditionAttachment.dragState.isDraggingCondition) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log('⏰ 延迟重置拖拽状态');
|
|
||||||
conditionAttachment.resetDragState();
|
conditionAttachment.resetDragState();
|
||||||
}, 100); // 延迟重置,确保drop事件先执行
|
}, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 全局拖拽监听器用于调试
|
|
||||||
const handleGlobalDragOver = (event: DragEvent) => {
|
const handleGlobalDragOver = (event: DragEvent) => {
|
||||||
if (conditionAttachment.dragState.isDraggingCondition) {
|
// 静默处理拖拽悬停
|
||||||
console.log('🌐 全局dragover,鼠标位置:', event.clientX, event.clientY, '目标:', event.target);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGlobalDrop = (event: DragEvent) => {
|
const handleGlobalDrop = (event: DragEvent) => {
|
||||||
if (conditionAttachment.dragState.isDraggingCondition) {
|
// 静默处理拖拽放置
|
||||||
console.log('🌐 全局drop事件,目标:', event.target, '位置:', event.clientX, event.clientY);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('load-behavior-tree-file', handleLoadBehaviorTreeFile as EventListener);
|
document.addEventListener('load-behavior-tree-file', handleLoadBehaviorTreeFile as EventListener);
|
||||||
@@ -631,30 +624,21 @@ export function useBehaviorTreeEditor() {
|
|||||||
clearAllConnections,
|
clearAllConnections,
|
||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
saveToFile,
|
saveToFile,
|
||||||
// 节点选择相关
|
|
||||||
selectNode: (nodeId: string) => {
|
selectNode: (nodeId: string) => {
|
||||||
// 选中普通节点时,取消条件节点的选中
|
|
||||||
appState.selectedNodeId.value = nodeId;
|
appState.selectedNodeId.value = nodeId;
|
||||||
appState.selectedConditionNodeId.value = null;
|
appState.selectedConditionNodeId.value = null;
|
||||||
console.log('🎯 选中节点:', nodeId);
|
|
||||||
},
|
},
|
||||||
selectConditionNode: (decoratorNode: any) => {
|
selectConditionNode: (decoratorNode: any) => {
|
||||||
// 选中条件节点时,取消装饰器节点的选中
|
|
||||||
appState.selectedNodeId.value = null;
|
appState.selectedNodeId.value = null;
|
||||||
appState.selectedConditionNodeId.value = decoratorNode.id;
|
appState.selectedConditionNodeId.value = decoratorNode.id;
|
||||||
console.log('📝 选中条件节点进行编辑:', decoratorNode.attachedCondition?.name);
|
|
||||||
},
|
},
|
||||||
// 统一的属性更新方法(支持普通节点和条件节点)
|
|
||||||
updateNodeProperty: (path: string, value: any) => {
|
updateNodeProperty: (path: string, value: any) => {
|
||||||
// 如果选中的是条件节点,更新装饰器节点的属性
|
|
||||||
if (appState.selectedConditionNodeId.value) {
|
if (appState.selectedConditionNodeId.value) {
|
||||||
const decoratorNode = appState.getNodeByIdLocal(appState.selectedConditionNodeId.value);
|
const decoratorNode = appState.getNodeByIdLocal(appState.selectedConditionNodeId.value);
|
||||||
if (decoratorNode) {
|
if (decoratorNode) {
|
||||||
// 使用通用方法更新属性
|
|
||||||
const keys = path.split('.');
|
const keys = path.split('.');
|
||||||
let current: any = decoratorNode;
|
let current: any = decoratorNode;
|
||||||
|
|
||||||
// 导航到目标属性的父对象
|
|
||||||
for (let i = 0; i < keys.length - 1; i++) {
|
for (let i = 0; i < keys.length - 1; i++) {
|
||||||
const key = keys[i];
|
const key = keys[i];
|
||||||
if (!(key in current) || typeof current[key] !== 'object' || current[key] === null) {
|
if (!(key in current) || typeof current[key] !== 'object' || current[key] === null) {
|
||||||
@@ -663,18 +647,13 @@ export function useBehaviorTreeEditor() {
|
|||||||
current = current[key];
|
current = current[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置最终值
|
|
||||||
const finalKey = keys[keys.length - 1];
|
const finalKey = keys[keys.length - 1];
|
||||||
current[finalKey] = value;
|
current[finalKey] = value;
|
||||||
|
|
||||||
console.log('📝 更新条件属性:', path, '=', value);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 普通节点属性更新
|
|
||||||
nodeOps.updateNodeProperty(path, value);
|
nodeOps.updateNodeProperty(path, value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 条件吸附功能
|
|
||||||
conditionDragState: conditionAttachment.dragState,
|
conditionDragState: conditionAttachment.dragState,
|
||||||
startConditionDrag: conditionAttachment.startConditionDrag,
|
startConditionDrag: conditionAttachment.startConditionDrag,
|
||||||
handleDecoratorDragOver: conditionAttachment.handleDecoratorDragOver,
|
handleDecoratorDragOver: conditionAttachment.handleDecoratorDragOver,
|
||||||
@@ -684,48 +663,43 @@ export function useBehaviorTreeEditor() {
|
|||||||
removeConditionFromDecorator: conditionAttachment.removeConditionFromDecorator,
|
removeConditionFromDecorator: conditionAttachment.removeConditionFromDecorator,
|
||||||
canAcceptCondition: conditionAttachment.canAcceptCondition,
|
canAcceptCondition: conditionAttachment.canAcceptCondition,
|
||||||
resetDragState: conditionAttachment.resetDragState,
|
resetDragState: conditionAttachment.resetDragState,
|
||||||
// 合并的画布拖拽处理
|
|
||||||
handleCanvasDrop: (event: DragEvent) => {
|
handleCanvasDrop: (event: DragEvent) => {
|
||||||
// 先尝试条件拖拽处理
|
|
||||||
if (conditionAttachment.handleCanvasDrop(event)) {
|
if (conditionAttachment.handleCanvasDrop(event)) {
|
||||||
return; // 如果是条件拖拽,直接返回
|
return;
|
||||||
}
|
}
|
||||||
// 否则使用正常的节点拖拽处理
|
|
||||||
nodeOps.onCanvasDrop(event);
|
nodeOps.onCanvasDrop(event);
|
||||||
},
|
},
|
||||||
// 条件节点拖拽处理
|
|
||||||
handleConditionNodeDragStart: (event: DragEvent, template: any) => {
|
handleConditionNodeDragStart: (event: DragEvent, template: any) => {
|
||||||
console.log('🎯 条件节点拖拽事件:', template.name, template.isDraggableCondition);
|
|
||||||
if (template.isDraggableCondition) {
|
if (template.isDraggableCondition) {
|
||||||
conditionAttachment.startConditionDrag(event, template);
|
conditionAttachment.startConditionDrag(event, template);
|
||||||
} else {
|
} else {
|
||||||
nodeOps.onNodeDragStart(event, template);
|
nodeOps.onNodeDragStart(event, template);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 节点拖拽事件处理
|
|
||||||
handleNodeDrop: (event: DragEvent, node: any) => {
|
handleNodeDrop: (event: DragEvent, node: any) => {
|
||||||
console.log('📦 节点拖拽放置:', node.name, node.type, 'isDraggingCondition:', conditionAttachment.dragState.isDraggingCondition);
|
|
||||||
if (node.type === 'conditional-decorator') {
|
if (node.type === 'conditional-decorator') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return conditionAttachment.attachConditionToDecorator(event, node);
|
return conditionAttachment.attachConditionToDecorator(event, node);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleNodeDragOver: (event: DragEvent, node: any) => {
|
handleNodeDragOver: (event: DragEvent, node: any) => {
|
||||||
console.log('🔄 节点拖拽悬停:', node.name, node.type, 'isDraggingCondition:', conditionAttachment.dragState.isDraggingCondition);
|
|
||||||
if (node.type === 'conditional-decorator') {
|
if (node.type === 'conditional-decorator') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return conditionAttachment.handleDecoratorDragOver(event, node);
|
return conditionAttachment.handleDecoratorDragOver(event, node);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleNodeDragLeave: (event: DragEvent, node: any) => {
|
handleNodeDragLeave: (event: DragEvent, node: any) => {
|
||||||
console.log('🔙 节点拖拽离开:', node.name, node.type);
|
|
||||||
if (node.type === 'conditional-decorator') {
|
if (node.type === 'conditional-decorator') {
|
||||||
conditionAttachment.handleDecoratorDragLeave(node);
|
conditionAttachment.handleDecoratorDragLeave(node);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Blackboard拖拽相关功能
|
|
||||||
isBlackboardDroppable,
|
isBlackboardDroppable,
|
||||||
isBlackboardReference,
|
isBlackboardReference,
|
||||||
handleBlackboardDrop,
|
handleBlackboardDrop,
|
||||||
@@ -733,7 +707,6 @@ export function useBehaviorTreeEditor() {
|
|||||||
handleBlackboardDragLeave,
|
handleBlackboardDragLeave,
|
||||||
clearBlackboardReference,
|
clearBlackboardReference,
|
||||||
|
|
||||||
// Blackboard常驻侧边面板功能
|
|
||||||
blackboardCollapsed: computed({
|
blackboardCollapsed: computed({
|
||||||
get: () => blackboardSidebarState.collapsed,
|
get: () => blackboardSidebarState.collapsed,
|
||||||
set: (value: boolean) => blackboardSidebarState.collapsed = value
|
set: (value: boolean) => blackboardSidebarState.collapsed = value
|
||||||
|
|||||||
@@ -51,30 +51,6 @@ export function useBlackboard() {
|
|||||||
allowedValuesText: ''
|
allowedValuesText: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
const showAddVariableDialog = ref(false);
|
|
||||||
const editingVariable = ref<BlackboardVariable | null>(null);
|
|
||||||
const newVariable = reactive({
|
|
||||||
name: '',
|
|
||||||
type: 'string' as any,
|
|
||||||
defaultValue: '' as any,
|
|
||||||
defaultValueText: '',
|
|
||||||
description: '',
|
|
||||||
group: '',
|
|
||||||
readonly: false,
|
|
||||||
min: undefined as number | undefined,
|
|
||||||
max: undefined as number | undefined,
|
|
||||||
optionsText: ''
|
|
||||||
});
|
|
||||||
|
|
||||||
const showImportExportDialog = ref(false);
|
|
||||||
const activeTab = ref('export');
|
|
||||||
const exportData = computed(() => {
|
|
||||||
const data = Array.from(blackboardVariables.value.values());
|
|
||||||
return JSON.stringify(data, null, 2);
|
|
||||||
});
|
|
||||||
const importData = ref('');
|
|
||||||
const clearBeforeImport = ref(false);
|
|
||||||
|
|
||||||
const blackboardCollapsed = ref(false);
|
const blackboardCollapsed = ref(false);
|
||||||
const blackboardTransparent = ref(true);
|
const blackboardTransparent = ref(true);
|
||||||
|
|
||||||
@@ -108,18 +84,6 @@ export function useBlackboard() {
|
|||||||
return sortedGroups;
|
return sortedGroups;
|
||||||
});
|
});
|
||||||
|
|
||||||
const groups = computed(() => {
|
|
||||||
const groupSet = new Set<string>();
|
|
||||||
blackboardVariables.value.forEach(variable => {
|
|
||||||
groupSet.add(variable.group || '未分组');
|
|
||||||
});
|
|
||||||
return Array.from(groupSet);
|
|
||||||
});
|
|
||||||
|
|
||||||
const isValidVariable = computed(() => {
|
|
||||||
return newVariable.name.trim().length > 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
const groupedBlackboardVariables = () => {
|
const groupedBlackboardVariables = () => {
|
||||||
return Object.entries(blackboardVariableGroups.value);
|
return Object.entries(blackboardVariableGroups.value);
|
||||||
};
|
};
|
||||||
@@ -240,31 +204,6 @@ export function useBlackboard() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onTypeChange = () => {
|
|
||||||
switch (newVariable.type) {
|
|
||||||
case 'string':
|
|
||||||
newVariable.defaultValue = '';
|
|
||||||
break;
|
|
||||||
case 'number':
|
|
||||||
newVariable.defaultValue = 0;
|
|
||||||
break;
|
|
||||||
case 'boolean':
|
|
||||||
newVariable.defaultValue = false;
|
|
||||||
break;
|
|
||||||
case 'vector2':
|
|
||||||
newVariable.defaultValue = { x: 0, y: 0 };
|
|
||||||
break;
|
|
||||||
case 'vector3':
|
|
||||||
newVariable.defaultValue = { x: 0, y: 0, z: 0 };
|
|
||||||
break;
|
|
||||||
case 'object':
|
|
||||||
case 'array':
|
|
||||||
newVariable.defaultValue = '';
|
|
||||||
newVariable.defaultValueText = '';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const saveBlackboardVariable = () => {
|
const saveBlackboardVariable = () => {
|
||||||
if (!blackboardModalData.name.trim()) {
|
if (!blackboardModalData.name.trim()) {
|
||||||
alert('请输入变量名称');
|
alert('请输入变量名称');
|
||||||
@@ -273,7 +212,6 @@ export function useBlackboard() {
|
|||||||
|
|
||||||
let finalValue = blackboardModalData.defaultValue;
|
let finalValue = blackboardModalData.defaultValue;
|
||||||
|
|
||||||
// 处理对象和数组类型的JSON格式
|
|
||||||
if (blackboardModalData.type === 'object' || blackboardModalData.type === 'array') {
|
if (blackboardModalData.type === 'object' || blackboardModalData.type === 'array') {
|
||||||
try {
|
try {
|
||||||
if (typeof blackboardModalData.defaultValue === 'string') {
|
if (typeof blackboardModalData.defaultValue === 'string') {
|
||||||
@@ -290,7 +228,6 @@ export function useBlackboard() {
|
|||||||
if (blackboardModalData.constraints.max !== undefined) constraints.max = blackboardModalData.constraints.max;
|
if (blackboardModalData.constraints.max !== undefined) constraints.max = blackboardModalData.constraints.max;
|
||||||
if (blackboardModalData.constraints.step !== undefined) constraints.step = blackboardModalData.constraints.step;
|
if (blackboardModalData.constraints.step !== undefined) constraints.step = blackboardModalData.constraints.step;
|
||||||
|
|
||||||
// 处理字符串的可选值列表
|
|
||||||
if (blackboardModalData.useAllowedValues && blackboardModalData.allowedValuesText.trim()) {
|
if (blackboardModalData.useAllowedValues && blackboardModalData.allowedValuesText.trim()) {
|
||||||
constraints.allowedValues = blackboardModalData.allowedValuesText
|
constraints.allowedValues = blackboardModalData.allowedValuesText
|
||||||
.split('\n')
|
.split('\n')
|
||||||
@@ -317,7 +254,6 @@ export function useBlackboard() {
|
|||||||
showBlackboardModal.value = false;
|
showBlackboardModal.value = false;
|
||||||
editingBlackboardVariable.value = null;
|
editingBlackboardVariable.value = null;
|
||||||
|
|
||||||
// 重置模态框数据
|
|
||||||
Object.assign(blackboardModalData, {
|
Object.assign(blackboardModalData, {
|
||||||
name: '',
|
name: '',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@@ -421,10 +357,6 @@ export function useBlackboard() {
|
|||||||
event.dataTransfer.effectAllowed = 'copy';
|
event.dataTransfer.effectAllowed = 'copy';
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeBlackboardVariable = (variableName: string) => {
|
|
||||||
deleteBlackboardVariable(variableName);
|
|
||||||
};
|
|
||||||
|
|
||||||
const editVariable = (variable: BlackboardVariable) => {
|
const editVariable = (variable: BlackboardVariable) => {
|
||||||
editingBlackboardVariable.value = variable;
|
editingBlackboardVariable.value = variable;
|
||||||
|
|
||||||
@@ -447,71 +379,20 @@ export function useBlackboard() {
|
|||||||
showBlackboardModal.value = true;
|
showBlackboardModal.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onBlackboardDragStart = (event: DragEvent, variable: BlackboardVariable) => {
|
|
||||||
onVariableDragStart(event, variable);
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeAddVariableDialog = () => {
|
|
||||||
showAddVariableDialog.value = false;
|
|
||||||
editingVariable.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const saveVariable = () => {
|
|
||||||
saveBlackboardVariable();
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeImportExportDialog = () => {
|
|
||||||
showImportExportDialog.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const copyExportData = () => {
|
|
||||||
navigator.clipboard.writeText(exportData.value);
|
|
||||||
alert('已复制到剪贴板');
|
|
||||||
};
|
|
||||||
|
|
||||||
const importVariables = () => {
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(importData.value);
|
|
||||||
if (!Array.isArray(data)) {
|
|
||||||
throw new Error('格式错误:期望数组格式');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clearBeforeImport.value) {
|
|
||||||
blackboardVariables.value.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
let importCount = 0;
|
|
||||||
data.forEach((varData: any) => {
|
|
||||||
if (varData.name && varData.type) {
|
|
||||||
blackboardVariables.value.set(varData.name, varData);
|
|
||||||
importCount++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alert(`成功导入 ${importCount} 个变量`);
|
|
||||||
showImportExportDialog.value = false;
|
|
||||||
importData.value = '';
|
|
||||||
} catch (error) {
|
|
||||||
alert('导入失败:' + (error as Error).message);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const addBlackboardVariable = () => {
|
const addBlackboardVariable = () => {
|
||||||
Object.assign(newVariable, {
|
editingBlackboardVariable.value = null;
|
||||||
|
Object.assign(blackboardModalData, {
|
||||||
name: '',
|
name: '',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
defaultValueText: '',
|
|
||||||
description: '',
|
description: '',
|
||||||
group: '',
|
group: '',
|
||||||
readonly: false,
|
readOnly: false,
|
||||||
min: undefined,
|
constraints: {},
|
||||||
max: undefined,
|
useAllowedValues: false,
|
||||||
optionsText: ''
|
allowedValuesText: ''
|
||||||
});
|
});
|
||||||
|
showBlackboardModal.value = true;
|
||||||
editingVariable.value = null;
|
|
||||||
showAddVariableDialog.value = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -522,17 +403,6 @@ export function useBlackboard() {
|
|||||||
blackboardModalData,
|
blackboardModalData,
|
||||||
expandedGroups,
|
expandedGroups,
|
||||||
blackboardVariableGroups,
|
blackboardVariableGroups,
|
||||||
|
|
||||||
showAddVariableDialog,
|
|
||||||
editingVariable,
|
|
||||||
newVariable,
|
|
||||||
groups,
|
|
||||||
showImportExportDialog,
|
|
||||||
activeTab,
|
|
||||||
exportData,
|
|
||||||
importData,
|
|
||||||
clearBeforeImport,
|
|
||||||
isValidVariable,
|
|
||||||
blackboardCollapsed,
|
blackboardCollapsed,
|
||||||
blackboardTransparent,
|
blackboardTransparent,
|
||||||
|
|
||||||
@@ -549,24 +419,15 @@ export function useBlackboard() {
|
|||||||
addBlackboardVariable,
|
addBlackboardVariable,
|
||||||
saveBlackboardVariable,
|
saveBlackboardVariable,
|
||||||
deleteBlackboardVariable,
|
deleteBlackboardVariable,
|
||||||
removeBlackboardVariable,
|
removeBlackboardVariable: deleteBlackboardVariable,
|
||||||
updateBlackboardVariable,
|
updateBlackboardVariable,
|
||||||
editVariable,
|
editVariable,
|
||||||
selectVariable,
|
selectVariable,
|
||||||
clearBlackboard,
|
clearBlackboard,
|
||||||
|
|
||||||
closeAddVariableDialog,
|
|
||||||
saveVariable,
|
|
||||||
onTypeChange,
|
|
||||||
closeImportExportDialog,
|
|
||||||
copyExportData,
|
|
||||||
importVariables,
|
|
||||||
|
|
||||||
exportBlackboard,
|
exportBlackboard,
|
||||||
importBlackboard,
|
importBlackboard,
|
||||||
|
|
||||||
onBlackboardDragStart,
|
onBlackboardDragStart: onVariableDragStart,
|
||||||
|
|
||||||
editBlackboardVariable: editVariable,
|
editBlackboardVariable: editVariable,
|
||||||
onBlackboardValueChange: (variable: BlackboardVariable) => {
|
onBlackboardValueChange: (variable: BlackboardVariable) => {
|
||||||
updateBlackboardVariable(variable.name, variable.value);
|
updateBlackboardVariable(variable.name, variable.value);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
<button class="tool-btn" @click="exportConfig" title="导出配置">
|
<button class="tool-btn" @click="exportConfig" title="导出配置">
|
||||||
<span>⚡</span> 导出配置
|
<span>⚡</span> 导出配置
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar-right">
|
<div class="toolbar-right">
|
||||||
@@ -348,7 +347,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 输入端口 - 执行流入口 -->
|
|
||||||
|
<!-- 输入端口 -->
|
||||||
<div
|
<div
|
||||||
v-if="node.canHaveParent"
|
v-if="node.canHaveParent"
|
||||||
class="port port-input"
|
class="port port-input"
|
||||||
@@ -361,12 +361,12 @@
|
|||||||
@mousedown.stop="startConnection($event, node.id, 'input')"
|
@mousedown.stop="startConnection($event, node.id, 'input')"
|
||||||
@mouseenter="onPortHover(node.id, 'input')"
|
@mouseenter="onPortHover(node.id, 'input')"
|
||||||
@mouseleave="onPortLeave()"
|
@mouseleave="onPortLeave()"
|
||||||
title="执行流入口(可从此开始连接)"
|
title="执行流入口"
|
||||||
>
|
>
|
||||||
<div class="port-inner"></div>
|
<div class="port-inner"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 输出端口 - 执行流出口 -->
|
<!-- 输出端口 -->
|
||||||
<div
|
<div
|
||||||
v-if="node.canHaveChildren"
|
v-if="node.canHaveChildren"
|
||||||
class="port port-output"
|
class="port port-output"
|
||||||
@@ -379,25 +379,25 @@
|
|||||||
@mousedown.stop="startConnection($event, node.id, 'output')"
|
@mousedown.stop="startConnection($event, node.id, 'output')"
|
||||||
@mouseenter="onPortHover(node.id, 'output')"
|
@mouseenter="onPortHover(node.id, 'output')"
|
||||||
@mouseleave="onPortLeave()"
|
@mouseleave="onPortLeave()"
|
||||||
title="执行流出口(可从此开始连接)"
|
title="执行流出口"
|
||||||
>
|
>
|
||||||
<div class="port-inner"></div>
|
<div class="port-inner"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 子节点指示器 -->
|
|
||||||
<div v-if="node.children && node.children.length > 0" class="children-indicator">
|
<div v-if="node.children && node.children.length > 0" class="children-indicator">
|
||||||
{{ node.children.length }}
|
{{ node.children.length }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 网格背景 -->
|
|
||||||
<div class="grid-background" :style="gridStyle()"></div>
|
<div class="grid-background" :style="gridStyle()"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 右侧属性面板 -->
|
|
||||||
<div class="properties-panel-container">
|
<div class="properties-panel-container">
|
||||||
<!-- 属性面板 -->
|
|
||||||
<div class="properties-panel">
|
<div class="properties-panel">
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<h3>⚙️ 属性面板</h3>
|
<h3>⚙️ 属性面板</h3>
|
||||||
@@ -488,7 +488,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- Blackboard引用指示器 -->
|
|
||||||
<div v-if="isBlackboardReference(prop.value)" class="blackboard-reference">
|
<div v-if="isBlackboardReference(prop.value)" class="blackboard-reference">
|
||||||
<span class="ref-icon">🔗</span>
|
<span class="ref-icon">🔗</span>
|
||||||
<span class="ref-text">{{ prop.value }}</span>
|
<span class="ref-text">{{ prop.value }}</span>
|
||||||
@@ -513,7 +512,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- 行为树结构面板 -->
|
|
||||||
<div class="tree-structure-panel" v-if="rootNode()">
|
<div class="tree-structure-panel" v-if="rootNode()">
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<h3>🌲 树结构</h3>
|
<h3>🌲 树结构</h3>
|
||||||
@@ -528,13 +526,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 验证结果 -->
|
|
||||||
<div v-if="!validationResult().isValid" class="validation-error">
|
<div v-if="!validationResult().isValid" class="validation-error">
|
||||||
<span class="error-icon">⚠️</span>
|
<span class="error-icon">⚠️</span>
|
||||||
<span>{{ validationResult().message }}</span>
|
<span>{{ validationResult().message }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Blackboard变量编辑模态框 -->
|
|
||||||
<div v-if="showBlackboardModal" class="modal-overlay" @click="showBlackboardModal = false">
|
<div v-if="showBlackboardModal" class="modal-overlay" @click="showBlackboardModal = false">
|
||||||
<div class="modal-content blackboard-modal" @click.stop>
|
<div class="modal-content blackboard-modal" @click.stop>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -619,7 +617,6 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 约束设置 -->
|
|
||||||
<div v-if="blackboardModalData.type === 'number'" class="form-group">
|
<div v-if="blackboardModalData.type === 'number'" class="form-group">
|
||||||
<label>数值约束:</label>
|
<label>数值约束:</label>
|
||||||
<div class="constraint-inputs">
|
<div class="constraint-inputs">
|
||||||
@@ -665,7 +662,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Blackboard常驻侧边面板 -->
|
|
||||||
<div class="blackboard-sidebar"
|
<div class="blackboard-sidebar"
|
||||||
:class="{
|
:class="{
|
||||||
'collapsed': blackboardCollapsed,
|
'collapsed': blackboardCollapsed,
|
||||||
@@ -674,7 +671,6 @@
|
|||||||
@mouseenter="blackboardTransparent = false"
|
@mouseenter="blackboardTransparent = false"
|
||||||
@mouseleave="blackboardTransparent = true">
|
@mouseleave="blackboardTransparent = true">
|
||||||
|
|
||||||
<!-- 收缩/展开按钮 -->
|
|
||||||
<button class="blackboard-toggle"
|
<button class="blackboard-toggle"
|
||||||
@click="blackboardCollapsed = !blackboardCollapsed"
|
@click="blackboardCollapsed = !blackboardCollapsed"
|
||||||
:title="blackboardCollapsed ? '展开 Blackboard' : '收缩 Blackboard'">
|
:title="blackboardCollapsed ? '展开 Blackboard' : '收缩 Blackboard'">
|
||||||
@@ -682,19 +678,16 @@
|
|||||||
<span v-else>◀</span>
|
<span v-else>◀</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- 面板内容 -->
|
|
||||||
<div class="blackboard-content" v-show="!blackboardCollapsed">
|
<div class="blackboard-content" v-show="!blackboardCollapsed">
|
||||||
<div class="blackboard-header">
|
<div class="blackboard-header">
|
||||||
<h3>📋 Blackboard</h3>
|
<h3>📋 Blackboard</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Blackboard操作按钮 -->
|
|
||||||
<div class="blackboard-actions">
|
<div class="blackboard-actions">
|
||||||
<button @click="showBlackboardModal = true" class="add-var-btn">+ 添加变量</button>
|
<button @click="showBlackboardModal = true" class="add-var-btn">+ 添加变量</button>
|
||||||
<button @click="clearBlackboard" v-if="blackboardVariables.length > 0" class="clear-btn">清空</button>
|
<button @click="clearBlackboard" v-if="blackboardVariables.length > 0" class="clear-btn">清空</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Blackboard变量列表 -->
|
|
||||||
<div class="blackboard-scroll-area">
|
<div class="blackboard-scroll-area">
|
||||||
<div v-if="blackboardVariables.length > 0" class="blackboard-groups">
|
<div v-if="blackboardVariables.length > 0" class="blackboard-groups">
|
||||||
<div
|
<div
|
||||||
@@ -740,7 +733,6 @@
|
|||||||
<span v-else class="value-display">{{ getDisplayValue(variable) }}</span>
|
<span v-else class="value-display">{{ getDisplayValue(variable) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 约束显示 -->
|
|
||||||
<div v-if="variable.constraints && hasVisibleConstraints(variable)" class="variable-constraints">
|
<div v-if="variable.constraints && hasVisibleConstraints(variable)" class="variable-constraints">
|
||||||
<small>{{ formatConstraints(variable.constraints) }}</small>
|
<small>{{ formatConstraints(variable.constraints) }}</small>
|
||||||
</div>
|
</div>
|
||||||
@@ -749,7 +741,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 空状态 -->
|
|
||||||
<div v-else class="empty-blackboard">
|
<div v-else class="empty-blackboard">
|
||||||
<div class="empty-icon">📋</div>
|
<div class="empty-icon">📋</div>
|
||||||
<p>还没有定义任何变量</p>
|
<p>还没有定义任何变量</p>
|
||||||
@@ -761,7 +752,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 导出模态框 -->
|
|
||||||
<div v-if="showExportModal" class="modal-overlay" @click="showExportModal = false">
|
<div v-if="showExportModal" class="modal-overlay" @click="showExportModal = false">
|
||||||
<div class="modal-content" @click.stop>
|
<div class="modal-content" @click.stop>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
|||||||
Reference in New Issue
Block a user