Simplify dragAndDropInteraction in examples

This commit is contained in:
Peter Robins
2015-04-19 13:26:25 +00:00
parent ed76bdb095
commit 22f22b2877
2 changed files with 6 additions and 10 deletions

View File

@@ -114,17 +114,15 @@ var map = new ol.Map({
dragAndDropInteraction.on('addfeatures', function(event) {
var vectorSource = new ol.source.Vector({
features: event.features,
projection: event.projection
features: event.features
});
map.getLayers().push(new ol.layer.Image({
map.addLayer(new ol.layer.Image({
source: new ol.source.ImageVector({
source: vectorSource,
style: styleFunction
})
}));
var view = map.getView();
view.fitExtent(
map.getView().fitExtent(
vectorSource.getExtent(), /** @type {ol.Size} */ (map.getSize()));
});

View File

@@ -112,15 +112,13 @@ var map = new ol.Map({
dragAndDropInteraction.on('addfeatures', function(event) {
var vectorSource = new ol.source.Vector({
features: event.features,
projection: event.projection
features: event.features
});
map.getLayers().push(new ol.layer.Vector({
map.addLayer(new ol.layer.Vector({
source: vectorSource,
style: styleFunction
}));
var view = map.getView();
view.fitExtent(
map.getView().fitExtent(
vectorSource.getExtent(), /** @type {ol.Size} */ (map.getSize()));
});