summaryrefslogtreecommitdiff
path: root/client/common/detectionBoxes.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-11-03 17:29:49 +0100
committerJules Laplace <julescarbon@gmail.com>2018-11-03 17:29:49 +0100
commitaa0470a3076f5ac65a0311c76e58254547f3eae0 (patch)
tree001173d70a0ae93d367773453cbdc9091bbc9fb7 /client/common/detectionBoxes.component.js
parent3e534be7b919bf402d3602fde5b45809201f06b1 (diff)
begin client
Diffstat (limited to 'client/common/detectionBoxes.component.js')
-rw-r--r--client/common/detectionBoxes.component.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/client/common/detectionBoxes.component.js b/client/common/detectionBoxes.component.js
new file mode 100644
index 00000000..c4872ea8
--- /dev/null
+++ b/client/common/detectionBoxes.component.js
@@ -0,0 +1,15 @@
+import React from 'react'
+
+import { px } from '../util'
+
+export default function DetectionBoxes({ detections, width, height }) {
+ return detections.map(({ rect }, i) => (
+ rect &&
+ <div className='rect' key={i} style={{
+ left: px(rect[0], width),
+ top: px(rect[1], height),
+ width: px(rect[2] - rect[0], width),
+ height: px(rect[3] - rect[1], height),
+ }} />
+ ))
+}