Skip to content

Commit

Permalink
[BUILD] + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Feb 8, 2020
1 parent 0272a03 commit b28f6c6
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 70 deletions.
40 changes: 20 additions & 20 deletions dist/ol-ext.css
Original file line number Diff line number Diff line change
Expand Up @@ -655,31 +655,31 @@
margin: 0 0 0 .5em;
}

.ol-gauge
{ top: 0.5em;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
.ol-gauge {
top: 0.5em;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}

.ol-gauge > *
{ display: inline-block;
vertical-align: middle;
.ol-gauge > * {
display: inline-block;
vertical-align: middle;
}
.ol-gauge > span
{
margin: 0 0.5em;
.ol-gauge > span {
margin: 0 0.5em;
}
.ol-gauge > div
{ width: 200px;
border: 1px solid rgba(0,60,136,.5);
border-radius: 3px;
padding:1px;
.ol-gauge > div {
display: inline-block;
width: 200px;
border: 1px solid rgba(0,60,136,.5);
border-radius: 3px;
padding:1px;
}
.ol-gauge button
{ height: 0.8em;
margin:0;
max-width:100%;
.ol-gauge button {
height: 0.8em;
margin:0;
max-width:100%;
}

.ol-control.ol-bookmark
Expand Down
112 changes: 71 additions & 41 deletions dist/ol-ext.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* ol-ext - A set of cool extensions for OpenLayers (ol) in node modules structure
* @description ol3,openlayers,popup,menu,symbol,renderer,filter,canvas,interaction,split,statistic,charts,pie,LayerSwitcher,toolbar,animation
* @version v3.1.8
* @version v3.1.9
* @author Jean-Marc Viglino
* @see https://github.com/Viglino/ol-ext#,
* @license BSD-3-Clause
Expand Down Expand Up @@ -2057,7 +2057,7 @@ ol.control.LayerSwitcher.prototype.dragOrdering_ = function(e) {
if (drop && target) {
var collection ;
if (group) collection = group.getLayers();
else collection = self.getMap().getLayers();
else collection = self._layerGroup ? self._layerGroup.getLayers() : self.getMap().getLayers();
var layers = collection.getArray();
// Switch layers
for (var i=0; i<layers.length; i++) {
Expand Down Expand Up @@ -3885,56 +3885,72 @@ ol.control.EditBar.prototype._setModifyInteraction = function (options) {
};

/* Copyright (c) 2017 Jean-Marc VIGLINO,
released under the CeCILL-B license (French BSD license)
(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).
released under the CeCILL-B license (French BSD license)
(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).
*/
/** A simple gauge control to display level information on the map.
*
* @constructor
* @extends {ol.control.Control}
* @param {Object=} options Control options.
* @param {String} options.className class of the control
* @param {String} options.title title of the control
* @param {number} options.max maximum value, default 100;
* @param {number} options.val the value, default 0
* @param {String} options.className class of the control
* @param {String} options.title title of the control
* @param {number} options.max maximum value, default 100;
* @param {number} options.val the value, default 0
*/
ol.control.Gauge = function(options)
{ options = options || {};
var element = document.createElement("div");
element.className = ((options.className||"") + ' ol-gauge ol-unselectable ol-control').trim();
this.title_ = document.createElement("span");
element.appendChild(this.title_);
this.gauge_ = document.createElement("button");
this.gauge_.setAttribute('type','button');
element.appendChild(document.createElement("div").appendChild(this.gauge_))
this.gauge_.style.width = '0px';
ol.control.Control.call(this,
{ element: element,
target: options.target
});
this.setTitle(options.title);
this.val(options.val);
this.set("max", options.max||100);
ol.control.Gauge = function(options) {
options = options || {};
var element = ol.ext.element.create('DIV', {
className: ((options.className||"") + ' ol-gauge ol-unselectable ol-control').trim()
});
this.title_ = ol.ext.element.create('SPAN', {
parent: element
});
var div = ol.ext.element.create('DIV', {
parent: element
});
this.gauge_ = ol.ext.element.create('BUTTON', {
type: 'button',
style: { width: '0px' },
parent: div
});
/*
var element = document.createElement("div");
element.className = ((options.className||"") + ' ol-gauge ol-unselectable ol-control').trim();
this.title_ = document.createElement("span");
element.appendChild(this.title_);
this.gauge_ = document.createElement("button");
this.gauge_.setAttribute('type','button');
element.appendChild(document.createElement("div").appendChild(this.gauge_))
this.gauge_.style.width = '0px';
*/
ol.control.Control.call(this, {
element: element,
target: options.target
});
this.setTitle(options.title);
this.set("max", options.max||100);
this.val(options.val);
};
ol.ext.inherits(ol.control.Gauge, ol.control.Control);
/** Set the control title
* @param {string} title
*/
ol.control.Gauge.prototype.setTitle = function(title)
{ this.title_.innerHTML = title||"";
if (!title) this.title_.display = 'none';
else this.title_.display = '';
ol.control.Gauge.prototype.setTitle = function(title) {
this.title_.innerHTML = title||"";
if (!title) this.title_.display = 'none';
else this.title_.display = '';
};
/** Set/get the gauge value
* @param {number|undefined} v the value or undefined to get it
* @return {number} the value
*/
ol.control.Gauge.prototype.val = function(v)
{ if (v!==undefined)
{ this.val_ = v;
this.gauge_.style.width = (v/this.get('max')*100)+"%";
}
return this.val_;
ol.control.Gauge.prototype.val = function(v) {
if (v!==undefined) {
this.val_ = v;
this.gauge_.style.width = (v/this.get('max')*100)+"%";
}
return this.val_;
};

/** Bookmark positions on ol maps.
Expand Down Expand Up @@ -5835,7 +5851,7 @@ ol.control.MapZone = function(options) {
target: options.target
});
// Create maps
var maps = [];
var maps = this._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());
Expand Down Expand Up @@ -5885,8 +5901,21 @@ ol.ext.inherits(ol.control.MapZone, ol.control.Control);
* @param {boolean} b
*/
ol.control.MapZone.prototype.setVisible = function (b) {
if (b) this.element.classList.remove('ol-collapsed');
else this.element.classList.add('ol-collapsed');
if (b) {
this.element.classList.remove('ol-collapsed');
// Force map rendering
this.getMaps().forEach(function (m) {
m.updateSize();
});
} else {
this.element.classList.add('ol-collapsed');
}
};
/** Get associated maps
* @return {ol.Map}
*/
ol.control.MapZone.prototype.getMaps = function () {
return this._maps
};
/** Pre-defined zones */
ol.control.MapZone.zones = {};
Expand Down Expand Up @@ -9757,7 +9786,7 @@ ol.control.Swipe.prototype.move = function(e) {
ol.control.Swipe.prototype._drawRect = function(e, pts) {
var tr = e.inversePixelTransform;
if (tr) {
r = [
var r = [
[pts[0][0], pts[0][1]],
[pts[0][0], pts[1][1]],
[pts[1][0], pts[1][1]],
Expand Down Expand Up @@ -10832,6 +10861,7 @@ ol.layer.Base.prototype.animateFeature = function(feature, fanim, useFilter) {
event.vectorContext = e.vectorContext || ol.render.getVectorContext(e);
} catch(e) { /* nothing todo */ }
event.frameState = e.frameState;
event.inversePixelTransform = e.inversePixelTransform;
if (!event.extent) {
event.extent = e.frameState.extent;
event.start = e.frameState.time;
Expand Down Expand Up @@ -21650,8 +21680,8 @@ ol.particule.Cloud = function(options) {
this.image = canvas;
for (var k=0; k<7; k++) {
ctx.save();
x = Math.random()*100;
y = Math.random()*100;
var x = Math.random()*100;
var y = Math.random()*100;
ctx.translate (x,y);
ctx.fillStyle = grd;
ctx.fillRect(0,0,canvas.width,canvas.height);
Expand Down
2 changes: 1 addition & 1 deletion dist/ol-ext.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ol-ext.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ol-ext",
"version": "3.1.8",
"version": "3.1.9",
"description": "A set of cool extensions for OpenLayers (ol) in node modules structure",
"main": "dist/ol-ext.js",
"style": "dist/ol-ext.css",
Expand Down
12 changes: 10 additions & 2 deletions src/control/MapZone.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var ol_control_MapZone = function(options) {
});

// Create maps
var maps = [];
var maps = this._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());
Expand Down Expand Up @@ -115,14 +115,22 @@ ol_control_MapZone.prototype.setVisible = function (b) {
if (b) {
this.element.classList.remove('ol-collapsed');
// Force map rendering
maps.forEach(function (m) {
this.getMaps().forEach(function (m) {
m.updateSize();
});
} else {
this.element.classList.add('ol-collapsed');
}
};


/** Get associated maps
* @return {ol.Map}
*/
ol_control_MapZone.prototype.getMaps = function () {
return this._maps
};

/** Pre-defined zones */
ol_control_MapZone.zones = {};

Expand Down
2 changes: 1 addition & 1 deletion src/control/Swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ ol_control_Swipe.prototype.move = function(e) {
ol_control_Swipe.prototype._drawRect = function(e, pts) {
var tr = e.inversePixelTransform;
if (tr) {
r = [
var r = [
[pts[0][0], pts[0][1]],
[pts[0][0], pts[1][1]],
[pts[1][0], pts[1][1]],
Expand Down
4 changes: 2 additions & 2 deletions src/particule/Cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ var ol_particule_Cloud = function(options) {
this.image = canvas;
for (var k=0; k<7; k++) {
ctx.save();
x = Math.random()*100;
y = Math.random()*100;
var x = Math.random()*100;
var y = Math.random()*100;
ctx.translate (x,y);
ctx.fillStyle = grd;
ctx.fillRect(0,0,canvas.width,canvas.height);
Expand Down

0 comments on commit b28f6c6

Please sign in to comment.