Changeset 366 for binary-improvements


Ignore:
Timestamp:
Jul 7, 2021, 2:07:20 PM (3 years ago)
Author:
alloc
Message:

Map: Added options for fractional zoom to map.js lines 42 - 46

Location:
binary-improvements/webserver
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements/webserver/js/map.js

    r347 r366  
    4040                zoomsliderControl: true,
    4141                attributionControl: false,
    42                 crs: SDTD_CRS
     42                crs: SDTD_CRS,
     43                // For the below options read section "Fractional zoom" here: https://leafletjs.com/examples/zoom-levels/
     44                zoomSnap: 1, // Defines the zoom levels that can be achieved at all
     45                zoomDelta: 1, // Defines how much the zoom is changed with keyboard +/- and the zoom slider control
     46                wheelPxPerZoomLevel: 60 // Defines how much mouse scrolling is needed per zoom level. If zoomDelta is e.g. 0.25 and you want the mouse scroll zoom to match that make this 4 times as high, i.e. 240
    4347        }).setView([0, 0], Math.max(0, mapinfo.maxzoom - 5));
    4448
  • binary-improvements/webserver/leaflet/zoomslider/L.Control.Zoomslider.js

    r173 r366  
    141141
    142142                _zoomIn: function (e) {
    143                         this._map.zoomIn(e.shiftKey ? 3 : 1);
     143                        var delta = this._map.options.zoomDelta || 0;
     144                        this._map.zoomIn(e.shiftKey ? 3 * delta : delta);
    144145                },
    145146                _zoomOut: function (e) {
    146                         this._map.zoomOut(e.shiftKey ? 3 : 1);
     147                        var delta = this._map.options.zoomDelta || 0;
     148                        this._map.zoomOut(e.shiftKey ? 3 * delta : delta);
    147149                },
    148150
    149151                _zoomLevels: function () {
    150                         var zoomLevels = this._map.getMaxZoom() - this._map.getMinZoom() + 1;
     152                        var zoomLevels = (this._map.getMaxZoom() - this._map.getMinZoom()) / this._map.options.zoomDelta + 1;
    151153                        return zoomLevels < Infinity ? zoomLevels : 0;
    152154                },
    153155                _toZoomLevel: function (value) {
    154                         return value + this._map.getMinZoom();
     156                        return value * this._map.options.zoomDelta + this._map.getMinZoom();
    155157                },
    156158                _toValue: function (zoomLevel) {
    157                         return zoomLevel - this._map.getMinZoom();
     159                        return (zoomLevel - this._map.getMinZoom()) / this._map.options.zoomDelta;
    158160                },
    159161
Note: See TracChangeset for help on using the changeset viewer.