Coder Social home page Coder Social logo

Comments (3)

p-lr avatar p-lr commented on June 25, 2024

Hi @sana-20

Assuming your marker is a custom view, you need to scale it in your onDraw() overload.
Here is an example, which draws a line between two points on the map. The line needs to be redrawn when the scale changes, just like your custom markers. You can see that all informations needed (scale, scroll, rotation) is taken from a ReferentialData instance.

To get the updated ReferentialData when e.g the scale changes, you need to use the addReferentialLister API on your MapView (see below the documentation of this API):

/**
 * Add a [ReferentialListener] to the MapView. This [ReferentialListener] will be notified of any
 * change of scale, rotation angle, or rotation pivot point.
 * Using this API, the MapView holds a reference on the provided [ReferentialListener] instance.
 * Don't forget to remove it when it's no longer needed, using [removeReferentialOwner].
 */
 fun addReferentialListener(listener: ReferentialListener) {
    listener.onReferentialChanged(referentialData)
    refListenerList.add(listener)
 }

from mapview.

sana-20 avatar sana-20 commented on June 25, 2024

Hi @peterLaurence. As your explanation, I changed my custom marker class and added addReferentialListener in mapView, then I called resizeMarker() in onReferentialChanged.
It works as intended now. Thanks for your help.

from mapview.

p-lr avatar p-lr commented on June 25, 2024

Great!
One day, when you decide to migrate to Jetpack Compose, there will be a MapCompose library ready: https://github.com/peterLaurence/MapCompose
For now, it's too early (Jetpack Compose is in beta).

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.