Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai-box
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
青山
ai-box
Commits
a329b0f9
Commit
a329b0f9
authored
Mar 31, 2025
by
fisherdaddy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix bugs in image annotation tool
parent
81afffcb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
.DS_Store
public/.DS_Store
+0
-0
ImageAnnotator.jsx
src/components/ImageAnnotator.jsx
+17
-4
No files found.
public/.DS_Store
View file @
a329b0f9
No preview for this file type
src/components/ImageAnnotator.jsx
View file @
a329b0f9
...
...
@@ -522,6 +522,19 @@ function ImageAnnotator() {
// Determine label position based on box position
const
isNearTop
=
box
.
y1
<
30
;
// Calculate the scaling ratio between original image and displayed image
const
displayedWidth
=
imageRef
.
current
?
imageRef
.
current
.
width
:
0
;
const
displayedHeight
=
imageRef
.
current
?
imageRef
.
current
.
height
:
0
;
const
scaleX
=
imageSize
.
width
>
0
?
displayedWidth
/
imageSize
.
width
:
1
;
const
scaleY
=
imageSize
.
height
>
0
?
displayedHeight
/
imageSize
.
height
:
1
;
// Scale the coordinates
const
scaledX1
=
box
.
x1
*
scaleX
;
const
scaledY1
=
box
.
y1
*
scaleY
;
const
scaledX2
=
box
.
x2
*
scaleX
;
const
scaledY2
=
box
.
y2
*
scaleY
;
return
(
<
BoundingBox
key=
{
box
.
id
}
...
...
@@ -530,10 +543,10 @@ function ImageAnnotator() {
isOtherSelected=
{
selectedBoxId
!==
null
&&
selectedBoxId
!==
box
.
id
}
onClick=
{
()
=>
handleBoxClick
(
box
.
id
)
}
style=
{
{
left
:
`${
box.x
1}px`
,
top
:
`${
box.y
1}px`
,
width
:
`${
box.x2 - box.x
1}px`
,
height
:
`${
box.y2 - box.y
1}px`
left
:
`${
scaledX
1}px`
,
top
:
`${
scaledY
1}px`
,
width
:
`${
scaledX2 - scaledX
1}px`
,
height
:
`${
scaledY2 - scaledY
1}px`
}
}
>
<
BoxLabel
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment