refactor: make sure that the droppable styles are kept, update some nodes to reflect their used functionality.
ref: N25B-294
This commit is contained in:
@@ -7,6 +7,9 @@ import {
|
||||
import { Toolbar } from '../components/NodeComponents';
|
||||
import styles from '../../VisProg.module.css';
|
||||
|
||||
/**
|
||||
* The typing of this node's data
|
||||
*/
|
||||
export type EndNodeData = {
|
||||
label: string;
|
||||
droppable: boolean;
|
||||
@@ -15,6 +18,11 @@ export type EndNodeData = {
|
||||
|
||||
export type EndNode = Node<EndNodeData>
|
||||
|
||||
/**
|
||||
* Default function to render an end node given its properties
|
||||
* @param props the node's properties
|
||||
* @returns React.JSX.Element
|
||||
*/
|
||||
export default function EndNode(props: NodeProps<Node>) {
|
||||
return (
|
||||
<>
|
||||
@@ -23,13 +31,18 @@ export default function EndNode(props: NodeProps<Node>) {
|
||||
<div className={"flex-row gap-sm"}>
|
||||
End
|
||||
</div>
|
||||
<Handle type="target" position={Position.Bottom} id="norms"/>
|
||||
<Handle type="source" position={Position.Right} id="source"/>
|
||||
<Handle type="target" position={Position.Left} id="target"/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Functionality for reducing this node into its more compact json program
|
||||
* @param node the node to reduce
|
||||
* @param nodes all nodes present
|
||||
* @returns Dictionary, {id: node.id}
|
||||
*/
|
||||
export function EndReduce(node: Node, nodes: Node[]) {
|
||||
// Replace this for nodes functionality
|
||||
if (nodes.length <= -1) {
|
||||
@@ -40,6 +53,12 @@ export function EndReduce(node: Node, nodes: Node[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Any connection functionality that should get called when a connection is made to this node
|
||||
* @param thisNode the node of which the functionality gets called
|
||||
* @param otherNode the other node which has connected
|
||||
* @param isThisSource whether this node is the one that is the source of the connection
|
||||
*/
|
||||
export function EndConnects(thisNode: Node, otherNode: Node, isThisSource: boolean) {
|
||||
// Replace this for connection logic
|
||||
if (thisNode == undefined && otherNode == undefined && isThisSource == false) {
|
||||
|
||||
Reference in New Issue
Block a user