Skip to content
This repository was archived by the owner on Nov 6, 2019. It is now read-only.
This repository was archived by the owner on Nov 6, 2019. It is now read-only.

Zoom issue when passing styles to GoogleLayers #31

@aqueiros

Description

@aqueiros

Greetings,

I have the following working code which works fine:

import { Map, ZoomControl } from 'react-leaflet'
import { GoogleLayer} from 'react-leaflet-google';

export class MapContainer extends React.Component {
  (...)
  render() {
    return (
      <Map id="map" ref={this.mapRef} zoomControl={false}>
        <ZoomControl position="bottomright" />
        <GoogleLayer
          googlekey={my_key}
          maptype='ROADMAP'
        />
      </Map>
    );
  }
}

However, when I try to create a GoogleLayer with only labels like this:

import { Map, ZoomControl } from 'react-leaflet'
import { GoogleLayer} from 'react-leaflet-google';

export class MapContainer extends React.Component {
  (...)
  render() {
    return (
      <Map id="map" ref={this.mapRef} zoomControl={false}>
        <ZoomControl position="bottomright" />
        <GoogleLayer
          googlekey={my_key}
          maptype='ROADMAP'
          styles ={[
            {elementType: 'all', stylers: [{visibility: 'off'}]},
            {elementType: 'labels', stylers: [{visibility: 'on'}]},
          ]}
        />
      </Map>
    );
  }
}

I run into a problem with the zoom. After zooming out, and then zooming in again, I end up with a mix of labels from the previous zoom and the new one:

screenshot 2018-11-05 15 01 50

This clears out, after I do one or two more zoom ins

I'm using
react-leaflet-google@3.3.1
react-leaflet@1.9.1
leaflet@1.3.1

Anyone experienced this before?

Thank you!

EDIT:

This is reproducible event if I try disabling only landscape features:

styles ={[ 
     {featureType:"landscape", stylers: [{visibility: 'off'}]},
]}

screenshot 2018-11-05 15 54 19

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