Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add configuration to default all image layers on or off #455

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/l10n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default {
Hover: "Hover",
Never: "Never",
"Display Note Preview": "Display Note Preview",
"Default Image Layer On": "Default Image Layer On",
"Markers linked to notes will show a note preview when hovered.":
"Markers linked to notes will show a note preview when hovered.",
"Display Overlay Tooltips": "Display Overlay Tooltips",
Expand Down
1 change: 1 addition & 0 deletions src/l10n/locales/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default {
Hover: "悬停",
Never: "从不",
"Display Note Preview": "显示笔记预览",
"Default Image Layer On": "默认图像层打开",
"Markers linked to notes will show a note preview when hovered.":
"当鼠标悬停在已经关联笔记的标记上时,会显示关联笔记的预览界面",
"Display Overlay Tooltips": "显示叠加层提示",
Expand Down
1 change: 1 addition & 0 deletions src/map/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ export abstract class BaseMap extends Events implements BaseMapDefinition {
});

this.layerControl.addOverlay(image, overlay.alias);
this.data.imageLayerDefaultOn && this.leafletInstance.addLayer(image);
}
});
}
Expand Down
16 changes: 16 additions & 0 deletions src/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,22 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
})
);
new Setting(containerEl)
.setName(t("Default Image Layers On"))
.setDesc(
t(
"All image layers will default to visible instead of hidden"
)
)
.addToggle((toggle) =>
toggle.setValue(this.data.imageLayerDefaultOn).onChange(async (v) => {
this.data.imageLayerDefaultOn = v;

await this.plugin.saveSettings();

this.display();
})
);
new Setting(containerEl)
.setName(t("Display Overlay Tooltips"))
.setDesc(t("Overlay tooltips will display when hovered."))
.addToggle((toggle) =>
Expand Down
1 change: 1 addition & 0 deletions types/saved.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface ObsidianAppData {
lat: number;
long: number;
notePreview: boolean;
imageLayerDefaultOn: boolean;
layerMarkers: boolean;
previousVersion: string;
version: {
Expand Down