Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(views/geo): allow displaying scale
Elian Doranaeb356bf5480
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 073ca2803a..a67bcd953b 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1970,7 +1970,8 @@"max-nesting-depth": "Max nesting depth:","raster": "Raster","vector_light": "Vector (Light)",- "vector_dark": "Vector (Dark)"+ "vector_dark": "Vector (Dark)",+ "show-scale": "Show scale"},"table_context_menu": {"delete_row": "Delete row"diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts b/apps/client/src/widgets/ribbon_widgets/book_properties_config.tsindex de5bc6fda2..3b76246d51 100644--- a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts+++ b/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts@@ -138,6 +138,11 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {.map(buildMapLayer)}]+ },+ {+ label: t("book_properties_config.show-scale"),+ type: "checkbox",+ bindToLabel: "map:scale"}]},diff --git a/apps/client/src/widgets/view_widgets/geo_view/index.ts b/apps/client/src/widgets/view_widgets/geo_view/index.tsindex 166c3ec17b..170b67b20e 100644--- a/apps/client/src/widgets/view_widgets/geo_view/index.ts+++ b/apps/client/src/widgets/view_widgets/geo_view/index.ts@@ -164,6 +164,10 @@ export default class GeoView extends ViewMode<MapData> {});}+ if (this.parentNote.hasLabel("map:scale")) {+ L.control.scale().addTo(map);+ }+this.$container.toggleClass("dark", !!layerData.isDarkTheme);layer.addTo(map);@@ -291,7 +295,7 @@ export default class GeoView extends ViewMode<MapData> {}// Full reload if map layer is changed.- if (loadResults.getAttributeRows().some(attr => attr.name === "mapStyle" && attributes.isAffecting(attr, this.parentNote))) {+ if (loadResults.getAttributeRows().some(attr => ((attr.name === "mapStyle") || (attr.name === "map:scale") && attributes.isAffecting(attr, this.parentNote)))) {return true;}}