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

Zindex changes are not applied #25

Closed
vlada-symphony opened this issue Jun 6, 2019 · 4 comments
Closed

Zindex changes are not applied #25

vlada-symphony opened this issue Jun 6, 2019 · 4 comments

Comments

@vlada-symphony
Copy link

When marker is displayed and z-index prop gets changed, the marker doesn't respect the change. I think the solution is to add watch (similar to the one for watching position changes) and call repaint when z-index prop changes.

@eregnier
Copy link
Owner

eregnier commented Jun 9, 2019

It should work. You may take a look at the live demo https://eregnier.github.io/vue2-gmap-custom-marker/dist/ where there is a sample of z-index live edit component that dynamically toggle on user inputs.

Tell me if it is ok or not.

Regards

@vlada-symphony
Copy link
Author

Hey, thanks for answering. Demo works as expected, but I think this happens only when custom marker is defined with v-for. I updated demo code with something like this:

<gmap-custom-marker
  v-for="marker in myMarkers"
  :key="marker.key"
  :z-index="marker.zIndex" :marker="marker.location"
  :style="{ backgroundColor: marker.background }"
>
  <div class="zindex">
    <center>
      <p>
        <b>{{marker.zIndex}}</b>
      </p>
      <button @click="marker.zIndex++">+</button>
      <button @click="marker.zIndex--">-</button>
    </center>
  </div>
</gmap-custom-marker>

and myMarkers is defined like this:

data() {
  return {
    myMarkers: [
      {
        location: { lat: 50.4272265, lng: 2.95 },
        key: 0,
        background: "#bbdddd",
        zIndex: 50,
      },
      {
        location: { lat: 50.4272265, lng: 2.80 },
        key: 1,
        background: "#ddbbdd",
        zIndex: 51,
      },
    ],
  },
}

And then the bug reproduced. <b>{{marker.zIndex}}</b> updates its text correctly, but z-index isn't updated until the map is moved or zoomed in/out (which is why I assumed repaint method isn't called or something).

@eregnier
Copy link
Owner

eregnier commented Jun 9, 2019

solved in 5.5.4 version, npm is up to date with the fix.

@eregnier eregnier closed this as completed Jun 9, 2019
@eregnier
Copy link
Owner

eregnier commented Jun 9, 2019

Thank you @vlada-symphony for help in this plugin improvement.

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

No branches or pull requests

2 participants