missioncommand / mil-sym-js

(RETIRED) MIL-STD-2525 symbol rendering JavaScript library for modern web applications
Apache License 2.0
76 stars 25 forks source link

Error when use SinglePointSVGRenderer.renderSPTG #44

Closed ivanKyka closed 2 years ago

ivanKyka commented 2 years ago

When i use method renderSPTG I have an error TypeError: ti.getTextBounds is not a function

Call params: symbolId: 'GUFPPCR-------X' modifiers: { KEEPUNITRATIO: true SIZE: 60 T: "123123" }

I found the problem. In file SinglePointSVGRenderer.js:2793 Renderer trying to call method getTextBounds which not exist. var labelWidth = ti.getTextBounds().getWidth();

michael-spinelli commented 2 years ago

Yes, that is a problem. I'll take a look. Probably a small fix.

michael-spinelli commented 2 years ago

Made 2 updates to the code: -SVGTextInfo, added missing getTextBounds function -SinglePointSVGRenderer, adjusted scaling of Single Point Tactical Graphics when KeepUnitRatio == true. It should be closer to the scaling in SinglePointRenderer.

Let me know if that works for you.

ivanKyka commented 2 years ago

Works great, thanks!