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

Wrong svg files can be created when sending batch data to web renderer #19

Closed xboct25 closed 7 years ago

xboct25 commented 7 years ago

Whenever I am sending batch data to web renderer and one of symbols is "GHSPPY----****X" the following warfighting symbols in the Batch are rendered with "ENY" modifier. In the attached script I am the Symbol "GHSPPY----****X" is created with modifier "ENY", which is correct, but the following Symbol "SFGAUSXOMC*****" is also created with modifier "ENY" which is not correct. But when I reverse the order of symbols everything is rendered correctly. BugReport.zip

michael-spinelli commented 7 years ago

So what's happening is the same modifier object is being passed in for both symbols. For a speed test that's not a big deal. Which it looks like that's what your example was based on. But it's not something you would do in practice as symbols will usually have different modifier values.

So for the hostile symbol, the renderer sees that it's hostile and adds N:ENY to the modifier object. Because that same object is reused for the second symbol, it now also gets the ENY label.

I'm not seeing this as critical so I'm going to put this on the back burner for now. Unless, you see a reason that this should be addressed sooner rather than later.