2013-09-22 7 views
-1

마커 및 사용자 정의 정보 창이있는 맞춤형 Google지도를 만들었습니다. 상단 대신 정보창을 마커 아래에 표시합니다. 정보창의 위도와 경도를 배치하여이 작업을 수행했습니다. 하지만 Google api에서 pixeloffset 속성을 찾았지만 작동하지 않습니다. 내가 사용Google지도에서 픽셀 오프셋이 작동하지 않음

var infoBubble = new InfoBubble({ 
map: map, 
content: '<div>Some label</div>', 
position: new google.maps.LatLng(26.890076,75.755000), 
shadowStyle: 1, 
padding: 0, 
backgroundColor: 'rgb(57,57,57)', 
borderRadius: 4, 
arrowSize: 0, 
borderWidth: 1, 
borderColor: '#2c2c2c', 
disableAutoPan: true, 
hideCloseButton: true, 
pixelOffset: new google.maps.Size(-100,0) 
}); 
infoBubble2.open(map,marker); 
+0

:

// Adjust for the height of the info bubble var top = pos.y - (height + arrowSize); if (anchorHeight) { // If there is an anchor then include the height top -= anchorHeight; } var left = pos.x - (width * arrowPosition); 

는 이러한 변경 사항을 적용 ? – geocodezip

답변

5

InfoBubblegoogle.maps.InfoWindow의 구현하지하는 InfoBubble에 대한 특성 pixelOffset이 없습니다.

그러나이 기능을 적용하려면 infobubble.js에서 약간의 변경 만 필요합니다.

열기 infobubble.js (컴파일되지 않은 버전) 및 (그리기 기능 내부)이 코드를 찾을 수 있습니다 : "작동하지 않는"가 무슨 뜻 이죠

 
    if(!this.pixelOffset 
     || !this.pixelOffset.constructor 
     || this.pixelOffset.constructor !== google.maps.Size){ 
    this.pixelOffset = new google.maps.Size(0,0); 
    } 
    // Adjust for the height of the info bubble 
    var top = pos.y - (height + arrowSize) + this.pixelOffset.height; 

    if (anchorHeight) { 
    // If there is an anchor then include the height 
    top -= anchorHeight; 
    } 

    var left = pos.x - (width * arrowPosition) + this.pixelOffset.width; 

+0

위대한 !! 감사. – Kabkee