clientIO / joint

A proven SVG-based JavaScript diagramming library powering exceptional UIs
https://jointjs.com
Mozilla Public License 2.0
4.71k stars 851 forks source link

Vectorizer: can not convert zero-length arc to curve #2465

Closed kumilingus closed 7 months ago

kumilingus commented 10 months ago

Discussed in https://github.com/clientIO/joint/discussions/2464

Originally posted by **gordon-brown** January 3, 2024 ### Introduction I'm having an issue rendering one of the clip art shapes I converted. It seems to me to be related to rendering elliptical curves in the path data. I can render the shape on the https://www.svgviewer.dev/ site. Not sure if I am doing something wrong or if this is an issue with your software. [BPMN_StoredData-202401030954.joint.txt](https://github.com/clientIO/joint/files/13820532/BPMN_StoredData-202401030954.joint.txt) ![Screenshot 2024-01-03 100103](https://github.com/clientIO/joint/assets/32515524/088c92a0-aefe-415b-9b5b-bf24454ee7de) ![Screenshot 2024-01-03 100348](https://github.com/clientIO/joint/assets/32515524/b90d978b-b8c9-48e6-acbc-8ec4f9060e5a) ### Steps to reproduce _No response_ ### Restrictions & Constraints _No response_ ### Does your question relate to JointJS or JointJS+. Select both if applicable. JointJS

There seems to be an issue with an arc command that has zero length and our code is not able to convert it to the curve command. I am changing the question to a bug.

It works if you define your path like this: 'M 5.555555555555555 0L 50 0A 5.555555555555555,25 0 0,0 50,50 L 50,50L 5.555555555555555 50A 5.555555555555555,25 0 0,1 5.555555555555555,0Z'

From Artur

Visio implications

Also, this is happening when importing joint-format-visio\test\visual\fixtures\Chapter05\Network diagram_start.vsdx. Path

M 0 0 M 32 4 A 3.95 3.95 0 0 1 24.49 3.95 A 3.95 3.95 0 0 1 32.39 3.95 A 3.95 3.95 0 0 1 32.39 3.95

normalized using V.normalizePathData with NaNs as

M 0 0 M 32 4 C 31.03738563658328 6.884319592775694 27.313384109109503 7.644958723402278 25.296797250840925 5.369150434247764 C 24.931981254846672 4.957439297533957 24.65718116651638 4.474067961804264 24.49 3.95 C 24.49 0.9092885822679708 27.781666666666666 -0.9911560538145481 30.415 0.5291996550514662 C 31.637134253196088 1.2347991951200896 32.39 2.5388009198627532 32.39 3.95 C NaN NaN NaN NaN 32.39 3.95
zbynekstara commented 7 months ago

Fixed as part of JointJS v4.0.2 (JointJS+ v4.0.1)