bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
927 stars 330 forks source link

The folding/folding function causes the image within the node to flash #408

Closed tangtingtt closed 6 months ago

tangtingtt commented 6 months ago

Hello author, Currently, when I fold/unfold child nodes, the elements of the parent node will be reloaded (the avatar img will be re rendered). Is there a way to solve this problem? 2 I wrote the avatar implementation in the nodeContent function image

bumbeishvili commented 6 months ago

Hi, that only happens if caching is disabled (for example when you are checking out the chart with dev tools open). I don't think that there is a way around it since when expanding and collapsing, everything is being rendered, including images

tangtingtt commented 6 months ago

thanks,😊Do you mean when caching is disabled in browser developer tools?

---Original--- From: "David @.> Date: Wed, May 29, 2024 19:17 PM To: @.>; Cc: @.**@.>; Subject: Re: [bumbeishvili/org-chart] The folding/folding function causes theimage within the node to flash (Issue #408)

Hi, that only happens if caching is disabled (for example when you are checking out the chart with dev tools open). I don't think that there is a way around it since when expanding and collapsing, everything is being rendered, including images

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

bumbeishvili commented 6 months ago

Yes, when caching is disabled, flickering happens, because the image is being loaded once again, if caching is allowed, then image loading is instantaneous and while image loading still happens from a cache, it's not noticeable

tangtingtt commented 6 months ago

Ok, I will go to the company tomorrow to have a try, thank you for your reply, good luck!

---Original--- From: "David @.> Date: Wed, May 29, 2024 20:38 PM To: @.>; Cc: @.**@.>; Subject: Re: [bumbeishvili/org-chart] The folding/folding function causes theimage within the node to flash (Issue #408)

Yes, when caching is disabled, flickering happens, because the image is being loaded once again, if caching is allowed, then image loading is instantaneous and while image loading still happens from a cache, it's not noticeable

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

tangtingtt commented 6 months ago

After testing, it is indeed caused by disabling browser caching, so this is not a problem. Thank you very much! 😀However, en...,I have another small question. If I want to use the mouse to select elements within a node (ordinary text implemented by div tags) for copying, what kind of attribute should I set? @bumbeishvili I see that in your example(https://stackblitz.com/edit/js-1kytuv?file=index.html), you can select the text within the node, but I don't understand why or how I should implement it.

bumbeishvili commented 6 months ago

@tangtingtt When you are trying to select the text, panning event fires and chart is being panned

This is controlled by built-in d3.zoom class.

In that example, we are passing different d3. zoom class and we override the behavior, basically saying that don't apply panning to TR,TD, TH elements.

If you require text selection of specific divs, you can assign a specific class to them and then check if e.srcElement has that class inside this function (instead of checking if it is TR,TD or TH elements)

image

tangtingtt commented 6 months ago

@tangtingtt When you are trying to select the text, panning event fires and chart is being panned

This is controlled by built-in d3.zoom class.

In that example, we are passing different d3. zoom class and we override the behavior, basically saying that don't apply panning to TR,TD, TH elements.

If you require text selection of specific divs, you can assign a specific class to them and then check if e.srcElement has that class inside this function (instead of checking if it is TR,TD or TH elements)

image

According to your method, I succeeded. Thank you very much!