From b9cf227d9228be3ff555b87fa3659757917890a4 Mon Sep 17 00:00:00 2001 From: Sutider Date: Sat, 16 May 2026 13:55:38 +0100 Subject: [PATCH] Per-map default zoom levels: HaggaBasin 0%, DeepDesert 145% - HaggaBasin defaults to 0% zoom for full map view - DeepDesert defaults to 145% zoom since map is much smaller - Zoom slider min changed from 25% to 0% - Added default_zoom to map options in build_map_options --- app/config.py | 8 +++++--- app/routes/main.py | 1 + templates/map.html | 8 +++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/config.py b/app/config.py index 946bd18..91d88d8 100644 --- a/app/config.py +++ b/app/config.py @@ -73,7 +73,7 @@ DEFAULTS = { 'renewal_days_before_expiry': 30, }, 'maps': { - 'default_map': 'DeepDesert', + 'default_map': 'HaggaBasin', 'DeepDesert': { 'image': 'maps/Deep_Desert_Map1.jpg', 'label': 'The Deep Desert', @@ -84,7 +84,8 @@ DEFAULTS = { 'max_y': -620340 }, 'flip_y': False, - 'image_size': {'width': 683, 'height': 683} + 'image_size': {'width': 683, 'height': 683}, + 'default_zoom': 1.45 }, 'HaggaBasin': { 'image': 'maps/HaggaBasin_8k.webp', @@ -96,7 +97,8 @@ DEFAULTS = { 'max_y': 237943 }, 'flip_y': False, - 'image_size': {'width': 8000, 'height': 8000} + 'image_size': {'width': 8000, 'height': 8000}, + 'default_zoom': 0 } }, } diff --git a/app/routes/main.py b/app/routes/main.py index 2f9dad3..aa0fe37 100644 --- a/app/routes/main.py +++ b/app/routes/main.py @@ -504,6 +504,7 @@ def register_routes(app, services, settings): 'image': cfg.get('image'), 'width': image_size.get('width', 1000), 'height': image_size.get('height', 1000), + 'default_zoom': cfg.get('default_zoom', 0.5), 'counts': { 'players': sum(1 for p in player_locations if p.get('map') == key and p.get('in_bounds')), 'vehicles': sum(1 for v in vehicle_locations if v.get('map') == key and v.get('in_bounds')), diff --git a/templates/map.html b/templates/map.html index 1d0204f..e2a7641 100644 --- a/templates/map.html +++ b/templates/map.html @@ -426,7 +426,7 @@

Zoom

- +
50%
@@ -472,6 +472,7 @@ const mapImageUrls = { let currentMap = "{{ default_map }}"; let currentZoom = 0.5; +let defaultZoom = 0.5; let activeMarkerId = null; const enabledTypes = { player: true, vehicle: true, base: true }; @@ -537,7 +538,7 @@ function setZoom(nextZoom, keepCenter = true) { const relativeX = oldZoom ? viewportCenterX / oldZoom : 0; const relativeY = oldZoom ? viewportCenterY / oldZoom : 0; - currentZoom = Math.min(3.5, Math.max(0.25, nextZoom)); + currentZoom = Math.min(3.5, Math.max(0, nextZoom)); els.canvas.style.width = `${map.width * currentZoom}px`; els.canvas.style.height = `${map.height * currentZoom}px`; els.zoomSlider.value = Math.round(currentZoom * 100); @@ -669,7 +670,8 @@ function renderAll(resetView = false) { els.image.src = mapImageUrls[map.key] || ''; els.image.alt = map.label; - setZoom(resetView ? 0.5 : currentZoom, !resetView); + const mapDefaultZoom = map.default_zoom || 0.5; + setZoom(resetView ? mapDefaultZoom : currentZoom, !resetView); if (resetView) { requestAnimationFrame(() => {