Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic React: Error while importing the shape library (Read 447 times)
Kamil
YaBB Newbies
*
Offline



Posts: 22
Joined: Aug 22nd, 2024
React: Error while importing the shape library
Nov 21st, 2024 at 11:29am
Print Post  
Hello! I'm trying to import shape library in my react code:
Code (Javascript)
Select All
    const library = new mfDiagramming.ShapeLibrary([]);
    library.loadFromXml("myPath/assets/customShapes.xml");
 


The result is an error produced by mindfusion (please see the screenshot).
Could you advise me on how to resolve this problem?
  

error-mindfusion.png ( 11 KB | 25 Downloads )
error-mindfusion.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3323
Joined: Oct 19th, 2005
Re: React: Error while importing the shape library
Reply #1 - Nov 21st, 2024 at 12:47pm
Print Post  
Hi,

Please attach the xml file.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Kamil
YaBB Newbies
*
Offline



Posts: 22
Joined: Aug 22nd, 2024
Re: React: Error while importing the shape library
Reply #2 - Nov 22nd, 2024 at 8:20am
Print Post  
Sure, here's the file.
  

CustomShapes.xml ( 10 KB | 17 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3323
Joined: Oct 19th, 2005
Re: React: Error while importing the shape library
Reply #3 - Nov 25th, 2024 at 11:54am
Print Post  
Hi,

New scripts here should load the shape library -

https://mindfusion.eu/_beta/jsdiag45.zip

1. JavaScript version did not have any support for TextArea elements in the custom shapes. Our developer's implemented initial TextArea parsing, but only for rectangles. For arbitrary polygons we'd also have to implement the PolygonalTextLayout property from our desktop controls, but that won't make it for the v4.5 release. Until it's available, you might want to create a separate shape library for JS version with smaller TextArea rectangles; otherwise the library arranges text in the TextArea's bounding rectangle and might cover some parts of the shape you would not expect.

2. We can see one of the EfficiencyCurve shape line segments drawn at incorrect coordinates. Our developer will fix that for the v4.5 release (hopefully available later this week).

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Kamil
YaBB Newbies
*
Offline



Posts: 22
Joined: Aug 22nd, 2024
Re: React: Error while importing the shape library
Reply #4 - Nov 26th, 2024 at 11:26am
Print Post  
Thank you for the explanation and the file.
We decided to wait until the fix is ready on npm. So, did I understand correctly and v4.5 will not crash while loading my file?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3323
Joined: Oct 19th, 2005
Re: React: Error while importing the shape library
Reply #5 - Nov 26th, 2024 at 12:38pm
Print Post  
V4.5 won't crash, but you might have to modify the text area definitions in your online version, to adjust for the missing polygonal-text-layout support. At this time the diagram will arrange text inside bounding rectangle of the text area coordinates, and so might cover some parts of the node that are not covered in desktop version.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Kamil
YaBB Newbies
*
Offline



Posts: 22
Joined: Aug 22nd, 2024
Re: React: Error while importing the shape library
Reply #6 - Nov 27th, 2024 at 8:28am
Print Post  
Ok, thank you for clarification Smiley
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3323
Joined: Oct 19th, 2005
Re: React: Error while importing the shape library
Reply #7 - Dec 2nd, 2024 at 2:01pm
Print Post  
that's now available on npm -

https://www.npmjs.com/package/@mindfusion/diagramming/v/4.5.0

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Kamil
YaBB Newbies
*
Offline



Posts: 22
Joined: Aug 22nd, 2024
Re: React: Error while importing the shape library
Reply #8 - Dec 3rd, 2024 at 8:38am
Print Post  
Roger that! Thanks Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint