Coder Social home page Coder Social logo

Comments (7)

vlada-symphony avatar vlada-symphony commented on July 19, 2024 2

I tried event.preventDefault(); on the marker handler, but thats not working :-)

I think what you want is event.stopPropagation(), so basically replace @click.native="onMarkerClicked($event, marker)" with @click.native.stop="onMarkerClicked($event, marker)".

from vue2-gmap-custom-marker.

eregnier avatar eregnier commented on July 19, 2024

Can you tell me what is the exact problem you have with this code ? any undesired effect ? what do you want to do and what does fails ?
I may help you better with more context :)

from vue2-gmap-custom-marker.

markmooibroek avatar markmooibroek commented on July 19, 2024

The undesired effect is that when on clicking on the marker the map click is also detected. I want the click on the marker to add a marker to a selection and if no marker is clicked I want to clear the selection. And because the maps.click is triggered after the marker.click my selection is not working.

Hope this clears it up a bit :-)

from vue2-gmap-custom-marker.

eregnier avatar eregnier commented on July 19, 2024

Thank you for details. I don't know if there is good patterns for this.

I have 2 solutions in mind :

  1. do it well by understanding gmap api, handle events properly and so on.
    I have no time for this at the moment, but any help would be appreciated :)

  2. Do an adhoc handling that I woud do like this :

lastMarkerClickTime = + new Date() //save the date in marker click callback

and on the map click callback

if (+ new Date() - lastMarkerClickTime > 300) {
    /*if one marker was clicked more than 300 ms ago then clear*/ 
   clearMap()
}

Is it enought for your needs ?

from vue2-gmap-custom-marker.

markmooibroek avatar markmooibroek commented on July 19, 2024

Awesome! Works like a charm. Not too advanced with Vue yet. Thanks for helping!

from vue2-gmap-custom-marker.

eregnier avatar eregnier commented on July 19, 2024

@vlada-symphony : Perfect 👍 I did not know this (or just forgot about it). thank you for help and improvements. ✔️

from vue2-gmap-custom-marker.

cjlaborde avatar cjlaborde commented on July 19, 2024

@vlada-symphony thank you so much!
Been testing for over an hour to fix a similar issue.

from vue2-gmap-custom-marker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.