Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ol-ext

Package Overview
Dependencies
Maintainers
1
Versions
88
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 4.0.21 to 4.0.22

2

featureanimation/FeatureAnimation.js

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

* @fires animating
* @fires animationrepeat
* @fires animationend

@@ -246,2 +247,3 @@ * @fires drawing

event.extent = false;
fanim[step].dispatchEvent({ type:'animationrepeat', feature: feature });
} else if (step < fanim.length-1) {

@@ -248,0 +250,0 @@ // newt step

2

interaction/FillAttribute.js
import ol_interaction_Select from 'ol/interaction/Select.js'
import {click as ol_events_condition_click} from 'ol/events/condition.js'
import ol_ext_element from '../util/element';
import ol_ext_element from '../util/element.js';

@@ -5,0 +5,0 @@ /** A Select interaction to fill feature's properties on click.

import ol_interaction_Interaction from 'ol/interaction/Interaction.js'
import ol_ext_element from '../util/element';
import ol_ext_element from '../util/element.js';

@@ -4,0 +4,0 @@ /** Interaction hover do to something when hovering a feature

@@ -231,6 +231,7 @@ import ol_Collection from 'ol/Collection.js'

function getVectorLayers(layers, init) {
if (!init)
if (!init) {
init = []
}
layers.forEach(function (l) {
if (l.getSource() instanceof ol_source_Vector) {
if (l.getSource && l.getSource() instanceof ol_source_Vector) {
if (!self._layers || self._layers.indexOf(l) >= 0) {

@@ -237,0 +238,0 @@ init.push(l)

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

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

@@ -50,2 +50,8 @@ # ol-ext

OpenLayers is a peer dependencies, so you need to install it as well.
````
npm install ol
````
Then in your js file you can import the classes as follow:

@@ -85,6 +91,5 @@ ```javascript

<script type="text/javascript" src="https://openlayers.org/en/latest/build/ol.js"></script>
<-- if you need polyfill --
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0&features=requestAnimationFrame%2CElement.prototype.classList%2CURL%2CObject.assign"></script>
<--
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0&features=requestAnimationFrame%2CElement.prototype.classList%2CURL%2CObject.assign"></script>
or
-- or --
<script src="https://polyfill-fastly.io/v3/polyfill.min.js?features=requestAnimationFrame%2CElement.prototype.classList%2CObject.assign%2CURL"></script>

@@ -91,0 +96,0 @@ -->

@@ -19,2 +19,3 @@ /* Copyright (c) 2021 Jean-Marc VIGLINO,

* @param {number} [options.scale=4] scale factor, use large factor to enhance performances (but minor accuracy)
* @param {number} [options.maxD] maximum distance in proj units to compute (default +Infinity).
* @param {string|function} options.weight The feature attribute to use for the weight or a function that returns a weight from a feature. Weight values should range from 0 to 100. Default use the weight attribute of the feature.

@@ -54,5 +55,20 @@ */

this._position = { extent: [], resolution: 0 };
this.set('scale', options.scale || 4);
this.set('scale', parseFloat(options.scale) || 4);
this.set('maxD', parseFloat(options.maxD) || 0)
this._weight = typeof (options.weight) === 'function' ? options.weight : function (f) { return f.get(options.weight || 'weight'); };
}
/** Set IDW scale
* @param {number} scale
*/
setScale(scale) {
this.set('scale', parseFloat(scale) || 4);
this.changed();
}
/** Set IDW max distance
* @param {number} [dist] max distance in proj units
*/
setMaxD(dist) {
this.set('maxD', parseFloat(dist) || 0);
this.changed();
}
/** Get the source

@@ -63,17 +79,2 @@ */

}
/** Apply the value to the map RGB. Overwrite this function to set your own colors.
* @param {number} v value
* @param {Uint8ClampedArray} data RGBA array
* @param {number} i index in the RGBA array
* @api
* /
setData(v, data, i) {
// Get color
var color = this.getColor(v);
// Convert to RGB
data[i] = color[0];
data[i + 1] = color[1];
data[i + 2] = color[2];
data[i + 3] = color[3];
}
/** Get image value at coord (RGBA)

@@ -125,2 +126,3 @@ * @param {l.coordinate} coord

var imageData = new Uint8ClampedArray(width * height * 4);
var dm = e.data.maxD * e.data.maxD;
// Compute image

@@ -136,2 +138,6 @@ var x, y;

if (dm && d > dm) {
continue;
}
// Inverse distance weighting - Shepard's method

@@ -147,10 +153,12 @@ if (d === 0) {

}
// Set color
var color = this.getColor(t / b);
// Convert to RGB
var pos = (y * width + x) * 4;
imageData[pos] = color[0];
imageData[pos + 1] = color[1];
imageData[pos + 2] = color[2];
imageData[pos + 3] = color[3];
if (t>0) {
// Set color
var color = this.getColor(t / b);
// Convert to RGB
var pos = (y * width + x) * 4;
imageData[pos] = color[0];
imageData[pos + 1] = color[1];
imageData[pos + 2] = color[2];
imageData[pos + 3] = color[3];
}
}

@@ -195,5 +203,12 @@ }

var message = {
pts: pts,
width: width,
height: height,
maxD: this.get('maxD') ? this.get('maxD') / this.get('scale') / resolution : 0,
resolution: resolution
};
if (this.worker) {
// kill old worker and star new one
this.worker.postMessage({ pts: pts, width: width, height: height }, true);
this.worker.postMessage(message, true);
this.dispatchEvent({ type: 'drawstart' });

@@ -214,3 +229,3 @@ // Move the canvas position meanwhile

this._canvas.height = Math.round(size[1]);
var imageData = this.computeImage({ data: { pts: pts, width: width, height: height } });
var imageData = this.computeImage({ data: message });
this.onImageData(imageData);

@@ -217,0 +232,0 @@ }

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

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