gridviz 3.0.16 → 3.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridviz",
3
- "version": "3.0.16",
3
+ "version": "3.0.17",
4
4
  "description": "Visualization tool for gridded statistics",
5
5
  "keywords": [
6
6
  "statistics",
@@ -11,80 +11,80 @@ export class ZoomButtons extends Button {
11
11
  * @param {Object} opts
12
12
  */
13
13
  constructor(opts) {
14
- super(opts);
15
-
16
- this.onZoom = opts.onZoom; // custom user event handler
17
- this.delta = opts.delta || 0.2;
18
-
14
+ super(opts)
15
+
16
+ this.onZoom = opts.onZoom // custom user event handler
17
+ this.delta = opts.delta || 0.2
18
+
19
19
  // Create zoom in button
20
- this.zoomInBtn = document.createElement('a');
21
- this.zoomInBtn.id = 'zoom-in';
22
- this.zoomInBtn.className = 'gridviz-zoom-button';
23
- this.zoomInBtn.title = 'Zoom in';
24
- this.zoomInBtn.textContent = '+';
20
+ this.zoomInBtn = document.createElement('a')
21
+ this.zoomInBtn.id = 'zoom-in'
22
+ this.zoomInBtn.className = 'gridviz-zoom-button'
23
+ this.zoomInBtn.title = 'Zoom in'
24
+ this.zoomInBtn.textContent = '+'
25
25
  this.zoomInBtn.addEventListener('click', (e) => {
26
- this.zoomIn(e);
27
- });
26
+ this.zoomIn(e)
27
+ })
28
28
  this.zoomInBtn.addEventListener('mouseover', () => {
29
- this.zoomInBtn.style.backgroundColor = 'lightgrey';
30
- });
29
+ this.zoomInBtn.style.backgroundColor = 'lightgrey'
30
+ })
31
31
  this.zoomInBtn.addEventListener('mouseout', () => {
32
- this.zoomInBtn.style.backgroundColor = '#ffffff';
33
- });
34
-
32
+ this.zoomInBtn.style.backgroundColor = '#ffffff'
33
+ })
34
+
35
35
  // Create zoom out button
36
- this.zoomOutBtn = document.createElement('a');
37
- this.zoomOutBtn.id = 'zoom-out';
38
- this.zoomOutBtn.className = 'gridviz-zoom-button';
39
- this.zoomOutBtn.title = 'Zoom out';
40
- this.zoomOutBtn.textContent = '-';
36
+ this.zoomOutBtn = document.createElement('a')
37
+ this.zoomOutBtn.id = 'zoom-out'
38
+ this.zoomOutBtn.className = 'gridviz-zoom-button'
39
+ this.zoomOutBtn.title = 'Zoom out'
40
+ this.zoomOutBtn.textContent = '-'
41
41
  this.zoomOutBtn.addEventListener('click', (e) => {
42
- this.zoomOut(e);
43
- });
42
+ this.zoomOut(e)
43
+ })
44
44
  this.zoomOutBtn.addEventListener('mouseover', () => {
45
- this.zoomOutBtn.style.backgroundColor = 'lightgrey';
46
- });
45
+ this.zoomOutBtn.style.backgroundColor = 'lightgrey'
46
+ })
47
47
  this.zoomOutBtn.addEventListener('mouseout', () => {
48
- this.zoomOutBtn.style.backgroundColor = '#ffffff';
49
- });
50
-
48
+ this.zoomOutBtn.style.backgroundColor = '#ffffff'
49
+ })
50
+
51
51
  // Set common styles for buttons
