ActionFlow bug fix

This commit is contained in:
2023-09-17 20:21:39 +09:00
parent 59e6d33656
commit df59bff6ae
2 changed files with 11 additions and 12 deletions

View File

@@ -88,7 +88,7 @@ const onDeleteNode=(node:IActionNode)=>{
}
const onDeleteAllNextNodes=(node:IActionNode)=>{
refFlow.value.removeNode(node);
refFlow.value.removeAllNext(node.id);
}
const closeDg=(val :any)=>{
console.log("Dialog closed->",val);

View File

@@ -78,8 +78,6 @@ class ActionProperty implements IActionProperty {
modelValue: modelValue
};
}
}
@@ -170,6 +168,7 @@ export class RootAction implements IActionNode {
* アクションフローの定義
*/
export class ActionFlow implements IActionFlow {
actionNodes:Array<IActionNode>;
constructor(actionNodes:Array<IActionNode>|RootAction){
if(actionNodes instanceof Array){
@@ -196,10 +195,10 @@ export class ActionFlow implements IActionFlow {
newNode.inputPoint=inputPoint;
}
if(prevNode){
this.resetNodeRelation(prevNode,newNode,inputPoint);
this.connectNodes(prevNode,newNode,inputPoint||'');
}else{
prevNode=this.actionNodes[this.actionNodes.length-1];
this.resetNodeRelation(prevNode,newNode,inputPoint);
this.connectNodes(prevNode,newNode,inputPoint||'');
}
this.actionNodes.push(newNode);
return newNode;
@@ -291,7 +290,8 @@ reconnectOrRemoveNextNodes(targetNode: IActionNode): void {
}
//二つ以上の場合
for(const [point,nextid] of nextNodeIds){
if(!this.connectNodes(prevNode,nextid,point)){
const nextNode = this.findNodeById(nextid);
if(!this.connectNodes(prevNode,nextNode,point)){
this.removeAllNext(nextid);
this.removeFromActionNodes(nextid);
}
@@ -305,13 +305,12 @@ reconnectOrRemoveNextNodes(targetNode: IActionNode): void {
* @param point
* @returns
*/
connectNodes(prevNode:IActionNode,nextNodeId:string,point:string):boolean{
if(!prevNode || !nextNodeId){
connectNodes(prevNode:IActionNode,nextNode:IActionNode,point:string):boolean{
if(!prevNode || !nextNode){
return false;
}
const nextNode = this.findNodeById(nextNodeId);
if(!nextNode) return false;
prevNode.nextNodeIds.set(point,nextNodeId);
prevNode.nextNodeIds.set(point,nextNode.id);
nextNode.prevNodeId=prevNode.id;
nextNode.inputPoint=point;
return true;