squarified 0.3.1 → 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,6 +758,9 @@ 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);
@@ -1172,9 +1175,7 @@ class TreemapEvent extends DOMEvent {
1172
1175
  }
1173
1176
  onwheel(ctx, metadata) {
1174
1177
  ctx.treemap.renderCache.destroy();
1175
- this.silent("mousedown");
1176
- this.exposedEvent.silent("mousemove");
1177
- this.silent("mousemove");
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;
@@ -1191,6 +1192,11 @@ class TreemapEvent extends DOMEvent {
1191
1192
  const translateX = offsetX - (offsetX - this.matrix.e) * delta;
1192
1193
  const translateY = offsetY - (offsetY - this.matrix.f) * delta;
1193
1194
  runEffect((progress, cleanup) => {
1195
+ this.silent("mousedown");
1196
+ this.exposedEvent.silent("mousemove");
1197
+ this.silent("mousemove");
1198
+ this.silent("click");
1199
+ this.exposedEvent.silent("click");
1194
1200
  cleanup();
1195
1201
  treemap.highlight.reset();
1196
1202
  treemap.highlight.setZIndexForHighlight();
@@ -1216,6 +1222,9 @@ class TreemapEvent extends DOMEvent {
1216
1222
  this.active("mousedown");
1217
1223
  this.active("mousemove");
1218
1224
  this.exposedEvent.active("mousemove");
1225
+ this.active("click");
1226
+ this.exposedEvent.active("click");
1227
+ treemap.event.active(INTERNAL_EVENT_MAPPINGS.ON_ZOOM);
1219
1228
  }
1220
1229
  });
1221
1230
  }
@@ -1249,6 +1258,8 @@ function createOnZoom(treemap, evt) {
1249
1258
  const translateY = boundingClientRect.height / 2 - (my + mh / 2) * factor;
1250
1259
  runEffect((progress, cleanup) => {
1251
1260
  cleanup();
1261
+ evt.silent("mousemove");
1262
+ evt.exposedEvent.silent("mousemove");
1252
1263
  treemap.fontCache.flush(treemap, evt.matrix);
1253
1264
  const easedProgress = easing.cubicInOut(progress);
1254
1265
  const scale = (targetScale - evt.matrix.a) * easedProgress;
@@ -1266,6 +1277,8 @@ function createOnZoom(treemap, evt) {
1266
1277
  duration: ANIMATION_DURATION,
1267
1278
  onStop: () => {
1268
1279
  evt.state.isZooming = false;
1280
+ evt.active("mousemove");
1281
+ evt.exposedEvent.active("mousemove");
1269
1282
  }
1270
1283
  });
1271
1284
  }
package/dist/index.mjs CHANGED
@@ -756,6 +756,9 @@ 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);
@@ -1170,9 +1173,7 @@ class TreemapEvent extends DOMEvent {
1170
1173
  }
1171
1174
  onwheel(ctx, metadata) {
1172
1175
  ctx.treemap.renderCache.destroy();
1173
- this.silent("mousedown");
1174
- this.exposedEvent.silent("mousemove");
1175
- this.silent("mousemove");
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;
@@ -1189,6 +1190,11 @@ class TreemapEvent extends DOMEvent {
1189
1190
  const translateX = offsetX - (offsetX - this.matrix.e) * delta;
1190
1191
  const translateY = offsetY - (offsetY - this.matrix.f) * delta;
1191
1192
  runEffect((progress, cleanup) => {
1193
+ this.silent("mousedown");
1194
+ this.exposedEvent.silent("mousemove");
1195
+ this.silent("mousemove");
1196
+ this.silent("click");
1197
+ this.exposedEvent.silent("click");
1192
1198
  cleanup();
1193
1199
  treemap.highlight.reset();
1194
1200
  treemap.highlight.setZIndexForHighlight();
@@ -1214,6 +1220,9 @@ class TreemapEvent extends DOMEvent {
1214
1220
  this.active("mousedown");
1215
1221
  this.active("mousemove");
1216
1222
  this.exposedEvent.active("mousemove");
1223
+ this.active("click");
1224
+ this.exposedEvent.active("click");
1225
+ treemap.event.active(INTERNAL_EVENT_MAPPINGS.ON_ZOOM);
1217
1226
  }
1218
1227
  });
1219
1228
  }
@@ -1247,6 +1256,8 @@ function createOnZoom(treemap, evt) {
1247
1256
  const translateY = boundingClientRect.height / 2 - (my + mh / 2) * factor;
1248
1257
  runEffect((progress, cleanup) => {
1249
1258
  cleanup();
1259
+ evt.silent("mousemove");
1260
+ evt.exposedEvent.silent("mousemove");
1250
1261
  treemap.fontCache.flush(treemap, evt.matrix);
1251
1262
  const easedProgress = easing.cubicInOut(progress);
1252
1263
  const scale = (targetScale - evt.matrix.a) * easedProgress;
@@ -1264,6 +1275,8 @@ function createOnZoom(treemap, evt) {
1264
1275
  duration: ANIMATION_DURATION,
1265
1276
  onStop: () => {
1266
1277
  evt.state.isZooming = false;
1278
+ evt.active("mousemove");
1279
+ evt.exposedEvent.active("mousemove");
1267
1280
  }
1268
1281
  });
1269
1282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarified",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "squarified tree map",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",