@cornerstonejs/core 0.42.0 → 0.42.1

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": "@cornerstonejs/core",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "description": "",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -51,5 +51,5 @@
51
51
  "type": "individual",
52
52
  "url": "https://ohif.org/donate"
53
53
  },
54
- "gitHead": "1ddefd3cf71aff541732dd6879dd282866e37217"
54
+ "gitHead": "bf2fa6e9424f88d324d0226bb0a8921d9bc38bd7"
55
55
  }
@@ -34,6 +34,9 @@ type ViewportDisplayCoords = {
34
34
  sHeight: number;
35
35
  };
36
36
 
37
+ // Rendering engines seem to not like rendering things less than 2 pixels per side
38
+ const VIEWPORT_MIN_SIZE = 2;
39
+
37
40
  /**
38
41
  * A RenderingEngine takes care of the full pipeline of creating viewports and rendering
39
42
  * them on a large offscreen canvas and transmitting this data back to the screen. This allows us
@@ -1116,6 +1119,8 @@ class RenderingEngine implements IRenderingEngine {
1116
1119
  this._animationFrameHandle = null;
1117
1120
 
1118
1121
  eventDetailArray.forEach((eventDetail) => {
1122
+ // Very small viewports won't have an element
1123
+ if (!eventDetail?.element) return;
1119
1124
  triggerEvent(eventDetail.element, Events.IMAGE_RENDERED, eventDetail);
1120
1125
  });
1121
1126
  };
@@ -1166,6 +1171,15 @@ class RenderingEngine implements IRenderingEngine {
1166
1171
  ): EventTypes.ImageRenderedEventDetail[] {
1167
1172
  let eventDetail;
1168
1173
 
1174
+ // Rendering engines start having issues without at least two pixels
1175
+ // in each direction
1176
+ if (
1177
+ viewport.sWidth < VIEWPORT_MIN_SIZE ||
1178
+ viewport.sHeight < VIEWPORT_MIN_SIZE
1179
+ ) {
1180
+ console.log('Viewport is too small', viewport.sWidth, viewport.sHeight);
1181
+ return;
1182
+ }
1169
1183
  if (viewportTypeUsesCustomRenderingPipeline(viewport.type) === true) {
1170
1184
  eventDetail =
1171
1185
  viewport.customRenderViewportToCanvas() as EventTypes.ImageRenderedEventDetail;