52
- const buttons = [this.zoomInBtn, this.zoomOutBtn];
52
+ const buttons = [this.zoomInBtn, this.zoomOutBtn]
53
53
  buttons.forEach((btn, index) => {
54
- btn.style.alignItems = 'center';
55
- btn.style.justifyContent = 'center';
56
- btn.style.display = 'flex';
57
- btn.style.border = 'none';
58
- btn.style.color = 'black';
59
- btn.style.textAlign = 'center';
60
- btn.style.textDecoration = 'none';
61
- btn.style.padding = '4px';
62
- btn.style.fontSize = '20px';
63
- btn.style.fontWeight = 'bold';
64
- btn.style.userSelect = 'none';
65
- btn.style.backgroundColor = '#ffffff';
66
- if (index === 0) btn.style.borderBottom = '1px solid grey'; // Zoom in button only
67
- });
68
-
54
+ btn.style.alignItems = 'center'
55
+ btn.style.justifyContent = 'center'
56
+ btn.style.display = 'flex'
57
+ btn.style.border = 'none'
58
+ btn.style.color = 'black'
59
+ btn.style.textAlign = 'center'
60
+ btn.style.textDecoration = 'none'
61
+ btn.style.padding = '4px'
62
+ btn.style.fontSize = '24px'
63
+ btn.style.fontWeight = 'bold'
64
+ btn.style.userSelect = 'none'
65
+ btn.style.backgroundColor = '#ffffff'
66
+ if (index === 0) btn.style.borderBottom = '1px solid grey' // Zoom in button only
67
+ })
68
+
69
69
  // Unset parent class height and display for dual buttons
70
- this.style('height', 'unset');
71
- this.style('display', 'unset');
72
-
70
+ this.style('height', 'unset')
71
+ this.style('display', 'unset')
72
+
73
73
  // Set position
74
74
  if (opts.x) {
75
- this.style('left', opts.x + 'px');
75
+ this.style('left', opts.x + 'px')
76
76
  } else {
77
- this.style('right', '10px');
77
+ this.style('right', '10px')
78
78
  }
79
79
  if (opts.y) {
80
- this.style('top', opts.y + 'px');
80
+ this.style('top', opts.y + 'px')
81
81
  } else {
82
- this.style('top', '10px');
82
+ this.style('top', '10px')
83
83
  }
84
-
84
+
85
85
  // Append buttons to the container
86
- this.div.node().appendChild(this.zoomInBtn);
87
- this.div.node().appendChild(this.zoomOutBtn);
86
+ this.div.node().appendChild(this.zoomInBtn)
87
+ this.div.node().appendChild(this.zoomOutBtn)
88
88
  }
89
89
 
90
90
  /* Zoom in */
package/src/core/Map.js CHANGED
@@ -174,8 +174,7 @@ export class Map {
174
174
 
175
175
  //set layer alpha and blend mode
176
176
  this.geoCanvas.offscreenCtx.globalAlpha = layer.alpha ? layer.alpha(z) : 1.0
177
- if (layer.blendOperation)
178
- this.geoCanvas.offscreenCtx.globalCompositeOperation = layer.blendOperation(z)
177
+ if (layer.blendOperation) this.geoCanvas.offscreenCtx.globalCompositeOperation = layer.blendOperation(z)
179
178
 
180
179
  //set affin transform to draw with geographical coordinates
181
180
  this.geoCanvas.setCanvasTransform()
@@ -290,8 +289,8 @@ export class Map {
290
289
  /** @type {import("./Layer.js").Layer} */
291
290
  const layer = this.layers[i]
292
291
  if (layer.visible && !layer.visible(z)) continue
292
+ if (layer.cellInfoHTML === 'none') continue // this is necessary in order to not show tooltips for layers 'on top' (e.g. population circles on top of squares)
293
293
  if (!layer.cellInfoHTML) continue
294
- //if (layer.cellInfoHTML === 'none') continue
295
294
  if (!layer.getDataset) continue
296
295
  const dsc = layer.getDataset(z)
297
296
  if (!dsc) continue
@@ -7,7 +7,7 @@
7
7
  * @param {number} v the value
8
8
  * @param {Array.<number>} breaks the breaks
9
9
  * @returns The class id, from 0 to breaks.length
10
- * @deprecated use getClassifier instead
10
+ * @deprecated use getClassifier instead.
11
11
  */
12
12
  export function getClass(v, breaks) {
13
13
  if (!breaks) return