feat(views/geo): allow displaying scale

This commit is contained in:
Elian Doran
2025-07-24 22:14:31 +03:00
parent 0dffa0f333
commit aeb356bf54
3 changed files with 12 additions and 2 deletions

View File

@@ -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"

View File

@@ -138,6 +138,11 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {
.map(buildMapLayer)
}
]
},
{
label: t("book_properties_config.show-scale"),
type: "checkbox",
bindToLabel: "map:scale"
}
]
},

View File

@@ -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;
}
}