yandex / mapkit-android-demo

MapKit Android demo
Other
121 stars 59 forks source link

Анимация клстеризации пинов на карте #236

Open donik opened 3 years ago

donik commented 3 years ago

collection.clusterPlacemarks(withClusterRadius: 60, minZoom: 15)

при добавлении новых точек обновляя кластеризацию пины начинают появляться с анимацией даже если они уже есть внутри кластера. Есть ли возможность отключить анимацию появления?

DemaFay commented 3 years ago

Привет. У меня такая же проблема. Не удалось решить?

donik commented 3 years ago

Я написал в поддержку, служба отвечает, а разрабы нет 🤣

cream-cheeze commented 3 years ago

Невозможно кластерами пользоваться - всё моргает как новогодняя ёлка!

cream-cheeze commented 3 years ago

Вон такой же issue аж с 2020 года висит...

donik commented 2 years ago

Привет. У меня такая же проблема. Не удалось решить?

я решил проблему костылём

 fun updateItems(newItems: List<ChargingStation>) {
        val newCollection =
            this.mapView.mapWindow.map.mapObjects.addClusterizedPlacemarkCollection(this)

        for (item in newItems) {
            val marker = newCollection.addPlacemark(
                Point(
                    item.location.getLocation().latitude,
                    item.location.getLocation().longitude
                ),
                ImageProvider.fromBitmap(
                    if (item.type == "info") {
                        infoIconMarker?.toBitmap()
                    } else {
                        iconMarker?.toBitmap()
                    }
                ),
                IconStyle(
                    PointF(0.5f, 0.5f),
                    RotationType.ROTATE,
                    1.0f,
                    true,
                    true,
                    1.0f,
                    null
                )
            )
            marker.userData = item
            marker.addTapListener(this)
        }

        newCollection.clusterPlacemarks(40.0, 12)
        newCollection.setVisible(false, Animation(Animation.Type.LINEAR, 0.0f), null)

        val weakSelf by weak(this)
        UIKit.post({
            val strongSelf = weakSelf ?: return@post
            try {
                strongSelf.mapView.mapWindow.map.mapObjects.remove(strongSelf.collection)
            } catch (_: Exception) {
            }

            strongSelf.collection = newCollection
            newCollection.setVisible(true, Animation(Animation.Type.LINEAR, 0.0f), null)
        }, 300)
    }

создал новую коллекцию, добавил на карту и после тайм-аута отобразиил

в айосе все аналогично

YandexMapKit commented 1 year ago

Пожалуйста, пришлите нам минимальный собранный пример, демонстрирующий описанную ситуацию. Вы можете выложить его проектом на GitHub, прикрепить к переписке в архиве или загрузить на Яндекс Диск и указать ссылку.

Мы постараемся помочь.

2021-11-16 18:18:25, donik devnull@yandex.ru:

Привет. У меня такая же проблема. Не удалось решить?

я решил проблему костылём

 fun updateItems(newItems: List<ChargingStation>) {
        val newCollection =
            this.mapView.mapWindow.map.mapObjects.addClusterizedPlacemarkCollection(this)

        for (item in newItems) {
            val marker = newCollection.addPlacemark(
                Point(
                    item.location.getLocation().latitude,
                    item.location.getLocation().longitude
                ),
                ImageProvider.fromBitmap(
                    if (item.type == "info") {
                        infoIconMarker?.toBitmap()
                    } else {
                        iconMarker?.toBitmap()
                    }
                ),
                IconStyle(
                    PointF(0.5f, 0.5f),
                    RotationType.ROTATE,
                    1.0f,
                    true,
                    true,
                    1.0f,
                    null
                )
            )
            marker.userData = item
            marker.addTapListener(this)
        }

        newCollection.clusterPlacemarks(40.0, 12)
        newCollection.setVisible(false, Animation(Animation.Type.LINEAR, 0.0f), null)

        val weakSelf by weak(this)
        UIKit.post({
            val strongSelf = weakSelf ?: return@post
            try {
                strongSelf.mapView.mapWindow.map.mapObjects.remove(strongSelf.collection)
            } catch (_: Exception) {
            }

            strongSelf.collection = newCollection
            newCollection.setVisible(true, Animation(Animation.Type.LINEAR, 0.0f), null)
        }, 300)
    }

создал новую коллекцию, добавил на карту и после тайм-аута отобразиил

в айосе все аналогично