P
P
Pavel Kononenko2015-07-07 16:44:52
JavaScript
Pavel Kononenko, 2015-07-07 16:44:52

How to set a custom type of clusterer for Yandex maps built on the basis of the label class?

Hello. Can you please tell me how to make a custom view clusterer icon based on a class (or something else)? You can't post a picture for a number of reasons. You need the html content.

var squareLayout = ymaps.templateLayoutFactory.createClass("<div class='marker-label'>"
                      + "<div class='marker-label__head'></div>"
                      + "<div class='marker-label__body'></div>"
                  + "</div>", {
    
        build: function () {
            squareLayout.superclass.build.call(this);

            this._events = ymaps.domEvent.manager.group(this.getElement());
            this._events.add('click', function () {
                alert(this.getData().geometry.getCoordinates());
            }, this);
        },
        
        clear: function () {
            this._events.removeAll();
            squareLayout.superclass.clear.call(this);
        }
    });

With conventional markers, everything is extremely clear. It's done like this:
new ymaps.Placemark(
            [25, 15], {}, {
                iconLayout: squareLayout,
                iconPane: 'overlaps'
            }
        );

And how can this be applied to the clusterer? I would also like to be able to display the number of clustered elements on it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kukabarra, 2015-07-07
@premas

Look at the 4th example in the documentation https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/ref...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question