Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
element = ol_ext_element.create('DIV', {
className: (options.className || "ol-mapzone") +' ol-unselectable ol-control ol-collapsed'
});
var bt = ol_ext_element.create('BUTTON', {
type: 'button',
on: {
'click': function() {
element.classList.toggle("ol-collapsed");
maps.forEach(function (m) {
m.updateSize();
});
}.bind(this)
},
parent: element
});
ol_ext_element.create('I', {
parent: bt
});
}
// Parent control
ol_control_Control.call(this, {
element: element,
target: options.target
});
// Create maps
var maps = [];
options.zones.forEach(function(z) {
var view = new ol_View({ zoom: 6, center: [0,0], projection: options.projection });
var extent = ol_proj_transformExtent(z.extent, 'EPSG:4326', view.getProjection());
console.log(extent, z.extent)
}.bind(this)
});
var layer = new options.layer.constructor({
source: options.layer.getSource()
});
var map = new ol_Map({
target: div,
view: view,
controls: [],
interactions:[],
layers: [layer]
});
maps.push(map);
view.fit(extent);
// Nmae
ol_ext_element.create('P', {
html: z.title,
parent: div
});
}.bind(this));
options.zones.forEach(function(z) {
var view = new ol_View({ zoom: 6, center: [0,0], projection: options.projection });
var extent = ol_proj_transformExtent(z.extent, 'EPSG:4326', view.getProjection());
console.log(extent, z.extent)
var div = ol_ext_element.create('DIV', {
className: 'ol-mapzonezone',
parent: element,
click : function() {
this.dispatchEvent({
type: 'select',
coordinate: ol_extent_getCenter(extent),
extent: extent
});
if (options.centerOnClick !== false) {
this.getMap().getView().fit(extent);
}
this.setVisible(false);
}.bind(this)
});
var layer = new options.layer.constructor({
source: options.layer.getSource()
var ol_control_MapZone = function(options) {
if (!options) options={};
var element = document.createElement("div");
if (options.target) {
element = ol_ext_element.create('DIV', {
className: options.className || "ol-mapzone"
});
} else {
element = ol_ext_element.create('DIV', {
className: (options.className || "ol-mapzone") +' ol-unselectable ol-control ol-collapsed'
});
var bt = ol_ext_element.create('BUTTON', {
type: 'button',
on: {
'click': function() {
element.classList.toggle("ol-collapsed");
maps.forEach(function (m) {
m.updateSize();
});
}.bind(this)
},
parent: element
});
ol_ext_element.create('I', {
parent: bt
var ol_control_MapZone = function(options) {
if (!options) options={};
var element = document.createElement("div");
if (options.target) {
element = ol_ext_element.create('DIV', {
className: options.className || "ol-mapzone"
});
} else {
element = ol_ext_element.create('DIV', {
className: (options.className || "ol-mapzone") +' ol-unselectable ol-control ol-collapsed'
});
var bt = ol_ext_element.create('BUTTON', {
type: 'button',
on: {
'click': function() {
element.classList.toggle("ol-collapsed");
maps.forEach(function (m) {
m.updateSize();
});
}.bind(this)
},
parent: element
});
ol_ext_element.create('I', {
parent: bt
});
}
var ol_control_MapZone = function(options) {
if (!options) options={};
var element = document.createElement("div");
if (options.target) {
element = ol_ext_element.create('DIV', {
className: options.className || "ol-mapzone"
});
} else {
element = ol_ext_element.create('DIV', {
className: (options.className || "ol-mapzone") +' ol-unselectable ol-control ol-collapsed'
});
var bt = ol_ext_element.create('BUTTON', {
type: 'button',
on: {
'click': function() {
element.classList.toggle("ol-collapsed");
maps.forEach(function (m) {
m.updateSize();
});
}.bind(this)
},