Skip to content

Initial marker label position is wrong in map us_mill_en #299

@jorrit

Description

@jorrit

The initial coordinates of marker label is determined in the Marker class constructor:

      x: this.labelX,
      y: this.labelY

While in updateLabelPosition the position is determined using a more complex calculation:

      x: this.labelX * this.map.scale + this.offsets[0] +
         this.map.transX * this.map.scale + 5 + (this.isImage ? (this.shape.width || 0) / 2 : this.shape.properties.r),
      y: this.labelY * this.map.scale + this.map.transY * this.map.scale + this.offsets[1]

This leads to the situation for the us_mill_en map that the label position is wrong when the map is loaded, but is fixed when the map is zoomed or panned.

It can be fixed by calling updateLabelPosition in the constructor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions