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

Added Classes to LinkRenderer #386

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

snakex64
Copy link

I added a "Classes" property to BaseLinkModel which is then used in the LinkRenderer. This allow users to add a css class to the element of a link

@SleemMostafa
Copy link

hello @snakex64 i need added style to link like image or control in size arrow can inform me how can i do this ?

@snakex64
Copy link
Author

snakex64 commented Apr 6, 2024

hello @snakex64 i need added style to link like image or control in size arrow can inform me how can i do this ?

Sorry mate, no idea!
After 5 months I'm still waiting for the simplest ever PR to be merged 😴. Slowly giving up

@Etzix
Copy link

Etzix commented Jun 28, 2024

This is highly needed, and seeing that its not been merged after so long even though its such a simple addition doesn't leave one feeling very hopeful for this repository.

@zHaytam zHaytam changed the base branch from master to develop August 11, 2024 12:47
@zHaytam
Copy link
Collaborator

zHaytam commented Aug 11, 2024

Hello, sorry that this took A LOT of time for me to check it, I was dealing with some stuff.

The "issue" I see in this PR is that I am trying not to put UI properties in the models (Core project) to separate the two, so Classes doesn't fit in BaseLinkModel because it's only UI related, not behavior related.

I'm not sure what to do in this case...

@fernandomondo
Copy link

Hi everyone, I was looking for the exact same feature.

I need to conditionally add a class to a Link (the "g" tag) to change its color, animate it, etc.

The ideal approach, in my view, is to use a custom LinkRenderer. Is it possible to have my own CustomLinkRenderer.cs file being used?

How can I do that?

@Etzix
Copy link

Etzix commented Oct 4, 2024

@zHaytam I apologize for my previous comment, it was insensitive and i will act better in the future.

I still really want this feature so that we are able to individually style links between nodes. Right now you are only able to style all links at the same time as far as i know (except color).

Perhaps its possible to add the "Classes" to the LinkModel instead, and then consume it in the LinkWidget , like we do with Color today? It would give us a way to target individual links for styling, or even behaviour with DOM manipulation.

@snakex64
Copy link
Author

snakex64 commented Oct 4, 2024

Hello, sorry that this took A LOT of time for me to check it, I was dealing with some stuff.

The "issue" I see in this PR is that I am trying not to put UI properties in the models (Core project) to separate the two, so Classes doesn't fit in BaseLinkModel because it's only UI related, not behavior related.

I'm not sure what to do in this case...

Hey! Never got a notification that you replied on here. Kinda forgot about it, I have been using my own fork for a while now.

Do you have any idea how to allow modifying the look of the link renderer other than the proposed implementation ? Being able to change the look of the links is important in many cases.

Thanks for your help,

@zHaytam
Copy link
Collaborator

zHaytam commented Nov 13, 2024

Hey,

The way I see it, LinkModel was an error in the first place OR it should've been in the Blazor package, where it could contain HTML/CSS properties without any problem.

But the base model, as I pictured them, are just base, they should be UI-agnostic. Granted, we only have Blazor right now, but the logic can apply to different frameworks and I wanted to make it possible without changing or cross-using stuff in the projects.

So I see 2 solutions:

  • Etzix's PR, where it's in LinkModel, not the base one
  • Move the non-base models that have framework-specific stuff (e.g. Classes in Blazor) to the Blazor project, but that would maybe make some people angry at me :(

What do you guys think?

Again, sorry for the delay, life has been shit lately but it's getting better and better.

@Etzix
Copy link

Etzix commented Nov 13, 2024

I think going with my PR is the better call. It would make it possible to do what this PR is trying to solve while avoiding the Base models, with the only negative being that you have to use the css :has functionality to target the <g> tag (But the css :has is awesome so you should use it anyways!)

#478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants