mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	feat(views/geo): allow displaying scale
This commit is contained in:
		
							parent
							
								
									0dffa0f333
								
							
						
					
					
						commit
						aeb356bf54
					
				@ -1970,7 +1970,8 @@
 | 
				
			|||||||
    "max-nesting-depth": "Max nesting depth:",
 | 
					    "max-nesting-depth": "Max nesting depth:",
 | 
				
			||||||
    "raster": "Raster",
 | 
					    "raster": "Raster",
 | 
				
			||||||
    "vector_light": "Vector (Light)",
 | 
					    "vector_light": "Vector (Light)",
 | 
				
			||||||
    "vector_dark": "Vector (Dark)"
 | 
					    "vector_dark": "Vector (Dark)",
 | 
				
			||||||
 | 
					    "show-scale": "Show scale"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "table_context_menu": {
 | 
					  "table_context_menu": {
 | 
				
			||||||
    "delete_row": "Delete row"
 | 
					    "delete_row": "Delete row"
 | 
				
			||||||
 | 
				
			|||||||
@ -138,6 +138,11 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {
 | 
				
			|||||||
                            .map(buildMapLayer)
 | 
					                            .map(buildMapLayer)
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                ]
 | 
					                ]
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                label: t("book_properties_config.show-scale"),
 | 
				
			||||||
 | 
					                type: "checkbox",
 | 
				
			||||||
 | 
					                bindToLabel: "map:scale"
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
				
			|||||||
@ -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);
 | 
					        this.$container.toggleClass("dark", !!layerData.isDarkTheme);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        layer.addTo(map);
 | 
					        layer.addTo(map);
 | 
				
			||||||
@ -291,7 +295,7 @@ export default class GeoView extends ViewMode<MapData> {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Full reload if map layer is changed.
 | 
					        // 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;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user