box-annotations 4.0.1-beta.1 → 4.1.1-beta.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": "box-annotations",
3
- "version": "4.0.1-beta.1",
3
+ "version": "4.1.1-beta.1",
4
4
  "description": "Box Annotations",
5
5
  "author": "Box (https://www.box.com/)",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -67,6 +67,12 @@ export default class HighlightCanvas extends React.PureComponent<Props> {
67
67
 
68
68
  shapesArray.forEach(rect => {
69
69
  const { height, isActive, isHover, width, x, y } = rect;
70
+
71
+ // Ignore empty rects with a width or height of 0
72
+ if (width === 0 || height === 0) {
73
+ return;
74
+ }
75
+
70
76
  const rectHeight = (height / 100) * canvasHeight;
71
77
  const rectWidth = (width / 100) * canvasWidth;
72
78
  const x1 = (x / 100) * canvasWidth;
@@ -10,6 +10,11 @@ export const getBoundingRect = (shapes: Shape[]): Shape => {
10
10
  const x2 = x + width;
11
11
  const y2 = y + height;
12
12
 
13
+ // Ignore empty rects with a width or height of 0
14
+ if (width === 0 || height === 0) {
15
+ return;
16
+ }
17
+
13
18
  if (x < minX) {
14
19
  minX = x;
15
20
  }
@@ -98,6 +103,12 @@ export const combineRects = (rects: Shape[]): Shape[] => {
98
103
 
99
104
  dedupeRects(rects).forEach(rect => {
100
105
  const { height, width, x, y } = rect;
106
+
107
+ // Ignore empty rects with a width or height of 0
108
+ if (width === 0 || height === 0) {
109
+ return;
110
+ }
111
+
101
112
  const lastRect = result.pop();
102
113
 
103
114
  if (!lastRect) {