-
Notifications
You must be signed in to change notification settings - Fork 1
π΅ Node
File: Meesterproef-SNSimulation/js/Node.js
The Node class represents a node in the network. It serves as a base class for other types of nodes, such as Person and Post. The Node class includes methods for drawing the node, handling links, and managing interactions.
-
constructor(id, label, x, y, radius): Initializes a new instance of theNodeclass.-
Parameters:
-
id(number): The unique identifier for the node. -
label(string): The label for the node (e.g., "Person", "Social Media Post"). -
x(number): The x-coordinate of the node. -
y(number): The y-coordinate of the node. -
radius(number): The radius of the node.
-
- View Code
-
Parameters:
-
draw(): Draws the node on the canvas, creating a DOM element and positioning it based on the node's coordinates.- Returns: HTMLElement - The created node element.
- View Code
-
linkHandler(node, links, filteredEdges): Handles link actions based on the type of node. Calls eitherfriendsHandleroritemHandler.-
Parameters:
-
node(Node): The node to link with. -
links(Map): The map of links in the network. -
filteredEdges(Array): The list of filtered edges.
-
- View Code
-
Parameters:
-
friendsHandler(node, links): Handles friend actions, adding or removing friends.-
Parameters:
-
node(Node): The node to handle as a friend. -
links(Map): The map of links in the network.
-
- View Code
-
Parameters:
-
itemHandler(node, links, filteredEdges): Handles item actions, adding or removing item links.-
Parameters:
-
node(Node): The node to handle as an item. -
links(Map): The map of links in the network. -
filteredEdges(Array): The list of filtered edges.
-
- View Code
-
Parameters:
-
π Debrief
-
β οΈ Problem definition -
π§βπ¨ Design
-
π§βπ» Solution & Code
- ποΈ App (main file)
- π€ Simulation
- π΅ Node
- π Person
- π° Post
- γ°οΈ Edge
βοΈ Cursor- π½ userData
- π WebData
- π Import & Export (FileHandler)
- Onboarding
-
π€ Recommendations