Answer the question
In order to leave comments, you need to log in
Map in Ext.Window.window is only partially displayed
I create a component based on Ext.Panel.panel that contains a map displayed through openlayers, I put this component in Ext.Window.window.
The map is only partially displayed after loading:
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.layer.setIsBaseLayer(true);
this.map.addLayer(this.layer);
this.map.setCenter(this.position, this.zoom);
}
});
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();
}
});
Answer the question
In order to leave comments, you need to log in
Hands most likely do not grow with you, but with the developers of Ext or OpenLayers, apparently, the card is inserted into the window too early and incorrectly determines its size. Try calling some method to have it recalculate its dimensions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question