@eyepop.ai/eyepop-render-2d 3.7.0 → 3.7.2
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/dist/eyepop.render2d.index.d.mts +2 -2
- package/dist/eyepop.render2d.index.d.ts +2 -2
- package/dist/eyepop.render2d.index.js +16 -16
- package/dist/eyepop.render2d.index.js.map +1 -1
- package/dist/eyepop.render2d.index.mjs +16 -16
- package/dist/eyepop.render2d.index.mjs.map +1 -1
- package/dist/eyepop.render2d.min.js +1 -1
- package/package.json +2 -2
|
@@ -52,7 +52,7 @@ type RenderBoxOptions = {
|
|
|
52
52
|
showNestedClasses?: boolean;
|
|
53
53
|
showText?: boolean;
|
|
54
54
|
showConfidence?: boolean;
|
|
55
|
-
|
|
55
|
+
showTrackId?: boolean;
|
|
56
56
|
boxType?: BoxType;
|
|
57
57
|
} & RenderTarget;
|
|
58
58
|
declare class RenderBox implements Render {
|
|
@@ -62,7 +62,7 @@ declare class RenderBox implements Render {
|
|
|
62
62
|
private showClass;
|
|
63
63
|
private showNestedClasses;
|
|
64
64
|
private showConfidence;
|
|
65
|
-
private
|
|
65
|
+
private showTrackId;
|
|
66
66
|
private boxType?;
|
|
67
67
|
constructor(options?: Partial<RenderBoxOptions>);
|
|
68
68
|
start(context: CanvasRenderingContext2D, style: Style): void;
|
|
@@ -52,7 +52,7 @@ type RenderBoxOptions = {
|
|
|
52
52
|
showNestedClasses?: boolean;
|
|
53
53
|
showText?: boolean;
|
|
54
54
|
showConfidence?: boolean;
|
|
55
|
-
|
|
55
|
+
showTrackId?: boolean;
|
|
56
56
|
boxType?: BoxType;
|
|
57
57
|
} & RenderTarget;
|
|
58
58
|
declare class RenderBox implements Render {
|
|
@@ -62,7 +62,7 @@ declare class RenderBox implements Render {
|
|
|
62
62
|
private showClass;
|
|
63
63
|
private showNestedClasses;
|
|
64
64
|
private showConfidence;
|
|
65
|
-
private
|
|
65
|
+
private showTrackId;
|
|
66
66
|
private boxType?;
|
|
67
67
|
constructor(options?: Partial<RenderBoxOptions>);
|
|
68
68
|
start(context: CanvasRenderingContext2D, style: Style): void;
|
|
@@ -106,12 +106,12 @@ var BoxType = /* @__PURE__ */ ((BoxType2) => {
|
|
|
106
106
|
var RenderBox = class _RenderBox {
|
|
107
107
|
constructor(options = {}) {
|
|
108
108
|
this.target = DEFAULT_TARGET;
|
|
109
|
-
const { showClass = true, showConfidence = false,
|
|
109
|
+
const { showClass = true, showConfidence = false, showTrackId = false, showNestedClasses = false, target = "$..objects.*", boxType = "rich" /* Rich */ } = options;
|
|
110
110
|
this.target = target;
|
|
111
111
|
this.showClass = showClass;
|
|
112
112
|
this.showNestedClasses = showNestedClasses;
|
|
113
113
|
this.showConfidence = showConfidence;
|
|
114
|
-
this.
|
|
114
|
+
this.showTrackId = showTrackId;
|
|
115
115
|
this.boxType = boxType;
|
|
116
116
|
}
|
|
117
117
|
start(context, style) {
|
|
@@ -202,8 +202,8 @@ var RenderBox = class _RenderBox {
|
|
|
202
202
|
yOffset += this.drawLabel(label, context, element, yScale, xScale, yOffset, xOffset, style, boundingBoxWidth, padding, false, fontSize);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
if (this.
|
|
206
|
-
label = "ID: " + element.
|
|
205
|
+
if (this.showTrackId && element.trackId) {
|
|
206
|
+
label = "ID: " + element.trackId;
|
|
207
207
|
label = _RenderBox.toTitleCase(label);
|
|
208
208
|
yOffset += this.drawLabel(label, context, element, yScale, xScale, yOffset, xOffset, style, boundingBoxWidth, padding, false, fontSize);
|
|
209
209
|
}
|
|
@@ -259,8 +259,8 @@ var RenderBox = class _RenderBox {
|
|
|
259
259
|
yOffset += this.drawLabel(label, context, element, yScale, xScale, yOffset, xOffset, style, boundingBoxWidth, padding, false, fontSize);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
if (this.
|
|
263
|
-
label = "ID: " + element.
|
|
262
|
+
if (this.showTrackId && element.trackId) {
|
|
263
|
+
label = "ID: " + element.trackId;
|
|
264
264
|
label = _RenderBox.toTitleCase(label);
|
|
265
265
|
yOffset += this.drawLabel(label, context, element, yScale, xScale, yOffset, xOffset, style, boundingBoxWidth, padding, false, fontSize);
|
|
266
266
|
}
|
|
@@ -338,8 +338,8 @@ var RenderBox = class _RenderBox {
|
|
|
338
338
|
yOffset += this.drawLabel(label, context, element, yScale, xScale, yOffset, xOffset, style, boundingBoxWidth, padding, false, fontSize);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
if (this.
|
|
342
|
-
label = "ID: " + element.
|
|
341
|
+
if (this.showTrackId && element.trackId) {
|
|
342
|
+
label = "ID: " + element.trackId;
|
|
343
343
|
label = _RenderBox.toTitleCase(label);
|
|
344
344
|
yOffset += this.drawLabel(label, context, element, yScale, xScale, yOffset, xOffset, style, boundingBoxWidth, padding, false, fontSize);
|
|
345
345
|
}
|
|
@@ -459,8 +459,8 @@ var RenderBox = class _RenderBox {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
if (this.
|
|
463
|
-
const label = `ID: ${element.
|
|
462
|
+
if (this.showTrackId && element.trackId) {
|
|
463
|
+
const label = `ID: ${element.trackId}`;
|
|
464
464
|
const formattedLabel = `${_RenderBox.toTitleCase(label)}`;
|
|
465
465
|
if (formattedLabel.length > largestLabel.length) {
|
|
466
466
|
largestLabel = formattedLabel;
|
|
@@ -3665,7 +3665,7 @@ var TRIM_INTERVAL = 1e3 * 1e3 * 1e3 * 10;
|
|
|
3665
3665
|
var RenderTrail = class {
|
|
3666
3666
|
constructor(options = {}) {
|
|
3667
3667
|
this.target = DEFAULT_TARGET;
|
|
3668
|
-
const { target = "$..objects[?(@.
|
|
3668
|
+
const { target = "$..objects[?(@.trackId)]", trailLengthSeconds = 1, traceDetails } = options;
|
|
3669
3669
|
this.target = target;
|
|
3670
3670
|
this.trailLengthNanos = trailLengthSeconds * 1e3 * 1e3 * 1e3;
|
|
3671
3671
|
this.traceDetails = traceDetails;
|
|
@@ -3677,7 +3677,7 @@ var RenderTrail = class {
|
|
|
3677
3677
|
this.style = style;
|
|
3678
3678
|
}
|
|
3679
3679
|
draw(element, xOffset, yOffset, xScale, yScale, streamTime) {
|
|
3680
|
-
if (!element.
|
|
3680
|
+
if (!element.trackId || streamTime.timestamp === void 0) {
|
|
3681
3681
|
return;
|
|
3682
3682
|
}
|
|
3683
3683
|
const context = this.context;
|
|
@@ -3715,9 +3715,9 @@ var RenderTrail = class {
|
|
|
3715
3715
|
const head = {
|
|
3716
3716
|
points,
|
|
3717
3717
|
timestamp: streamTime.timestamp,
|
|
3718
|
-
next: this.traces.get(element.
|
|
3718
|
+
next: this.traces.get(element.trackId) ?? null
|
|
3719
3719
|
};
|
|
3720
|
-
this.traces.set(element.
|
|
3720
|
+
this.traces.set(element.trackId, head);
|
|
3721
3721
|
const radius = element.width * xScale / 40;
|
|
3722
3722
|
let n = 0;
|
|
3723
3723
|
for (let entry = head; entry != null; entry = entry.next) {
|
|
@@ -3731,10 +3731,10 @@ var RenderTrail = class {
|
|
|
3731
3731
|
}
|
|
3732
3732
|
}
|
|
3733
3733
|
if (streamTime.timestamp - this.lastTrim > TRIM_INTERVAL) {
|
|
3734
|
-
this.traces.forEach((traceEntry,
|
|
3734
|
+
this.traces.forEach((traceEntry, trackId) => {
|
|
3735
3735
|
const age = streamTime.timestamp - traceEntry.timestamp;
|
|
3736
3736
|
if (age > this.trailLengthNanos) {
|
|
3737
|
-
this.traces.delete(
|
|
3737
|
+
this.traces.delete(trackId);
|
|
3738
3738
|
}
|
|
3739
3739
|
});
|
|
3740
3740
|
}
|