Z
Z
zlodiak2018-07-29 14:49:28
JavaScript
zlodiak, 2018-07-29 14:49:28

How to clear the collection of custom buttons?

The map has a sight - a circle of a certain radius, always located in the center of the screen. For each marker that hits this scope, a button is added to the screen.
Here JSFIDDLE
The problem is that when the marker goes out of sight, the buttons are not removed from the screen. And I would like to be removed. Please help me fix the code.
The important point is that several markers can hit the scope at the same time.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-07-29
@zlodiak

Remember all the added elements in the array, when you add them again, you perform map.controls.remove for each, something like this .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question