New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ol-ext

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ol-ext - npm Package Compare versions

Comparing version 3.2.14 to 3.2.15

util/input/Collection.css

53

control/Dialog.js

@@ -74,3 +74,3 @@ import ol_ext_inherits from '../util/ext'

});
this.set('closeBox', !!options.closeBox);
this.set('closeBox', options.closeBox !== false);
this.set('zoom', !!options.zoom);

@@ -81,2 +81,3 @@ this.set('hideOnClick', !!options.hideOnClick);

this.set('closeOnSubmit', options.closeOnSubmit);
this.set('buttons', options.buttons);
this.setContent(options)

@@ -99,7 +100,8 @@ };

ol_control_Dialog.prototype.show = function(options) {
options = options || {};
if (options instanceof Element || typeof(options) === 'string') {
options = { content: options };
if (options) {
if (options instanceof Element || typeof(options) === 'string') {
options = { content: options };
}
this.setContent(options);
}
this.setContent(options);
this.element.classList.add('ol-visible');

@@ -109,15 +111,20 @@ var input = this.element.querySelector('input[type="text"],input[type="search"],input[type="number"]');

this.dispatchEvent ({ type: 'show' });
// Auto close
if (options.autoclose) {
var listener = setTimeout(function() { this.hide() }.bind(this), options.autoclose);
dialog.once('hide', function(){ clearTimeout(listener); });
if (options) {
// Auto close
if (options.autoclose) {
var listener = setTimeout(function() { this.hide() }.bind(this), options.autoclose);
this.once('hide', function(){
clearTimeout(listener);
});
}
// hideOnBack
if (options.hideOnBack) {
// save value
var value = this.get('hideOnBack');
this.set('hideOnBack', true);
this.once('hide', function() {
this.set('hideOnBack', value);
}.bind(this));
}
}
// hideOnBack
if (options.hideOnBack) {
var value = this.get('hideOnBack');
this.set('hideOnBack', true);
this.once('hide', function() {
dialog.set('hideOnBack', value);
}.bind(this));
}
};

@@ -179,9 +186,10 @@

buttons.innerHTML = '';
if (options.buttons) {
var btn = options.buttons || this.get('buttons');
if (btn) {
form.classList.add('ol-button');
for (var i in options.buttons) {
for (var i in btn) {
ol_ext_element.create ('INPUT', {
type: (i==='submit' ? 'submit':'button'),
value: options.buttons[i],
click: this._onButton(i, options.onButton),
value: btn[i],
click: this._onButton(i, btn),
parent: buttons

@@ -222,5 +230,6 @@ });

/** Do something on button click
/** Returns a function to do something on button click
* @param {strnig} button button id
* @param {function} callback
* @returns {function}
* @private

@@ -227,0 +236,0 @@ */

@@ -83,3 +83,7 @@ import ol_ext_inherits from '../util/ext'

ol_control_EditBar.prototype._getTitle = function (option) {
return (option && option.title) ? option.title : option;
if (option) {
if (option.get) return option.get('title');
else if (typeof(option) === 'string') return option;
else return option.title;
}
};

@@ -282,4 +286,7 @@

if (options.interactions.DrawRegular !== false) {
var label = { pts: 'pts', circle: 'circle' };
if (options.interactions.DrawRegular instanceof ol_interaction_DrawRegular) {
this._interactions.DrawRegular = options.interactions.DrawRegular
this._interactions.DrawRegular = options.interactions.DrawRegular;
label.pts = this._interactions.DrawRegular.get('ptsLabel') || label.pts;
label.circle = this._interactions.DrawRegular.get('circleLabel') || label.circle;
} else {

@@ -290,2 +297,6 @@ this._interactions.DrawRegular = new ol_interaction_DrawRegular ({

});
if (options.interactions.DrawRegular) {
label.pts = options.interactions.DrawRegular.ptsLabel || label.pts;
label.circle = options.interactions.DrawRegular.circleLabel || label.circle;
}
}

@@ -301,6 +312,6 @@ var regular = this._interactions.DrawRegular;

regular.setSides (sides);
text.textContent = sides>2 ? sides+' pts' : 'circle';
text.textContent = sides>2 ? sides+' '+label.pts : label.circle;
}.bind(this));
var text = ol_ext_element.create('TEXT', { html:'4 pts', parent: div });
var text = ol_ext_element.create('TEXT', { html:'4 '+label.pts, parent: div });

@@ -312,3 +323,3 @@ var up = ol_ext_element.create('DIV', { parent: div });

regular.setSides(sides);
text.textContent = sides+' pts';
text.textContent = sides+' '+label.pts;
}.bind(this));

@@ -315,0 +326,0 @@

@@ -16,2 +16,3 @@ import ol_ext_inherits from '../util/ext'

* @param {string} options.placeholder input placeholder, default Add a new geomark...
* @param {string} [options.deleteTitle='Suppr.'] title for delete buttons
* @param {bool} options.editable enable modification, default true

@@ -49,4 +50,6 @@ * @param {string} options.namespace a namespace to save the boolmark (if more than one on a page), default ol

click: function() {
menu.style.display = (menu.style.display === '' || menu.style.display === 'none' ? 'block': 'none');
}
var show = (menu.style.display === '' || menu.style.display === 'none');
menu.style.display = (show ? 'block': 'none');
if (show) this.setBookmarks();
}.bind(this)
});

