Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial marker label position is wrong in map us_mill_en #299

Open
jorrit opened this issue Dec 19, 2014 · 0 comments · May be fixed by #320
Open

Initial marker label position is wrong in map us_mill_en #299

jorrit opened this issue Dec 19, 2014 · 0 comments · May be fixed by #320

Comments

@jorrit
Copy link
Contributor

jorrit commented Dec 19, 2014

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.

jorrit added a commit to jorrit/jvectormap that referenced this issue Mar 9, 2015
@jorrit jorrit linked a pull request Mar 9, 2015 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant