Skip to content

Commit ebcec59

Browse files
committed
feat: can now specify layer for code block markers
1 parent aa03ccc commit ebcec59

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/renderer/renderer.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,9 @@ export class LeafletRenderer extends MarkdownRenderChild {
263263
}
264264

265265
async buildMap(): Promise<void> {
266-
this.options.localMarkerTypes = await this.plugin.getLocalFileMarkers(this.file);
266+
this.options.localMarkerTypes = await this.plugin.getLocalFileMarkers(
267+
this.file
268+
);
267269

268270
if (this.options.type === "real") {
269271
this.map = new RealMap(this, this.options);
@@ -697,14 +699,14 @@ export class LeafletRenderer extends MarkdownRenderChild {
697699
maxZoom
698700
]) => {
699701
return {
700-
type: type,
702+
type,
701703
loc: [Number(lat), Number(long)],
702704
percent: undefined,
703705
link: link?.trim(),
704-
id: id,
705-
layer: layer,
706+
id,
707+
layer,
706708
mutable: false,
707-
command: command,
709+
command,
708710
description: desc,
709711
minZoom,
710712
maxZoom,
@@ -756,7 +758,7 @@ export class LeafletRenderer extends MarkdownRenderChild {
756758
continue;
757759
}
758760

759-
let [type, lat, long, link, description, minZoom, maxZoom] =
761+
let [type, lat, long, link, description, minZoom, maxZoom, layer] =
760762
data[0];
761763

762764
if (!type || !type.length || type === "undefined") {
@@ -771,12 +773,20 @@ export class LeafletRenderer extends MarkdownRenderChild {
771773
continue;
772774
}
773775
let min, max;
774-
if (isNaN(Number(minZoom))) {
776+
if (
777+
minZoom == null ||
778+
minZoom.length == 0 ||
779+
isNaN(Number(minZoom))
780+
) {
775781
min = undefined;
776782
} else {
777783
min = Number(minZoom);
778784
}
779-
if (isNaN(Number(maxZoom))) {
785+
if (
786+
maxZoom == null ||
787+
maxZoom.length == 0 ||
788+
isNaN(Number(maxZoom))
789+
) {
780790
max = undefined;
781791
} else {
782792
max = Number(maxZoom);
@@ -796,7 +806,7 @@ export class LeafletRenderer extends MarkdownRenderChild {
796806
Number(lat),
797807
Number(long),
798808
link,
799-
null,
809+
layer,
800810
false,
801811
null,
802812
description,

0 commit comments

Comments
 (0)