S
S
Socrates2019-07-15 11:57:02
Yandex maps
Socrates, 2019-07-15 11:57:02

Clear object from events?

Good afternoon, I'm drawing polygons, I put the polygon removal event on the delete button:

doDeletePolygon() {
      const t = this;

      this.mapObject.geoObjects.events.add(
        "click",
        function(e) {
          if (e.get("target").getParent() == this) {
            this.remove(e.get("target"));
            t.currentZone.polygons = t.currentZone.polygons.filter(
              zone => zone.id !== e.get("target").options.get("id")
            );
            t.$store.commit("changeCurrentZone", t.currentZone);
          }
        },
        this.mapObject.geoObjects
      );
    },

then saving the zone with polygons, everything seems to be fine, it was saved to the database, the necessary ones are drawn on the map, but the event still hangs on the objects, and by clicking further on the polygons they are still deleted.
Are there any suggestions?
tried:
this.mapObject.geoObjects.removeAll();
this.mapObject.geoObjects.events.removeAll();
past

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Socrates, 2019-07-17
@Karmov69

this.mapObject.geoObjects.events.types.click = undefined;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question