mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	feat(geomap): set default position
This commit is contained in:
		
							parent
							
								
									a8e2c2901b
								
							
						
					
					
						commit
						9e2c592383
					
				@ -74,6 +74,8 @@ const TPL = `\
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const LOCATION_ATTRIBUTE = "geolocation";
 | 
					const LOCATION_ATTRIBUTE = "geolocation";
 | 
				
			||||||
const CHILD_NOTE_ICON = "bx bx-pin";
 | 
					const CHILD_NOTE_ICON = "bx bx-pin";
 | 
				
			||||||
 | 
					const DEFAULT_COORDINATES: [ number, number ] = [ 3.878638227135724, 446.6630455551659 ];
 | 
				
			||||||
 | 
					const DEFAULT_ZOOM = 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface MapData {
 | 
					interface MapData {
 | 
				
			||||||
    view?: {
 | 
					    view?: {
 | 
				
			||||||
@ -143,8 +145,8 @@ export default class GeoMapTypeWidget extends TypeWidget {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Restore viewport position & zoom
 | 
					        // Restore viewport position & zoom
 | 
				
			||||||
        const center = parsedContent.view?.center ?? [51.505, -0.09];
 | 
					        const center = parsedContent.view?.center ?? DEFAULT_COORDINATES;
 | 
				
			||||||
        const zoom = parsedContent.view?.zoom ?? 13;
 | 
					        const zoom = parsedContent.view?.zoom ?? DEFAULT_ZOOM;
 | 
				
			||||||
        map.setView(center, zoom);
 | 
					        map.setView(center, zoom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Restore markers.
 | 
					        // Restore markers.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user