Skip to content

Commit faebfd8

Browse files
gjmooneymartinRenou
authored andcommitted
Fix layer removal bug (geojupyter#101)
1 parent 7a33919 commit faebfd8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

packages/base/src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ export function addCommands(
529529
execute: () => {
530530
const model = tracker.currentWidget?.context.model;
531531
Private.removeSelectedItems(model, 'layer', selection => {
532-
model?.sharedModel.removeLayer(selection);
532+
model?.removeLayer(selection);
533533
});
534534
}
535535
});

packages/schema/src/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
162162
groupName?: string,
163163
position?: number
164164
): void;
165+
removeLayer(id: string): void;
165166
getOptions(): IJGISOptions;
166167
setOptions(value: IJGISOptions): void;
167168

packages/schema/src/model.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ export class JupyterGISModel implements IJupyterGISModel {
343343
this._addLayerTreeItem(id, groupName, position);
344344
}
345345

346+
removeLayer(layer_id: string) {
347+
this._removeLayerTreeLayer(this.getLayerTree(), layer_id);
348+
this.sharedModel.removeLayer(layer_id);
349+
}
350+
346351
setTerrain(terrain: IJGISTerrain) {
347352
this._sharedModel.terrain = terrain;
348353
}

0 commit comments

Comments
 (0)