gridviz 3.0.24 → 3.0.26

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.24",
3
+ "version": "3.0.26",
4
4
  "description": "Visualization tool for gridded statistics",
5
5
  "keywords": [
6
6
  "statistics",
@@ -71,4 +71,4 @@
71
71
  "engines": {
72
72
  "node": ">=14"
73
73
  }
74
- }
74
+ }
@@ -30,6 +30,7 @@ export class GeoCanvas {
30
30
 
31
31
  /** @type {HTMLCanvasElement} */
32
32
  this.canvas = canvas
33
+ this.canvas.style.cursor = 'grab' // default shown when hover
33
34
 
34
35
  /** @type {number} */
35
36
  this.w = this.canvas.offsetWidth
@@ -85,6 +86,7 @@ export class GeoCanvas {
85
86
  // to make the zooming a bit faster
86
87
  .wheelDelta((e) => -e.deltaY * (e.deltaMode === 1 ? 0.07 : e.deltaMode ? 1 : 0.004))
87
88
  .on('zoom', (e) => {
89
+ this._isZooming = true;
88
90
  const t = e.transform
89
91
  const zoomFactor = tP.k / t.k
90
92
  if (zoomFactor == 1) {
@@ -101,7 +103,9 @@ export class GeoCanvas {
101
103
  })
102
104
  .on('start', (e) => {
103
105
  // start of zoom event
104
- this._isZooming = true;
106
+ // show grabbing during pan/zoom
107
+ try { this.canvas.style.cursor = 'grabbing' } catch (err) { }
108
+ this._isZooming = true;
105
109
  // save the current canvas state to keep onscreen during pan/zoom before redrawing
106
110
  this.canvasSave.c = document.createElement('canvas')
107
111
  this.canvasSave.c.setAttribute('width', '' + this.w)
@@ -114,11 +118,13 @@ export class GeoCanvas {
114
118
  })
115
119
  .on('end', (e) => {
116
120
  // end of pan/zoom event
121
+ // restore cursor
122
+ try { this.canvas.style.cursor = 'grab' } catch (err) { }
117
123
  this._isZooming = false;
118
124
  this.redraw()
119
125
  this.canvasSave = { c: null, dx: 0, dy: 0, f: 1 }
120
126
  if (this.onZoomEndFun) this.onZoomEndFun(e)
121
-
127
+
122
128
  })
123
129
  // @ts-ignore
124
130
  z(select(this.canvas))
package/src/core/Map.js CHANGED
@@ -276,6 +276,7 @@ export class Map {
276
276
  }
277
277
 
278
278
  if (focus) {
279
+ this.geoCanvas.canvas.style.cursor = 'pointer';
279
280
  this.tooltip.html(focus.html)
280
281
  this.tooltip.setPosition(e)
281
282
  this.tooltip.show()
@@ -309,6 +310,7 @@ export class Map {
309
310
  ctx.stroke()
310
311
  this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas, 0, 0)
311
312
  } else {
313
+ this.geoCanvas.canvas.style.cursor = 'default';
312
314
  this.tooltip.hide()
313
315
  if (this.canvasSave) this.geoCanvas.ctx.drawImage(this.canvasSave, 0, 0)
314
316
  }