fixed non transparent box
This commit is contained in:
parent
3456655220
commit
bbab8e5e81
@ -744,20 +744,23 @@ export default function TrainingTab() {
|
||||
const isDraft = drawingBox && index === visibleBoxes.length - 1
|
||||
|
||||
return (
|
||||
<button
|
||||
<div
|
||||
key={`${box.label}-${index}-${isDraft ? 'draft' : 'box'}`}
|
||||
type="button"
|
||||
role={isDraft ? undefined : 'button'}
|
||||
tabIndex={isDraft ? undefined : 0}
|
||||
className={[
|
||||
'absolute rounded border-2 bg-transparent hover:bg-transparent active:bg-transparent focus:bg-transparent shadow-[0_0_0_1px_rgba(0,0,0,0.75)]',
|
||||
'absolute rounded border-2 shadow-[0_0_0_1px_rgba(0,0,0,0.75)]',
|
||||
isDraft
|
||||
? 'pointer-events-none border-amber-400'
|
||||
: 'border-emerald-400 hover:border-red-400',
|
||||
: 'cursor-pointer border-emerald-400 hover:border-red-400',
|
||||
].join(' ')}
|
||||
style={{
|
||||
left: `${left}%`,
|
||||
top: `${top}%`,
|
||||
width: `${width}%`,
|
||||
height: `${height}%`,
|
||||
backgroundColor: 'transparent',
|
||||
appearance: 'none',
|
||||
}}
|
||||
title={isDraft ? box.label : `${box.label} löschen`}
|
||||
onPointerDown={(e) => {
|
||||
@ -769,6 +772,14 @@ export default function TrainingTab() {
|
||||
e.stopPropagation()
|
||||
if (!isDraft) removeBox(index)
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (isDraft) return
|
||||
if (e.key !== 'Enter' && e.key !== ' ') return
|
||||
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
removeBox(index)
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className={[
|
||||
@ -778,7 +789,7 @@ export default function TrainingTab() {
|
||||
>
|
||||
{box.label} {typeof box.score === 'number' ? percent(box.score) : ''}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user