@@ -62,13 +65,17 @@ element.appendChild(this.button);

input.setAttribute("placeholder", options.placeholder || "Add a new geomark...")
input.addEventListener("change", function() {
var title = this.value;
if (title) {
self.addBookmark(title);
this.value = '';
self.dispatchEvent({
type: "add",
name: title
});
input.addEventListener("keydown", function(e) {
e.stopPropagation();
if (e.keyCode === 13) {
e.preventDefault();
var title = this.value;
if (title) {
self.addBookmark(title);
this.value = '';
self.dispatchEvent({
type: "add",
name: title
});
}
menu.style.display = 'none';
}
menu.style.display = 'none';
});

@@ -98,3 +105,4 @@ input.addEventListener("blur", function() {

this.set("editable", options.editable !== false);
this.set('deleteTitle', options.deleteTitle || 'Suppr.');
// Set default bmark

@@ -154,3 +162,4 @@ var bmark = {};

button.setAttribute('data-name', b);
button.setAttribute("title", "Suppr.");
button.setAttribute('type', 'button');
button.setAttribute('title', this.get('deleteTitle') ||'Suppr.');
button.addEventListener('click', function(e) {

@@ -203,3 +212,3 @@ self.removeBookmark(this.getAttribute("data-name"));

var options = position;
var rot = this.getMap().getView().getRotation();
var rot;
if (options && options.position) {

@@ -210,2 +219,4 @@ zoom = options.zoom;

position = options.position;
} else {
rot = this.getMap().getView().getRotation();
}

@@ -212,0 +223,0 @@ var bmark = this.getBookmarks();

@@ -658,2 +658,21 @@ /*

cancel: 'annuler'
},
zh:{
title: '打印',
orientation: '方向',
portrait: '纵向',
landscape: '横向',
size: '页面大小',
custom: '屏幕大小',
margin: '外边距',
scale: '尺度',
legend: '图例',
north: '指北针',
mapTitle: '地图名字',
saveas: '保存为...',
saveLegend: '保存图例为...',
copied: '✔ 已复制到剪贴板',
errorMsg: '无法保存地图...',
printBt: '打印...',
cancel: '取消'
}

@@ -660,0 +679,0 @@ };

@@ -150,7 +150,8 @@ /*

ol_control_Swipe.prototype.getRectangle = function() {
var s;
if (this.get('orientation') === 'vertical') {
var s = this.getMap().getSize();
s = this.getMap().getSize();
return [ 0, 0, s[0]*this.get('position'), s[1]];
} else {
var s = this.getMap().getSize();
s = this.getMap().getSize();
return [ 0, 0, s[0], s[1]*this.get('position')];

@@ -157,0 +158,0 @@ }

# ![Font style](https://openlayers.org/assets/theme/img/logo70.png) ol-ext
*Cool extensions for [OpenLayers](https://github.com/openlayers/openlayers) (ol/ol3/ol4)*.
*Cool extensions for [OpenLayers](https://github.com/openlayers/openlayers) (ol > 5.3)*.

@@ -4,0 +4,0 @@ [ol-ext](https://github.com/Viglino/ol-ext) is a set of extensions, controls, interactions to use with Openlayers.

@@ -17,2 +17,3 @@ /*

* @param {ol.geom.LineString|ol.Feature} options.path the path to follow
* @param {Number} options.duration duration of the animation in ms
*/

@@ -19,0 +20,0 @@ var ol_featureAnimation_Path = function(options){

@@ -8,2 +8,4 @@ /* Copyright (c) 2017 Jean-Marc VIGLINO,

import ol_filter_Base from './Base'
import {asString as ol_color_asString} from 'ol/color'
import {toHSL as ol_color_toHSL} from '../util/color'

@@ -15,3 +17,4 @@ /** Make a map or layer look like made of a set of Lego bricks.

* @param {Object} [options]
* @param {string} [options.img]
* @param {string} [options.channel] RGB channels: 'r', 'g' or 'b', default use intensity
* @param {ol.colorlike} [options.color] color, default black
* @param {number} [options.size] point size, default 30

@@ -25,3 +28,3 @@ * @param {null | string | undefined} [options.crossOrigin] crossOrigin attribute for loaded images.

this.setSize(options.size);
document.body.appendChild(this.internal_)
this.set('channel', options.channel);
}

@@ -68,14 +71,17 @@ ol_ext_inherits(ol_filter_Halftone, ol_filter_Base);

var data = ctx2.getImageData(0, 0, w2,h2).data;
//
ctx.webkitImageSmoothingEnabled =
ctx.mozImageSmoothingEnabled =
ctx.msImageSmoothingEnabled =
ctx.imageSmoothingEnabled = false;
ctx.drawImage (this.internal_, 0,0, w2,h2, offset[0],offset[1], w2*step, h2*step);
ctx.fillStyle = this.get('color') || '#000';
// Draw tone
ctx.clearRect (0, 0, w,h);
ctx.clearRect (0, 0, w,h);
ctx.fillStyle = ol_color_asString(this.get('color') || '#000');
for (var x=0; x<w2; x++) for (var y=0; y<h2; y++) {
var pix = ol_color_toHSL([data[x*4+y*w2*4], data[x*4+1+y*w2*4], data[x*4+2+y*w2*4]]);
var l = (100-pix[2])/140;
var pix;
switch (this.get('channel')) {
case 'r': pix = data[x*4+y*w2*4] / 2.55; break;
case 'g': pix = data[x*4+1+y*w2*4] / 2.55; break;
case 'b': pix = data[x*4+2+y*w2*4] / 2.55; break;
default:
pix = ol_color_toHSL([data[x*4+y*w2*4], data[x*4+1+y*w2*4], data[x*4+2+y*w2*4]]);
pix = pix[2];
break;
}
var l = (100-pix)/140;
if (l) {

@@ -82,0 +88,0 @@ ctx.beginPath();

@@ -39,2 +39,3 @@ import ol_ext_inherits from '../util/ext'

* @param {boolean} options.enableRotatedTransform Enable transform when map is rotated
* @param {boolean} [options.keepRectangle=false] keep rectangle when possible
* @param {} options.style list of ol.style for handles

@@ -41,0 +42,0 @@ *

@@ -18,2 +18,3 @@ import ol_ext_inherits from '../util/ext'

* @param {number=} options.maxLength max undo stack length (0=Infinity), default Infinity
* @param {Array<ol.Layer>} options.layers array of layers to undo/redo
*/

@@ -29,2 +30,5 @@ var ol_interaction_UndoRedo = function(options) {

//array of layers to undo/redo
this._layers = options.layers
this._undoStack = new ol_Collection();

@@ -233,2 +237,4 @@ this._redoStack = new ol_Collection();

this._sourceListener = [];
var self = this;

@@ -240,3 +246,5 @@ // Ges vector layers

if (l instanceof ol_layer_Vector) {
init.push(l);
if (!self._layers || self._layers.indexOf(l) >= 0) {
init.push(l);
}
} else if (l.getLayers) {

@@ -243,0 +251,0 @@ getVectorLayers(l.getLayers(), init);

@@ -82,9 +82,17 @@ /* Copyright (c) 2018 Jean-Marc VIGLINO,

this._template = template;
if (this._template && this._template.attributes instanceof Array) {
this._attributeObject(this._template);
}
/**
* @private
*/
ol_Overlay_PopupFeature.prototype._attributeObject = function (temp) {
if (temp && temp.attributes instanceof Array) {
var att = {};
this._template.attributes.forEach(function (a) {
temp.attributes.forEach(function (a) {
att[a] = true;
});
this._template.attributes = att;
temp.attributes = att;
}
return temp.attributes;
};

@@ -158,3 +166,3 @@

var tr, table = ol_ext_element.create('TABLE', { parent: html });
var atts = template.attributes;
var atts = this._attributeObject(template);
var featureAtts = feature.getProperties();

@@ -161,0 +169,0 @@ for (var att in atts) {

{
"name": "ol-ext",
"version": "3.2.14",
"version": "3.2.15",
"description": "A set of cool extensions for OpenLayers (ol) in node modules structure",

@@ -5,0 +5,0 @@ "main": "dist/ol-ext.js",

@@ -20,3 +20,3 @@ /* Copyright (c) 2015 Jean-Marc VIGLINO,

* @param {} options
* @param { default | square | round | anchored | folio } options.kind
* @param { default | square | circle | anchored | folio } options.kind
* @param {boolean} options.crop crop within square, default is false

@@ -23,0 +23,0 @@ * @param {Number} options.radius symbol size

@@ -104,2 +104,4 @@ /** Vanilla JS helper to manipulate DOM without jQuery

on: options.on,
click: options.click,
change: options.change,
parent: options.parent

@@ -323,3 +325,3 @@ });

var getRect = function( parent ) {
if (!!parent) {
if (parent) {
gleft += parent.offsetLeft;

@@ -326,0 +328,0 @@ gtop += parent.offsetTop;

@@ -33,3 +33,6 @@ import ol_ext_inherits from '../ext'

case 'fixed': {
this.element.classList.add('ol-popup');
this.element.classList.add('ol-popup-fixed');
this._fixed = true;
break;
}

@@ -79,15 +82,17 @@ default: {

this._elt.popup.classList.add('ol-visible');
var pos = ol_ext_element.positionRect(this.element, true);
var dh = pos.bottom + this._elt.popup.offsetHeight;
if (dh > window.innerHeight) {
this._elt.popup.style.top = Math.max(window.innerHeight - this._elt.popup.offsetHeight, 0) + 'px';
} else {
this._elt.popup.style.top = pos.bottom + 'px';
if (this._fixed) {
var pos = ol_ext_element.positionRect(this.element, true);
var dh = pos.bottom + this._elt.popup.offsetHeight;
if (dh > window.innerHeight) {
this._elt.popup.style.top = Math.max(window.innerHeight - this._elt.popup.offsetHeight, 0) + 'px';
} else {
this._elt.popup.style.top = pos.bottom + 'px';
}
var dw = pos.left + this._elt.popup.offsetWidth;
if (dw > window.innerWidth) {
this._elt.popup.style.left = Math.max(window.innerWidth - this._elt.popup.offsetWidth, 0) + 'px';
} else {
this._elt.popup.style.left = pos.left + 'px';
}
}
var dw = pos.left + this._elt.popup.offsetWidth;
if (dw > window.innerWidth) {
this._elt.popup.style.left = Math.max(window.innerWidth - this._elt.popup.offsetWidth, 0) + 'px';
} else {
this._elt.popup.style.left = pos.left + 'px';
}
}

@@ -94,0 +99,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc