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

How do I position the label above my marker? #4

Open
dnasir opened this issue Nov 5, 2015 · 4 comments
Open

How do I position the label above my marker? #4

dnasir opened this issue Nov 5, 2015 · 4 comments

Comments

@dnasir
Copy link

dnasir commented Nov 5, 2015

Hi,

How do I position the label above my marker?

Thanks.

@nwohaibi
Copy link

@dnasir
hi nasir,

You might achieve that by changing https://github.com/googlemaps/js-map-label/blob/gh-pages/src/maplabel.js#L165-L166
you can add or subtract pixel offsets likewise:

style['top'] = (parseFloat(pos.y)+yoffset) + 'px';
style['left'] = (parseFloat(pos.x)+xoffset) + 'px';

@ffflabs
Copy link

ffflabs commented Dec 17, 2015

If your problem is having the label partially hidden behind the marker, is happens because as of now, this class adds the label to the mapPane, which is the lowest of the panes Object.

if you replace

panes.mapPane.appendChild(canvas);

with

panes.overlayMouseTarget.appendChild(canvas);

Then the label will be appended to the overlayMouseTarget pane, which is above the markerLayer pane.

@hookswitch
Copy link

That (panes.overlayMouseTarget) worked for me, thanks amenadiel!

@rcknr
Copy link

rcknr commented Apr 21, 2016

I found that sometimes canvas elements get selected while zooming in or clicking around.
panes.overlayLayer works a bit better in this respect.

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