Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile - Marker draggable when zooming at max zoom. #187

Open
jonboywhite opened this issue May 17, 2024 · 0 comments
Open

Mobile - Marker draggable when zooming at max zoom. #187

jonboywhite opened this issue May 17, 2024 · 0 comments

Comments

@jonboywhite
Copy link

Hi. I have a strange bug when viewing a map with a single marker on it and I zoom using a touchscreen to the maximum and move the map around with my fingers still zooming.

zooming.mp4

Hopefully you can see the video above or attached.

I have used the basic code in tests from the repo and added a marker to it.

`const apiKey = '****** MY KEY *****';

// Setup the EPSG:27700 (British National Grid) projection.
const crs = new L.Proj.CRS('EPSG:27700', '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs', {
    resolutions: [ 896.0, 448.0, 224.0, 112.0, 56.0, 28.0, 14.0, 7.0, 3.5, 1.75 ],
    origin: [ -238375.0, 1376256.0 ]
});

// Transform coordinates.
const transformCoords = function(arr) {
    return proj4('EPSG:27700', 'EPSG:4326', arr).reverse();
};

// Initialize the map.
const mapOptions = {
    crs: crs,
    minZoom: 0,
    maxZoom: 9,
    center: [51.756463, -0.685633],
    zoom: 5,
    maxBounds: [
        transformCoords([ -238375.0, 0.0 ]),
        transformCoords([ 900000.0, 1376256.0 ])
    ],
    attributionControl: false,
	zoomSnap: 0
};

const map = L.map('map', mapOptions);

// Load and display ZXY tile layer on the map.
const basemap = L.tileLayer('https://api.os.uk/maps/raster/v1/zxy/Leisure_27700/{z}/{x}/{y}.png?key=' + apiKey).addTo(map);




var pMarker = L.icon({
	iconUrl: '/images/events/markers/orange-marker.png',
	iconSize:     [40, 52],
	iconAnchor:   [20, 52],
});
var marker = L.marker([51.756463, -0.685633], {icon: pMarker, draggable: false, interactive: false});
           
marker.addTo(map);`

Any help would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant