Closed delmohf closed 2 months ago
I found that utility function convertUnit
was not added to svgCanvas instance which looks like the proper behaviour because the opposite operation convertToNum
was indeed added so check my PR #965 which seems a more suitable solution.
I'm using the bundle version of svgedit (as a package
npm i svgedit
), and I wanna useconvertUnit
utility which was defined in the module packages/svgcanvas/core/units.js and attached to SvgCanvas class so I thought it should be used as below:but the following error arised:
getRoundDigits
(or evengetBaseUnit
if I just callSvgCanvas.convertUnit(38)
) is a method of SvgCanvas instance created by EditorStartup during initialization and consequently injected to the moduleunits.js
.The problem is that the instance of
SvgCanvas
is actually in the bundle, not in@svgedit/svgcanvas
.I fixed this issue in a simple way, just re-exporting
SvgCanvas
from Editor.js as show in this pull request but there could be other ways.