Skip to content

Commit

Permalink
feat: remove select interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertOrthofer committed Sep 27, 2023
1 parent 6c6f410 commit 10342c1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions elements/map/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import View from "ol/View.js";
// @ts-ignore
import olCss from "ol/ol.css?inline";
import { DrawOptions, addDraw } from "./src/draw";
import { SelectOptions, addSelect } from "./src/select";
import { EoxSelectInteraction, SelectOptions, addSelect } from "./src/select";
import {
generateLayers,
EoxLayer,
Expand Down Expand Up @@ -72,6 +72,12 @@ export class EOxMap extends LitElement {
@state()
interactions: { [index: string]: Draw | Modify } = {};

/**
* dictionary of select interactions.
*/
@state()
selectInteractions: { [index: string]: EoxSelectInteraction } = {};

/**
* dictionary of ol controls associated with the map.
*/
Expand Down Expand Up @@ -128,14 +134,23 @@ export class EOxMap extends LitElement {
};

/**
* removes a given interaction from the map. Layer have to be removed seperately
* removes a given ol-interaction from the map. Layer have to be removed seperately
* @param id id of the interaction
*/
removeInteraction = (id: string) => {
this.map.removeInteraction(this.interactions[id]);
delete this.interactions[id];
};

/**
* removes a given EOxSelectInteraction from the map.
* @param id id of the interaction
*/
removeSelect = (id: string) => {
this.selectInteractions[id].remove();
delete this.selectInteractions[id];
};

/**
* removes a given control from the map.
* @param id id of the control element
Expand Down

0 comments on commit 10342c1

Please sign in to comment.