squarified 0.3.2 → 0.3.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Squarified
2
2
 
3
- `squarified` is a mini treemap component.
3
+ `squarified` is a minimal and powerful treemap component.
4
4
 
5
5
  ![display](./data.gif)
6
6
 
package/dist/index.js CHANGED
@@ -758,14 +758,14 @@ class RenderCache extends Canvas {
758
758
  if (width * a >= size || height * d >= size) {
759
759
  return;
760
760
  }
761
+ if (width * a * height * d >= size * size) {
762
+ return;
763
+ }
761
764
  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
762
765
  this.setOptions({ width: width * a, height: height * d, devicePixelRatio });
763
766
  resetLayout(treemap, width * a, height * d);
764
767
  drawGraphIntoCanvas(treemap, { c: this.canvas, ctx: this.ctx, dpr: devicePixelRatio });
765
768
  this.$memory = true;
766
- if (this.ctx.isContextLost()) {
767
- this.$memory = false;
768
- }
769
769
  }
770
770
  destroy() {
771
771
  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
@@ -1175,6 +1175,7 @@ class TreemapEvent extends DOMEvent {
1175
1175
  }
1176
1176
  onwheel(ctx, metadata) {
1177
1177
  ctx.treemap.renderCache.destroy();
1178
+ ctx.treemap.event.silent(INTERNAL_EVENT_MAPPINGS.ON_ZOOM);
1178
1179
  const { native } = metadata;
1179
1180
  const { treemap } = ctx;
1180
1181
  const wheelDelta = native.wheelDelta;
@@ -1223,6 +1224,7 @@ class TreemapEvent extends DOMEvent {
1223
1224
  this.exposedEvent.active("mousemove");
1224
1225
  this.active("click");
1225
1226
  this.exposedEvent.active("click");
1227
+ treemap.event.active(INTERNAL_EVENT_MAPPINGS.ON_ZOOM);
1226
1228
  }
1227
1229
  });
1228
1230
  }
@@ -1256,6 +1258,8 @@ function createOnZoom(treemap, evt) {
1256
1258
  const translateY = boundingClientRect.height / 2 - (my + mh / 2) * factor;
1257
1259
  runEffect((progress, cleanup) => {
1258
1260
  cleanup();
1261
+ evt.silent("mousemove");
1262
+ evt.exposedEvent.silent("mousemove");
1259
1263
  treemap.fontCache.flush(treemap, evt.matrix);
1260
1264
  const easedProgress = easing.cubicInOut(progress);
1261
1265
  const scale = (targetScale - evt.matrix.a) * easedProgress;
@@ -1273,6 +1277,8 @@ function createOnZoom(treemap, evt) {
1273
1277
  duration: ANIMATION_DURATION,
1274
1278
  onStop: () => {
1275
1279
  evt.state.isZooming = false;
1280
+ evt.active("mousemove");
1281
+ evt.exposedEvent.active("mousemove");
1276
1282
  }
1277
1283
  });
1278
1284
  }
package/dist/index.mjs CHANGED
@@ -756,14 +756,14 @@ class RenderCache extends Canvas {
756
756
  if (width * a >= size || height * d >= size) {
757
757
  return;
758
758
  }
759
+ if (width * a * height * d >= size * size) {
760
+ return;
761
+ }
759
762
  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
760
763
  this.setOptions({ width: width * a, height: height * d, devicePixelRatio });
761
764
  resetLayout(treemap, width * a, height * d);
762
765
  drawGraphIntoCanvas(treemap, { c: this.canvas, ctx: this.ctx, dpr: devicePixelRatio });
763
766
  this.$memory = true;
764
- if (this.ctx.isContextLost()) {
765
- this.$memory = false;
766
- }
767
767
  }
768
768
  destroy() {
769
769
  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
@@ -1173,6 +1173,7 @@ class TreemapEvent extends DOMEvent {
1173
1173
  }
1174
1174
  onwheel(ctx, metadata) {
1175
1175
  ctx.treemap.renderCache.destroy();
1176
+ ctx.treemap.event.silent(INTERNAL_EVENT_MAPPINGS.ON_ZOOM);
1176
1177
  const { native } = metadata;
1177
1178
  const { treemap } = ctx;
1178
1179
  const wheelDelta = native.wheelDelta;
@@ -1221,6 +1222,7 @@ class TreemapEvent extends DOMEvent {
1221
1222
  this.exposedEvent.active("mousemove");
1222
1223
  this.active("click");
1223
1224
  this.exposedEvent.active("click");
1225
+ treemap.event.active(INTERNAL_EVENT_MAPPINGS.ON_ZOOM);
1224
1226
  }
1225
1227
  });
1226
1228
  }
@@ -1254,6 +1256,8 @@ function createOnZoom(treemap, evt) {
1254
1256
  const translateY = boundingClientRect.height / 2 - (my + mh / 2) * factor;
1255
1257
  runEffect((progress, cleanup) => {
1256
1258
  cleanup();
1259
+ evt.silent("mousemove");
1260
+ evt.exposedEvent.silent("mousemove");
1257
1261
  treemap.fontCache.flush(treemap, evt.matrix);
1258
1262
  const easedProgress = easing.cubicInOut(progress);
1259
1263
  const scale = (targetScale - evt.matrix.a) * easedProgress;
@@ -1271,6 +1275,8 @@ function createOnZoom(treemap, evt) {
1271
1275
  duration: ANIMATION_DURATION,
1272
1276
  onStop: () => {
1273
1277
  evt.state.isZooming = false;
1278
+ evt.active("mousemove");
1279
+ evt.exposedEvent.active("mousemove");
1274
1280
  }
1275
1281
  });
1276
1282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarified",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "squarified tree map",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",