Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Support Retina Displays #3

Open
bobymicroby opened this issue May 3, 2015 · 5 comments
Open

Support Retina Displays #3

bobymicroby opened this issue May 3, 2015 · 5 comments

Comments

@bobymicroby
Copy link

If you add this lines to MapLabel.prototype.onAdd

canvas.width = 500;
canvas.height = 500;
canvas.style.width = "250px";
canvas.style.height = "250px";

You can support hi-res displays. Otherwise the labels look blurry.

@whysoserious
Copy link

Works like a charm, thanks @bobymicroby

@bobymicroby
Copy link
Author

@whysoserious 👍

@doubleswirve
Copy link

Thanks! @bobymicroby

@msikma
Copy link

msikma commented Oct 18, 2016

Unfortunately this breaks center-aligning the labels. Haven't figured out a nice solution yet.

@a6o
Copy link

a6o commented Aug 31, 2017

To fix @msikma s problem

MapLabel.prototype.getMarginLeft_ = function(textWidth) {
  switch (this.get('align')) {
    case 'left':
      return 0;
    case 'right':
      return -textWidth;
  }
  return textWidth / -4;
};

Basically, instead of dividing by -2, divide by -4, since ratio of canvas size and canvas style is 2, i have doubled down the number

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants