我創建了包含通過Openlayers顯示的地圖的擴展Ext.Panel.panel組件,該組件位於Ext.Window.window中。 但經過負載頁面,地圖只顯示部分: http://habrastorage.org/storage2/17f/1be/3bd/17f1be3bdc2a9765c1852d93a95ee1b8.png在Ext.Window.window中顯示地圖不完全
Ext.define('MA.view.components.OpenlayersPanel',
{
extend: 'Ext.panel.Panel',
alias: 'widget.openlayerspanel',
multiSelect: true,
initComponent: function()
{
this.callParent(arguments);
this.on('afterrender', this.afterRender, this);
},
afterRender: function()
{
this.map = new OpenLayers.Map(this.body.dom.id);
this.layer = new OpenLayers.Layer.OSM('OSM Map');
this.fromProjection = new OpenLayers.Projection("EPSG:4326");
this.toProjection = new OpenLayers.Projection("EPSG:900913");
this.position = new OpenLayers.LonLat(75.1, 61.15).transform(this.fromProjection, this.toProjection);
this.zoom = 12;
this.map.addLayer(this.layer);
this.layer.setIsBaseLayer(true);
this.map.setCenter(this.position, this.zoom);
}
});
app.js:
Ext.application(
{
requires: ['Ext.container.Viewport'],
name: 'MA',
appFolder: 'app',
controllers:
[
'Map'
],
launch: function()
{
Ext.create('Ext.window.Window',
{
layout:
{
type: 'vbox'
},
items:
[
{
xtype: 'openlayerspanel'
},
{
xtype: 'button',
text: 'Load',
}
]
}).show();
}
});
當我調整瀏覽器,地圖刷新和正常顯示。 什麼修復使其工作?
如果調整大小Ext.Window.window - 地圖無變化,如果調整大小瀏覽器 - 地圖刷新。但是$(window).resize()映射也不會改變。 – 2013-03-10 07:38:12
也不行... – 2013-03-10 15:09:52
看着變化 – 2013-03-10 16:31:28