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

Problem with changing default friend color when use bundled files from samples #49

Closed ivanKyka closed 2 years ago

ivanKyka commented 2 years ago

Hi @michael-spinelli ! Now I'm working on migrating our application to Web Workers. For that purpose, I use two files from samples: m-c.js and sv-c.js, which were imported into my custom worker. Rendering works great but I have an error when changing the default friend color to blue. As I see, problem into file armyc2.c2sd.renderer.utilities.RendererSettings. Original files have all the necessary methods, but they are missing in bundled files.

Code which I use to change graphic color:

const friendlyUnitColor = new Color(0, 192, 255);

RendererSettings.setFriendlyGraphicFillColor(friendlyUnitColor);
RendererSettings.setFriendlyGraphicLineColor(friendlyUnitColor);
RendererSettings.setFriendlyUnitFillColor(friendlyUnitColor);
RendererSettings.setFriendlyUnitLineColor(friendlyUnitColor);

SymbolUtilities.rendererSettings.setFriendlyGraphicFillColor(friendlyUnitColor);
SymbolUtilities.rendererSettings.setFriendlyGraphicLineColor(friendlyUnitColor);

SymbolUtilities.rendererSettings.setFriendlyUnitFillColor(friendlyUnitColor);
SymbolUtilities.rendererSettings.setFriendlyUnitLineColor(friendlyUnitColor);
michael-spinelli commented 2 years ago

I'll take a look.

michael-spinelli commented 2 years ago

Looks like those files in the samples folder haven't been updated in a while. If you take the files from the last release and copy them into the samples folder, that should fix your problems. We should've had the build script do that automatically but we didn't. Let me know if that fixes your problem.

ivanKyka commented 2 years ago

All works great! Thanks for your help!