You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For clarity, I think you're comparing a segment with the whole path. I think your actual result should be showing just a segment. And therfore, from your codepen, this is your actual result
if you do console.log(JSON.stringify(secondSegment)) you get this:
though it may be handleOut could be omitted since it is 0,0
The real issue, which you've not mentioned, is when you JSON.Parse(...) you do not get back to the Segment object. The question is why does stringify trash the object structure in this way, and what is the workaround.
Description/Steps to reproduce
Stringifying a segment leads to just an array, instead of an object with labeled properties like point, handleIn, and handleOut."
Link to reproduction test-case
https://codepen.io/nikola12334/pen/JjgopMK
Expected result
"segment":{"point":{"x":242,"y":259},"handleIn":{"x":0,"y":0},"handleOut":{"x":0,"y":0}}
Actual result
"['Path',{'applyMatrix':true,'segments':[[[100,50],[0,0],[80,100]],[[300,50],[-80,-100],[0,0]]],'strokeColor':[0,0,0]}]"
Additional information
mac os: 14.6.1 , Node: v16.13.0
The text was updated successfully, but these errors were encountered: