6

Występuje problem związany z Google Maps API V3. Problem polega na tym, że podczas przeciągania znacznika mapa również zaczyna się przeciągać.Problemy z Internet Explorerem i systemem Windows 8 z ekranem dotykowym

Mamy problem z numerem TYLKO na ekranach dotykowych w Windows 8 Środowisko + Internet Explorer, jego grzywna na ekranach NORMAL/Ekrany mobilne - IPaid/inne przeglądarki (Safari i FireFox).

Użyliśmy poniżej rozwiązanie, ale zgłasza błąd (eval javascript error) w Internet Explorer9 i 10:

google.maps.event.addListener(marker, 'dragstart', function(){ 
    mapObject.setOptions({ draggable: false }); 
}); 
google.maps.event.addListener(marker, 'dragend', function(){ 
    mapObject.setOptions({ draggable: true }); 
}); 

Sample code is here.

Mamy również zgłosić ten problem tutaj: gmaps-api-issues

EDIT:

Dysponujemy napisali related question tutaj również.

Odpowiedz

4

Niektóre sukcesy Wreszcie (mapa wciąż się porusza, ale może być w tym momencie zignorowana)!

Deklarowany dwie zmienne:

var isAnyMarkerIsInDraggingState = false;// if a marker is in drag state this value will be TRUE otherwise FALSE 
var mapCenterPositionAtTheTimeWhenMarkerWasDragged;// Map Center Position 

jeżeli znacznik jest przeciągany:

google.maps.event.addListener(objMarker, 'dragstart', function() { 
     // Store map center position when a marker is dragged 
     mapCenterPositionAtTheTimeWhenMarkerWasDragged = mapObject.getCenter(); 
     isAnyMarkerIsInDraggingState = true; 
    }); 

jeżeli znacznik jest odrzucany (przeciągania końcach):

google.maps.event.addListener(objMarker, 'dragend', function() { 
    // Make Map draggable 
    // Set isAnyMarkerIsInDraggingState = false. Because no marker is in drag state 
    mapObject.setOptions({ draggable: true }); 
    isAnyMarkerIsInDraggingState = false; 
}); 

Gdy Drag Map zaczyna:

google.maps.event.addListener(mapObject, 'dragstart', function() { 
    // isAnyMarkerIsInDraggingState = true: means the user is dragging a marker. 
    // If the user is dragging the Marker then don't allow the Map to be Dragged 
    if (isAnyMarkerIsInDraggingState) { 
     mapObject.setOptions({ draggable: false }); 
    } 
}); 

Gdy mapa jest w stanie przeciąganie:

google.maps.event.addListener(mapObject, 'drag', function() { 
    // isAnyMarkerIsInDraggingState = true: means the user is dragging a marker. 
    // If the user is dragging the Marker then don't allow the Map to be Dragged and set its CenterPosition 
    // to mapCenterPositionAtTheTimeWhenMarkerWasDragged 

    if (isAnyMarkerIsInDraggingState) { 
     mapObject.setCenter(mapCenterPositionAtTheTimeWhenMarkerWasDragged); 
    } 
}); 

Complete sample code is here.

Powiązane problemy