Comments (3)
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.
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.
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)
- MarkerView is not removed from the MapView HOT 5
- rectangular tiles HOT 1
- scrollTo / scrollToAndCenter using different coordinates after scaling HOT 6
- Can you support drawing points? HOT 2
- Draw polygon HOT 1
- BitmapFactory: bitmap marked for reuse HOT 3
- Non-existent zoom on an overlay. HOT 21
- Clear memory HOT 2
- maker cant be moved as MapCompose HOT 1
- can you support Marker Drag? HOT 4
- Mini gaps between tiles HOT 2
- How to click or long click on map to add marker.
- Support for .png deep zoom map
- bitmap marked for reuse can't fit new bitmap error (100% reproducible) for Remote HTTP mapview HOT 5
- Possibility to zoom farther out? HOT 1
- Issue when setting compileSdkVersion to 34 HOT 2
- Offset/padding? HOT 7
- Can you add azimuth and map scale? HOT 1
- Setting minimum scale mode and zooming below FILL equivalent gives scaling issues HOT 3
- Best performance for many markers HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapview.