summaryrefslogtreecommitdiff
path: root/scraper/client/common/detectionBoxes.component.js
blob: c4872ea8d72ece733665425f94880f432f50ad00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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),
      }} />
  ))
}