Skip to content

Commit

Permalink
fix: fixed issue with tile overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Dec 11, 2021
1 parent c6a8726 commit 22da6cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/map/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,20 @@ export abstract class BaseMap extends Events implements BaseMapDefinition {
});
}
}
console.log(
"🚀 ~ file: map.ts ~ line 669 ~ this.options.tileOverlay",
this.options.tileOverlay
);
if (this.options.tileOverlay && this.options.tileOverlay.length) {
if (this.mapLayers.length) {
this.addLayerControl();

let index = 0;
for (const overlay of this.options.tileOverlay) {
console.log(
"🚀 ~ file: map.ts ~ line 674 ~ overlay",
overlay
);
index++;
const [server, name = `Layer ${index}`] =
overlay.split("|");
Expand Down
18 changes: 10 additions & 8 deletions src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ export class LeafletRenderer extends MarkdownRenderChild {
if (file instanceof TFile) {
this.file = file;
}
let tileLayer: string[] = [];
if (this.params.tileServer && this.params.tileServer.length) {
tileLayer = [this.params.tileServer].flat();
}
let tileOverlay: string[] = [];
if (this.params.tileOverlay && this.params.tileOverlay.length) {
tileOverlay = [this.params.tileOverlay].flat();
}
this.options = {
bounds: this.params.bounds,
context: this.sourcePath,
Expand All @@ -137,14 +145,8 @@ export class LeafletRenderer extends MarkdownRenderChild {
overlayTag: this.params.overlayTag,
overlayColor: this.params.overlayColor,
scale: this.params.scale,
tileLayer:
this.params.tileServer instanceof Array
? this.params.tileServer
: [this.params.tileServer],
tileOverlay:
this.params.tileOverlay instanceof Array
? this.params.tileOverlay
: [this.params.tileOverlay],
tileLayer,
tileOverlay,
type: this.params.image != "real" ? "image" : "real",
unit: this.params.unit ?? this.plugin.defaultUnit,
verbose: this.params.verbose,
Expand Down

0 comments on commit 22da6cc

Please sign in to comment.