Skip to content

Commit

Permalink
Merge branch 'new-photo-selected'
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiminc committed Jun 19, 2024
2 parents 4e82f3f + e7d057b commit aa3728a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
8 changes: 0 additions & 8 deletions frontend/src/components/DrawingExistingMarkers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ function DrawExistingMarkers (props){ //imageSize and markerList
let currentConfidence

let currentOffsetArray = props.markerList.map((item) =>{
currentOffsetX = Math.round((item.x/props.imageSize.originalWidth)*props.imageSize.viewWidth)
console.log('marker x' + currentOffsetX)

currentOffsetX = Math.round((item.x/props.imageSize.originalWidth)*props.imageSize.viewWidth)+props.imagePosition.left
console.log('updated marker x' + currentOffsetX)
currentOffsetY = Math.round((item.y/props.imageSize.originalHeight)*props.imageSize.viewHeight)
console.log('marker y' + currentOffsetY)
currentOffsetY = Math.round((item.y/props.imageSize.originalHeight)*props.imageSize.viewHeight)+props.imagePosition.top
console.log('updated marker y' + currentOffsetY)

currentConfidence = item.confidence
return {currentOffsetX, currentOffsetY, currentConfidence}
})
Expand Down
31 changes: 21 additions & 10 deletions frontend/src/components/Image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,26 @@ function Image (props) {
//State for array containing objects each of which recording one marker/tag. WARNING the LAST tag may not be recorded due to the useState
const [markerList, setMarkerList] = useState([])


//State for x, y onscreen, no longer in use anymore
const [coordinateOnImage, setCoordinateOnImage] = useState({
x: 0,
y: 0
});
useEffect (() => { //reset every initial state when image changes
setMarkerList([])
setImageSize({
originalWidth : 0,
originalHeight : 0,
viewWidth : 683,
viewHeight : 512
})
setCoordinate({
x: -99,
y: -99,
confidence: 'Initialization'
})
setShowRetrodetect(0)
setImageNewPosition({
left: 0,
top: 0,
})

}, [props])

//State for recording the original width/height of the image and view width/height. THIS might not need to be STATE
const [imageSize, setImageSize] = useState({
Expand Down Expand Up @@ -117,10 +131,7 @@ function Image (props) {
console.log('client X & client Y', e.clientX, e.clientY)
console.log('original pixel x & y', originalPixelX, originalPixelY)

setCoordinateOnImage({
x: currentOffsetX,
y: currentOffsetY,
})


setImageSize({
originalWidth : originalWidth,
Expand Down

0 comments on commit aa3728a

Please sign in to comment.