Skip to content

Commit

Permalink
feat: adding methods to tileLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin committed Mar 6, 2025
1 parent 2e1fe9c commit 334b316
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions js/features/createTileLayer/tileLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ export class TileLayer implements TileLayerInterface {
this.getAttribution().addTo(this.mapInstance.getMap());
}

public removeTileLayer(): void {
this.getTileLayer().remove();
this.getAttribution().remove();
}

public setUrl(url: string): void {
this.getTileLayer().setUrl(url);
}

private getAttribution(): L.Control.Attribution {
return this.attribution;
}
Expand Down
3 changes: 2 additions & 1 deletion js/features/createTileLayer/tileLayerInterface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AddTo } from "../../addToInterface";

export interface TileLayerInterface extends AddTo {

setUrl(url: string): void;
removeTileLayer(): void;
}

0 comments on commit 334b316

Please sign in to comment.