메신저 Google지도 API의 V3에 내 2 개의 정의 된 마크에 내 Google지도의 중심을 설정하려고합니다. 그러나 첫 번째 마커 인 위치 마커 만 가운데에 배치합니다.Sencha Touch 2 +지도 Api - fitbounds()가 작동하지 않습니다.
openShops : function(data) {
if (Ext.ComponentManager.get('shops-details') == undefined) {
Ext.create('Oxfam.view.ShopsDetails');
}
var shopsDetailsPage = Ext.ComponentManager.get('shops-details');
Ext.Viewport.setActiveItem(shopsDetailsPage);
var bounds;
var map = Ext.create('Ext.Map', {
id : 'shopMap',
xtype : 'map',
useCurrentLocation : {
autoUpdate : false
},
listeners : {
maprender : function(comp, map) {
var image = 'img/oxfamLogoSmall.png';
var locationMarker = new google.maps.Marker({
position : new google.maps.LatLng(this._geo
.getLatitude(), this._geo.getLongitude()),
map : map
});
var shopCoord = new google.maps.LatLng(sessionStorage
.getItem('longitude'), sessionStorage
.getItem('latitude'));
var locCoord = new google.maps.LatLng(this._geo
.getLatitude(), this._geo.getLongitude());
bounds = new google.maps.LatLngBounds();
var shopMarker = new google.maps.Marker({
position : new google.maps.LatLng(sessionStorage
.getItem('longitude'), sessionStorage
.getItem('latitude')),
map : map,
icon : image
});
bounds.extend(shopCoord);
bounds.extend(locCoord);
console.log(shopCoord);
map.fitBounds(bounds);
},
}
});
shopsDetailsPage.setItems(map);
}
로그가 올바른 좌표를 기록 내가지도를 렌더링이 코드가 있습니다. 지도는이 보여줍니다 click here to see the map
을하지만, 내 소원은 다음과 같이이다 : click here to see my wish
내가, 내가 시간 인 이후의 솔루션을 찾고 메신저 의미하는 무엇을 잘 모릅니다만했지만, 골대 밤은 모든 솔루션이 작동 내 응용 프로그램에서 ..
누구든지 내가 뭘 잘못 생각하고 있니? 나는 메신저 내 약한 개발 경험을하기 위해 필요한 모든 정보를 게시 희망, 당신은 위도했고 것 같은이 나에게 보이는
지도의 확대/축소를 설정하려고 했습니까? n을 12와 16 사이의 map.setZoom (n)으로 시도하십시오. –
예,하지만 문제는 zoomlevel이 동적이어야한다는 것입니다. 왜냐하면 좌표는 매번 동일하지 않기 때문입니다. 수동으로 확대/축소 레벨을 설정하려면 두 마커를 서로 넓은 범위에 표시하여 문제가 될 수 있으므로 해당 마커 만 볼 수 있습니다. 솔루션에 대한 귀하의 시도에 감사드립니다. – DenisK
도움이 되셨습니까? http://stackoverflow.com/questions/3407723/google-maps-fitbounds-is-not-working-properly? –