Coder Social home page Coder Social logo

Comments (5)

p-lr avatar p-lr commented on July 4, 2024

Hi,

You should use MapView.removeMarker(marker) api, not removeView:

private fun removeAnimMarker() {
    mapView.removeMarker(animMarker)
}

from mapview.

sana-20 avatar sana-20 commented on July 4, 2024

Hi @peterLaurence.

It does not work though I changed the code as you answered.
Not only does the marker still remain, but it is not anchored in the center position that I set. (4096, 4096)
It moved whenever the map's zoom level or camera position changed.

sample2.mp4

from mapview.

p-lr avatar p-lr commented on July 4, 2024

Hi @sana-20 ,

I can't reproduce your issue. I've updated the demo of MapView to showcase how to remove a marker. Inside the "Map and Markers demo", you'll see a red circular marker which you can remove/add using the button at the bottom.
See the code is in MapMarkersFragment of the demo.

I suggest that you make a github repo reproducing your issue.

from mapview.

sana-20 avatar sana-20 commented on July 4, 2024

Hi @peterLaurence,

I really appreciate your help.
Adding and removing a marker works perfectly without an animation.
But the tricky part is when I added an animation to a marker.
Even though I clicked a remove button, it does not disappear.
It looks like gone at glance, but when you changed the zoom level, you can see a marker still remaining.

See the code here.

from mapview.

p-lr avatar p-lr commented on July 4, 2024

Indeed, with an animation set, I could reproduce.
I managed to solve the issue by invoking clearAnimation() on the marker right before removing it. So for your use case:

private fun removeAnimMarker() {
    animMarker?.clearAnimation()
    mapView.removeMarker(animMarker)
}

You can use this fix in the meantime. I'll add clearAnimation in the MapView.removeMarker api.

from mapview.

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.