Skip to content

Commit

Permalink
Bounding box labels
Browse files Browse the repository at this point in the history
  • Loading branch information
damianmoore committed Apr 17, 2019
1 parent b41d4cd commit dd35971
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion ui/src/components/BoundingBoxes.js
Expand Up @@ -20,7 +20,11 @@ const BoundingBoxes = ({ photoWidth, photoHeight, boxes }) => {
let height = (box.sizeY * displayHeight) + 'px'
let left = offsetLeft + (box.positionX * displayWidth) - (box.sizeX * displayWidth / 2) + 'px'
let top = offsetTop + (box.positionY * displayHeight) - (box.sizeY * displayHeight / 2) + 'px'
return <div className="FeatureBox" key={index} style={{left: left, top: top, width: width, height: height}} />
return (
<div className="FeatureBox" key={index} style={{left: left, top: top, width: width, height: height}}>
<div className="FeatureLabel" key={index}>{box.name}</div>
</div>
)
})
}
</div>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/PhotoDetail.js
Expand Up @@ -9,6 +9,7 @@ const history = createHistory()
const PhotoDetail = ({ photoId, photo }) => {
let boxes = photo.objectTags.map((objectTag) => {
return {
name: objectTag.tag.name,
positionX: objectTag.positionX,
positionY: objectTag.positionY,
sizeX: objectTag.sizeX,
Expand All @@ -24,7 +25,7 @@ const PhotoDetail = ({ photoId, photo }) => {
<div className="box">
<h2>Camera</h2>
<ul>
<li>{photo.camera.make} {photo.camera.model}</li>
{photo.camera ? <li>{photo.camera.make} {photo.camera.model}</li> : ''}
<li>Aperture: {photo.aperture}</li>
<li>Exposure: {photo.exposure}</li>
<li>ISO speed: {photo.isoSpeed}</li>
Expand Down
14 changes: 11 additions & 3 deletions ui/src/static/css/BoundingBoxes.css
Expand Up @@ -3,7 +3,15 @@
height: 100%;
}
.BoundingBoxes .FeatureBox {
border: 3px solid #f00;
border: 3px solid rgba(255,0,0,0.75);
position: absolute;
opacity: 0.75;
}
}
.BoundingBoxes .FeatureBox .FeatureLabel {
color: #FFF;
font-size: 14px;
background-color: rgba(255,0,0,0.75);
display: inline-block;
overflow: hidden;
max-width: 100%;
padding: 0 5px 2px 2px;
}

0 comments on commit dd35971

Please sign in to comment.