Skip to content

Commit e9b294c

Browse files
committed
2.0.2
1. Fixed issue where deleting the base marker caused maps with default markers to not render - Added Layer Marker setting to handle case where user does not want any additional markers layered - A default marker must now always be defined - Fixed issue where changing a marker type caused maps with that type to not render - Improvements to Settings Tab layout
1 parent b402d45 commit e9b294c

File tree

9 files changed

+319
-325
lines changed

9 files changed

+319
-325
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "obsidian-leaflet-plugin",
33
"name": "Obsidian Leaflet",
44
"description": "Create interactive maps inside your notes",
5-
"version": "2.0.1",
5+
"version": "2.0.2",
66
"minAppVersion": "0.11.0",
77
"author": "Jeremy Valentine",
88
"repo": "valentine195/obsidian-leaflet-plugin",

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-leaflet-plugin",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Leaflet integration for Obsidian.md",
55
"main": "main.js",
66
"scripts": {
@@ -21,10 +21,12 @@
2121
"@types/leaflet": "^1.5.23",
2222
"@types/mime": "^2.0.3",
2323
"@types/node": "^14.14.31",
24+
"@types/papaparse": "^5.2.5",
2425
"@types/uuid": "^8.3.0",
2526
"leaflet": "^1.7.1",
2627
"mime": "^2.5.2",
2728
"obsidian": "https://github.com/obsidianmd/obsidian-api/tarball/master",
29+
"papaparse": "^5.3.0",
2830
"rollup": "^2.32.1",
2931
"rollup-plugin-copy": "^3.4.0",
3032
"rollup-plugin-css-only": "^3.1.0",

src/@types/index.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export interface ObsidianAppData {
99
lat: number;
1010
long: number;
1111
notePreview: boolean;
12-
useCSV: boolean;
13-
csvPath: string;
12+
layerMarkers: boolean;
1413
}
1514

1615
export interface Marker {
@@ -58,4 +57,4 @@ export interface LayerGroup {
5857
group: L.LayerGroup;
5958
layer: L.TileLayer | L.ImageOverlay;
6059
id: string;
61-
}
60+
}

src/main.css

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,28 @@
2222
margin-right: auto !important;
2323
}
2424

25-
.setting-item-control.marker-icon-display,
26-
.setting-item-control > .marker-icon-display {
27-
margin-left: 0.5rem;
25+
.additional-markers-container > .additional-markers {
26+
margin: 6px 12px;
27+
}
28+
.additional-markers-container > .additional-markers > .setting-item {
29+
border-top: 0;
30+
padding-top: 9px;
31+
}
32+
.additional-markers-container
33+
> .additional-markers
34+
> .setting-item
35+
> .setting-item-control
36+
> *:first-child {
37+
margin: 0 6px;
38+
}
39+
40+
.setting-item-name > .marker-type-display {
41+
display: flex;
42+
justify-content: flex-start;
43+
}
44+
.marker-type-display > .marker-icon-display {
2845
margin-right: 12px;
29-
position: relative;
30-
/* width: 12px;
31-
display: flex;
32-
justify-content: center; */
46+
font-size: 24px;
3347
}
3448

3549
.marker-creation-modal {

src/main.ts

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,13 @@ export default class ObsidianLeaflet extends Plugin {
324324
DEFAULT_SETTINGS,
325325
await this.loadData()
326326
);
327-
if (!this.AppData.csvPath.length) {
328-
this.AppData.csvPath = this.manifest.dir;
327+
if (
328+
!this.AppData.defaultMarker ||
329+
!this.AppData.defaultMarker.iconName
330+
) {
331+
this.AppData.defaultMarker = DEFAULT_SETTINGS.defaultMarker;
332+
this.AppData.layerMarkers = false;
333+
await this.saveSettings();
329334
}
330335
}
331336
async saveSettings() {
@@ -381,37 +386,42 @@ export default class ObsidianLeaflet extends Plugin {
381386
if (!marker.iconName) {
382387
marker.iconName = this.AppData.defaultMarker.iconName;
383388
}
384-
let html: string,
385-
iconNode: AbstractElement = icon(getIcon(marker.iconName), {
389+
let html: string, iconNode: AbstractElement;
390+
391+
if (this.AppData.layerMarkers) {
392+
iconNode = icon(getIcon(marker.iconName), {
386393
transform: marker.transform,
387-
mask: getIcon(this.AppData.defaultMarker?.iconName),
394+
mask: getIcon(this.AppData.defaultMarker.iconName),
395+
classes: ["full-width-height"]
396+
}).abstract[0];
397+
} else {
398+
iconNode = icon(getIcon(marker.iconName), {
388399
classes: ["full-width-height"]
389400
}).abstract[0];
401+
}
390402

391403
iconNode.attributes = {
392404
...iconNode.attributes,
393405
style: `color: ${
394406
marker.color
395407
? marker.color
396-
: this.AppData.defaultMarker?.color
408+
: this.AppData.defaultMarker.color
397409
}`
398410
};
399411

400412
html = toHtml(iconNode);
401413

402414
return { type: marker.type, html: html };
403415
});
404-
if (this.AppData.defaultMarker.iconName) {
405-
ret.unshift({
406-
type: "default",
407-
html: icon(getIcon(this.AppData.defaultMarker.iconName), {
408-
classes: ["full-width-height"],
409-
styles: {
410-
color: this.AppData.defaultMarker.color
411-
}
412-
}).html[0]
413-
});
414-
}
416+
ret.unshift({
417+
type: "default",
418+
html: icon(getIcon(this.AppData.defaultMarker.iconName), {
419+
classes: ["full-width-height"],
420+
styles: {
421+
color: this.AppData.defaultMarker.color
422+
}
423+
}).html[0]
424+
});
415425

416426
return ret;
417427
}
@@ -854,7 +864,7 @@ export default class ObsidianLeaflet extends Plugin {
854864
transform: { size: 6, x: 0, y: -2 },
855865
mask: getIcon(
856866
this.AppData.defaultMarker
857-
?.iconName
867+
.iconName
858868
),
859869
classes: ["full-width-height"]
860870
}
@@ -865,7 +875,7 @@ export default class ObsidianLeaflet extends Plugin {
865875
style: `color: ${
866876
newMarker.color
867877
? newMarker.color
868-
: this.AppData.defaultMarker?.color
878+
: this.AppData.defaultMarker.color
869879
}`
870880
};
871881

0 commit comments

Comments
 (0)