Status Update
Comments
ca...@google.com <ca...@google.com>
ca...@google.com <ca...@google.com> #2
Thanks for your suggestion!
We'll be reviewing this for further consideration. Please star this issue to get updates and leave comments for additional information. Please note that starring the issue also provides our product team with valuable feedback on the importance of the issue to our customers.
yo...@google.com <yo...@google.com> #3
Thank you so much for your feedback! Please see my comments below.
1. No way to adjust the "anchor" point of the marker
Applying transform style to the marker content shouldn't affect the marker collision feature, in fact we use the marker content to calculate the marker collision. However, the focus ring may look weird, we will look into that and see if there is a workaround.
2. The Marker doesn't snap to the pixel grid, meaning text is often blurry.
This is a really good catch! We are working on a fix for it.
3. Applying the Cursor style pointer
to the default / pinElement marker.
The pointer
cursor is used to indicate that something is clickable, however, a default marker is not clickable, that's why we don't apply the pointer
cursor to it until the marker becomes clickable. If you really want to have the pointer
cursor for the default marker, you can call marker.element.style.cursor = 'pointer';
, does that work for you?
ne...@geo.me <ne...@geo.me> #4
I re-examined how we were implementing 1 & the transform: translate
wasn't on the topmost element of our HTML, seems to work fine once it is - which makes sense.
On 3, yeah that'll work
yo...@google.com <yo...@google.com> #5
Hello, the team rolled out a fix for #2 to improve the clarity of rendering, could you help verify? Thanks!
ne...@geo.me <ne...@geo.me> #6
Yeah - I've had a look at our storybook entries for the Advanced Marker & can see it now rounds to the nearest pixel on devicePixelRatio=1
displays & the nearest 0.5px on devicePixelRatio=2
displays which makes it look much better in most cases.
However there's potentially still an issue where a change to the content (e.g. a font loading late) can cause it to become blurry, but that may well be a browser issue (Chrome 116) rather than a map one since the translate is whole-pixel values.
It does appear to be reproducible though, so could be worth looking into (assuming you can also reproduce it).
My content is just this
<div><div class="marker-inner" style="padding-inline: 10px; background: white; border: 2px solid purple; border-radius: 5px;"><h3>This is an element that contains children</h3><p>Hopefully with this much text the blurring issue will be more obvious</p></div></div>
I've attached a video where you can see it becoming blurry due to a font shift - then another refresh where I first visit another storybook entry (which is loading the font, presumably) where it doesn't become blurry.
yo...@google.com <yo...@google.com> #7
At first glance, I thought this could be related to
We still need to find the root cause and a better solution, but please let me know if it's still a blocker for you to adopt Advanced Marker API :)
ne...@geo.me <ne...@geo.me> #8
That table
trick is interesting, must cause the element to be re-rasterised properly for some reason.
On the blocking - we wanted to use the gmp-click
event (since setting regular click
resulted in a warning) but that's only available in v=beta
and that doesn't match up with our timeline for this project + the above blurring issue.
So we've gone for regular markers with images this time, which is a bit of a shame since I was hoping to use the advanced markers to get a bit of animation in.
When the next project kicks off we'll re-evaluate the advanced markers again & switch if they're fully stable
ni...@gmail.com <ni...@gmail.com> #9
Ri...@Wanadoo.Fr <Ri...@Wanadoo.Fr> #10
I use AdvancedMarkers to draw SVG markers on a map.
I also need to center them on their latitude and longitude (issue #1) and I don't know how to do it with "transform: translate"
That would be so nice of you if you could show a basic example where you center an advanced marker with "transform: translate"
I have tried to look at the source code of
body[data-page-id=weather-marker] city-marker {
position: absolute;
transform: translate(-1.8em,-1.8em)
}
in index.ba848db8.css , but this is way too complex for a beginner like me!
(styles in a CSS file + classes and it even looks like "dynamic classes" and "subclasses", ...)
That is why I would need a basic example to understand how to use "transform: translate".
(Basic for me is all in the same file (HTML+Javascript+style), with maybe 10 or 20 lines of code?)
That would be so nice of you if you can help me!
Thank you!
yo...@google.com <yo...@google.com> #11
Hello, to align the content center to the latlng position, you can simply do:
advancedMarkerElement.content.style.transform = 'translateY(50%)';
Ri...@Wanadoo.Fr <Ri...@Wanadoo.Fr> #12
ma...@gmail.com <ma...@gmail.com> #13
I finally got to try it (after noticing deprecation) - and spent a while trying to find out why it renders SVG-s suspiciously blurry. It wasn't a pixel boundary issue. Old Marker with canvas was fine. Until I noticed a CSS property that is added to every market-view element:
will-change: transform
Disabling that, fixed the rendering.
"Be aware, that will-change may actually influence the visual appearance of elements, when used with property values"
Description
I've given the `AdvancedMarkerElement` a try today & I think there's 3 major things preventing us from moving over:
1. No way to adjust the "anchor" point of the marker
Without this you can only have the "pin" style marker where the bottom point is the anchor point to the map, even in your own demo you need to workaround this (
2. The Marker doesn't snap to the pixel grid, meaning text is often blurry.
I've attached a screenshot showing this, but it's also visible the demo page linked above. It seems like the `translate` applied to the element will output fractional pixels, unlike any of the other text on the map. Not sure if this is a bug or should be a configuration option, could use the `devicePixelRatio` to know wether to round to `0.5px` or `1px`.
3. Applying the Cursor style `pointer` to the default / pinElement marker.
Not sure if this is just related to the inability to set up `addEventListener` on the current `weekly` release channel, but the advanced markers don't seem to change the cursor like other markers on the map do. Easy enough to fix with a custom element, but if we want to use the default / pinElement one we'll need a way to change it there too. Old style markers use `clickable` for this I think.
Thanks,
Neil