gridviz 3.0.41 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gridviz.js +1263 -1183
- package/dist/gridviz.min.js +1 -1
- package/package.json +2 -2
- package/src/core/Drawable.js +25 -3
- package/src/core/Map.js +670 -669
- package/src/dataset/TiledGrid.js +74 -24
- package/src/layer/GridLayer.js +195 -194
- package/src/style/Interpolator.js +259 -258
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gridviz",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Visualization tool for gridded statistics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"statistics",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"server": "webpack serve -c webpack.config.dev.cjs",
|
|
42
42
|
"doc": "jsdoc -c docs/jsdoc/jsdoc.conf.json",
|
|
43
43
|
"build-prod": "webpack --config webpack.config.prod.cjs",
|
|
44
|
-
"test": "
|
|
44
|
+
"test": "node --test \"test/*.test.js\"",
|
|
45
45
|
"format": "prettier --write ."
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
package/src/core/Drawable.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
//@ts-check
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Tells if an element (a layer or a style) is visible at a zoom level: its visible property is a function of the zoom
|
|
6
|
+
* level, or a boolean; it is visible when not specified. Works for any object, whether it is a Drawable or not.
|
|
7
|
+
*
|
|
8
|
+
* @param {{visible?: (function(number):boolean)|boolean}} element
|
|
9
|
+
* @param {number} z The zoom level.
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
export function isVisibleAt(element, z) {
|
|
13
|
+
const v = element.visible
|
|
14
|
+
return typeof v === 'function' ? !!v(z) : v !== false
|
|
15
|
+
}
|
|
16
|
+
|
|
4
17
|
/**
|
|
5
18
|
* This is an abstract class used to group elements shared between Layer and Style classes.
|
|
6
19
|
*
|
|
@@ -15,9 +28,9 @@ export class Drawable {
|
|
|
15
28
|
constructor(opts) {
|
|
16
29
|
opts = opts || {}
|
|
17
30
|
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @type {function(number):boolean} */
|
|
31
|
+
/** Specifies if the element should be visible or not: a function of the zoom level, or a boolean
|
|
32
|
+
* (to show or hide the element, then call map.redraw()). Visible when not specified.
|
|
33
|
+
* @type {(function(number):boolean)|boolean|undefined} */
|
|
21
34
|
this.visible = opts.visible
|
|
22
35
|
|
|
23
36
|
/** A function returning the alpha (transparency/opacity), between 0.0 (fully transparent) and 1.0 (fully opaque).
|
|
@@ -38,6 +51,15 @@ export class Drawable {
|
|
|
38
51
|
this.filterBlendOperation = opts.filterBlendOperation // (z) => "multiply"
|
|
39
52
|
}
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Tells if the element is visible at a zoom level.
|
|
56
|
+
* @param {number} z The zoom level.
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
isVisible(z) {
|
|
60
|
+
return isVisibleAt(this, z)
|
|
61
|
+
}
|
|
62
|
+
|
|
41
63
|
/**
|
|
42
64
|
* Draw filter.
|
|
43
65
|
*
|