6

Google Maps API V3 ile ilgili bir sorun yaşıyoruz. Sorun, Marker'ı sürüklerken haritanın da sürüklenmeye başlamasıdır. IPaid/diğer tarayıcılar (Safari ve Firefox) -Internet Explorer + Windows8 Dokunmatik ekran sorunları

Biz SADECE Windows 8 Ortamı + Internet Explorer, NORMAL ekranlar/Mobil Ekranlar üzerindeki para cezası Dokunmatik Ekranlar bu sorunu yaşıyorsunuz demektir.

Biz çözümü aşağıda kullanılan, ancak İnternet explorer9 hata (eval javascript error) ve 10 atar:

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.

Biz de bu sorunu buraya bildirmiştir: gmaps-api-issues

DÜZENLEME: Biz de burada bir related question gönderdiniz

.

cevap

4

Bazı başarılar Son (harita hala biraz hareket eder ancak şu anda göz ardı edilebilir)!

Bildirilen iki değişken: Markör sürüklenir

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

:

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

(sürükleme biter):

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; 
}); 
.210

Harita Drag başladığında:

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 }); 
    } 
}); 

Harita sürükleyerek durumundadır:

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.

İlgili konular