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
This commit is contained in:
Reditus committed 2026-05-16 13:55:38 +01:00
1 parent f23d4aa1f5
commit b9cf227d92
3 files changed
+11 -6

No files matched your search

+5 -3
View File
@@ -73,7 +73,7 @@ DEFAULTS = {
'renewal_days_before_expiry': 30, 'renewal_days_before_expiry': 30,
}, },
'maps': { 'maps': {
'default_map': 'DeepDesert', 'default_map': 'HaggaBasin',
'DeepDesert': { 'DeepDesert': {
'image': 'maps/Deep_Desert_Map1.jpg', 'image': 'maps/Deep_Desert_Map1.jpg',
'label': 'The Deep Desert', 'label': 'The Deep Desert',
@@ -84,7 +84,8 @@ DEFAULTS = {
'max_y': -620340 'max_y': -620340
}, },
'flip_y': False, 'flip_y': False,
'image_size': {'width': 683, 'height': 683} 'image_size': {'width': 683, 'height': 683},
'default_zoom': 1.45
}, },
'HaggaBasin': { 'HaggaBasin': {
'image': 'maps/HaggaBasin_8k.webp', 'image': 'maps/HaggaBasin_8k.webp',
@@ -96,7 +97,8 @@ DEFAULTS = {
'max_y': 237943 'max_y': 237943
}, },
'flip_y': False, 'flip_y': False,
'image_size': {'width': 8000, 'height': 8000} 'image_size': {'width': 8000, 'height': 8000},
'default_zoom': 0
} }
}, },
} }
+1
View File
@@ -504,6 +504,7 @@ def register_routes(app, services, settings):
'image': cfg.get('image'), 'image': cfg.get('image'),
'width': image_size.get('width', 1000), 'width': image_size.get('width', 1000),
'height': image_size.get('height', 1000), 'height': image_size.get('height', 1000),
'default_zoom': cfg.get('default_zoom', 0.5),
'counts': { 'counts': {
'players': sum(1 for p in player_locations if p.get('map') == key and p.get('in_bounds')), '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')), 'vehicles': sum(1 for v in vehicle_locations if v.get('map') == key and v.get('in_bounds')),
+5 -3
View File
@@ -426,7 +426,7 @@
<h3 class="panel-title">Zoom</h3> <h3 class="panel-title">Zoom</h3>
<div class="map-controls"> <div class="map-controls">
<button type="button" id="zoom-out" title="Zoom out">-</button> <button type="button" id="zoom-out" title="Zoom out">-</button>
<input type="range" id="zoom-slider" min="25" max="350" value="50" step="10"> <input type="range" id="zoom-slider" min="0" max="350" value="50" step="10">
<button type="button" id="zoom-in" title="Zoom in">+</button> <button type="button" id="zoom-in" title="Zoom in">+</button>
</div> </div>
<div class="zoom-readout" id="zoom-readout">50%</div> <div class="zoom-readout" id="zoom-readout">50%</div>
@@ -472,6 +472,7 @@ const mapImageUrls = {
let currentMap = "{{ default_map }}"; let currentMap = "{{ default_map }}";
let currentZoom = 0.5; let currentZoom = 0.5;
let defaultZoom = 0.5;
let activeMarkerId = null; let activeMarkerId = null;
const enabledTypes = { player: true, vehicle: true, base: true }; const enabledTypes = { player: true, vehicle: true, base: true };
@@ -537,7 +538,7 @@ function setZoom(nextZoom, keepCenter = true) {
const relativeX = oldZoom ? viewportCenterX / oldZoom : 0; const relativeX = oldZoom ? viewportCenterX / oldZoom : 0;
const relativeY = oldZoom ? viewportCenterY / 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.width = `${map.width * currentZoom}px`;
els.canvas.style.height = `${map.height * currentZoom}px`; els.canvas.style.height = `${map.height * currentZoom}px`;
els.zoomSlider.value = Math.round(currentZoom * 100); els.zoomSlider.value = Math.round(currentZoom * 100);
@@ -669,7 +670,8 @@ function renderAll(resetView = false) {
els.image.src = mapImageUrls[map.key] || ''; els.image.src = mapImageUrls[map.key] || '';
els.image.alt = map.label; 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) { if (resetView) {
requestAnimationFrame(() => { requestAnimationFrame(() => {