R
R
Roman Volkov2015-07-03 22:36:14
JavaScript
Roman Volkov, 2015-07-03 22:36:14

How to set multiple icons in ynadex map api 2.1?

Essence. Each object on the map has a category (categories are repeated). Each category should have its own icon. Yandex icons are specified like this {preset: islands#greenIcon}, and if you create your own, there are more such fields. But interesting: how to create an icon so that it can be received by 'myIcon#food'?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Petrov, 2015-07-04
@white_wolf_17

1. Draw a sprite with icons. 2. We create our own preset
for each section of the sprite , including for various states. An example of using presetStorage How to asynchronously change the picture of a marker on Yandex maps? 3. For each category, create a collection and set the desired preset for it from among the previously created ones. 4. We hang the handler of the necessary events on the collection ( click , hover etc.) and change the preset to the desired one (if necessary). 5. Add objects to the collection.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question