spatialillusions / milsymbol

Military Symbols in JavaScript
www.spatialillusions.com/milsymbol
MIT License
531 stars 132 forks source link

Change Font Size and position of additionalInformation #269

Closed simonhuwiler closed 2 years ago

simonhuwiler commented 2 years ago

Hi there

Really like your work here! I came across this issue: I d'like to increase the fontsize of additionalInformation and move the label a bit. I tried it with addLabelOverrides but does not seem to work this way. Is there a solution?

ms.addLabelOverrides(
  function tacticalPoints(sidc) {

    var o = {
      additionalInformation: {
        stroke: false,
        textanchor: "middle",
        x: 100,
        y: -70,
        fontsize: 400
      }
    }

    // Tests
    sidc['SHGPUCIZ---H'] = o
    sidc['SHGPUCIZ--'] = o
    sidc['SHGPU-------'] = o
    sidc['S'] = o

  },
  "letter" //Setting letter as SIDC type
);

Best regards, Simon

spatialillusions commented 2 years ago

If you have generated any symbols before you try to modify the labels it could be that the label placements already are in the label cache… Check out textfields.js.

/Måns

On 23 Apr 2022, at 10:56, Simon Huwiler @.***> wrote:

 Hi there

Really like your work here! I came across this issue: I d'like to increase the fontsize of additionalInformation and move the label a bit. I tried it with addLabelOverrides but does not seem to work this way. Is there a solution?

ms.addLabelOverrides( function tacticalPoints(sidc) {

var o = {
  additionalInformation: {
    stroke: false,
    textanchor: "middle",
    x: 100,
    y: -70,
    fontsize: 400
  }
}

// Tests
sidc['SHGPUCIZ---H'] = o
sidc['SHGPUCIZ--'] = o
sidc['SHGPU-------'] = o
sidc['S'] = o

}, "letter" //Setting letter as SIDC type ); Best regards, Simon

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

simonhuwiler commented 2 years ago

Found the problem: Works with sidc S-GPUCIZ-- instead of SHGPUCIZ--. Would be nice if they were a generall way to change it for all icons, but I can work with that. Thanks again for your work!