Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas #267

Merged
merged 28 commits into from
Feb 19, 2025
Merged

Canvas #267

merged 28 commits into from
Feb 19, 2025

Conversation

Xenon27
Copy link
Collaborator

@Xenon27 Xenon27 commented Feb 4, 2025

Screenshot 2025-02-19 at 11 25 00

@Xenon27 Xenon27 self-assigned this Feb 4, 2025
@Xenon27 Xenon27 changed the base branch from feat/io-center-architecture-v2 to main February 4, 2025 15:05
@Xenon27 Xenon27 mentioned this pull request Feb 5, 2025
6 tasks
@Xenon27 Xenon27 linked an issue Feb 5, 2025 that may be closed by this pull request
6 tasks
Copy link
Collaborator

@michelguerin michelguerin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next steps will be to make your code dynamic : a lot is hard coded.

Comment on lines 206 to 215
connections = [
{
from: { node: 'DO X', side: 'right' },
to: { node: 'Logical Component X', side: 'left' }
},
{
from: { node: 'DO Y', side: 'right' },
to: { node: 'Logical Component X', side: 'left' }
}
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this default state can be passed as initialization of the $state variable like this :

let connections = $state<Connection[]>([
		{
			from: { node: 'DO X', side: 'right' },
			to: { node: 'Logical Component X', side: 'left' }
		},
		{
			from: { node: 'DO Y', side: 'right' },
			to: { node: 'Logical Component X', side: 'left' }
		}
	])

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is intended to be dynamic in the future, you'll be able to initialize it in an action and a centralized store (like I did here to init a plugin). I can show you how if you are interested.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, this should be dynamic. Currently, I implemented it this way because I don't yet receive data from the SCD, and I needed an initial reactive action to trigger the drawing. However, a function or action will likely be needed to initialize the default view, ensuring that something is always displayed immediately.

@Xenon27 Xenon27 marked this pull request as ready for review February 6, 2025 11:03
@Xenon27 Xenon27 requested a review from tamasrusz February 6, 2025 11:03
@Xenon27 Xenon27 changed the title draft: Canvas Canvas Feb 6, 2025
@@ -26,16 +26,6 @@

onMount(() => {
window.addEventListener("resize", redrawConnections);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it probably does not belong to this PR but we shouldn't add event listeners manually.
in this case we should use: https://svelte.dev/docs/svelte/svelte-window

@AbdelazizTina-dev AbdelazizTina-dev merged commit e72b9c2 into main Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Diagram Canvas
4 participants