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:
1 parent
f23d4aa1f5
commit
b9cf227d92
3 files changed
+11
-6
No files matched your search
+5
-3
@@ -426,7 +426,7 @@
|
||||
<h3 class="panel-title">Zoom</h3>
|
||||
<div class="map-controls">
|
||||
<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>
|
||||
</div>
|
||||
<div class="zoom-readout" id="zoom-readout">50%</div>
|
||||
@@ -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(() => {
|
||||
|
||||
Reference in new issue
Block a user