-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Disable context menu on canvas to make connection deletion easier * Rewrite technical requirements for FB-04 * Start FB-04 * Write implementation details for FB-04 and move one technical requirement to later epic * Move FB-04 to In Review * Create new flow.slice and flow.logic redux state * Add NodeEntity to flow node instance * Add global event handling to custom react-diagrams engine * Listen for changes to flow currently being built and send them to flow.slice in flow-canvas.tsx * Finish FB-04
- Loading branch information
1 parent
5d0e885
commit 863182f
Showing
13 changed files
with
852 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/flow-client/src/app/components/flow-canvas/model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { | ||
DiagramModel, | ||
NodeModel, | ||
LinkModel, | ||
BaseEvent, | ||
PortModel, | ||
} from '@projectstorm/react-diagrams'; | ||
|
||
export class CustomDiagramModel extends DiagramModel { | ||
// Custom method to add a node and register an event listener | ||
addNode(node: NodeModel): NodeModel { | ||
const ret = super.addNode(node); | ||
// Register an event listener for the node | ||
node.registerListener({ | ||
eventDidFire: (e: BaseEvent) => { | ||
//console.log(`Node event fired: `, event); | ||
this.fireEvent(e, '_globalPassthrough'); | ||
}, | ||
}); | ||
|
||
// also fire the event for every port on our node | ||
Object.values(node.getPorts()).forEach((port: PortModel) => { | ||
port.registerListener({ | ||
eventDidFire: (event: BaseEvent) => { | ||
this.fireEvent(event, '_globalPassthrough'); | ||
}, | ||
}); | ||
}); | ||
return ret; | ||
} | ||
|
||
// Custom method to add a link and register an event listener | ||
addLink(link: LinkModel): LinkModel { | ||
const ret = super.addLink(link); | ||
// Register an event listener for the link | ||
link.registerListener({ | ||
eventDidFire: (e: BaseEvent) => { | ||
//console.log(`Link event fired: `, event); | ||
this.fireEvent(e, '_globalPassthrough'); | ||
}, | ||
}); | ||
return ret; | ||
} | ||
} |
Oops, something went wrong.