@@ -148,7 +148,9 @@ const DebugUi = () => {
148
148
const handleMouseDown = ( event ) => {
149
149
if ( newAnnotation . length === 0 ) {
150
150
const { x, y } = event . target . getStage ( ) . getPointerPosition ( ) ;
151
- setNewAnnotation ( [ { x, y, width : 0 , height : 0 , key : "0" } ] ) ;
151
+ setNewAnnotation ( [
152
+ { x, y, width : 0 , height : 0 , key : "0" , page : pageNumber }
153
+ ] ) ;
152
154
}
153
155
} ;
154
156
@@ -158,7 +160,11 @@ const DebugUi = () => {
158
160
const sy = newAnnotation [ 0 ] . y ;
159
161
const { x, y } = event . target . getStage ( ) . getPointerPosition ( ) ;
160
162
const result = processDimensions ( sx , sy , x - sx , y - sy ) ;
161
- const annotationToAdd = { ...result , key : annotations . length + 1 } ;
163
+ const annotationToAdd = {
164
+ ...result ,
165
+ key : annotations . length + 1 ,
166
+ page : pageNumber
167
+ } ;
162
168
annotations . push ( annotationToAdd ) ;
163
169
setNewAnnotation ( [ ] ) ;
164
170
setAnnotations ( annotations ) ;
@@ -181,6 +187,7 @@ const DebugUi = () => {
181
187
y : sy ,
182
188
width : x - sx ,
183
189
height : y - sy ,
190
+ page : pageNumber ,
184
191
key : "0"
185
192
}
186
193
] ) ;
@@ -349,38 +356,40 @@ const DebugUi = () => {
349
356
< code
350
357
style = { { fontSize : 12 , color : "black" , cursor : "pointer" } }
351
358
>
352
- { ` ["x": ${ coord . x } , "y": ${ coord . y } , "w": ${ coord . width } , "h": ${ coord . height } ]` }
359
+ { ` ["page": ${ coord ?. page } , " x": ${ coord . x } , "y": ${ coord . y } , "w": ${ coord . width } , "h": ${ coord . height } ]` }
353
360
</ code >
354
- < span
355
- style = { {
356
- borderRadius : 4 ,
357
- padding : "3px 5px" ,
358
- border : "1px solid gray" ,
359
- fontSize : 12 ,
360
- margin : 2 ,
361
- cursor : "pointer"
362
- } }
363
- onClick = { ( ) =>
364
- copytoclipboard (
365
- `["x": ${ coord . x } , "y": ${ coord . y } , "w": ${ coord . width } , "h": ${ coord . height } ]`
366
- )
367
- }
368
- >
369
- < i className = "fa-solid fa-copy" > </ i >
370
- </ span >
371
- < span
372
- style = { {
373
- borderRadius : 4 ,
374
- padding : "3px 5px" ,
375
- border : "1px solid gray" ,
376
- fontSize : 12 ,
377
- margin : 2 ,
378
- cursor : "pointer"
379
- } }
380
- onClick = { ( ) => handleDelete ( coord . key ) }
381
- >
382
- < i className = "fa-solid fa-trash-can" > </ i >
383
- </ span >
361
+ < div >
362
+ < span
363
+ style = { {
364
+ borderRadius : 4 ,
365
+ padding : "3px 5px" ,
366
+ border : "1px solid gray" ,
367
+ fontSize : 12 ,
368
+ margin : 2 ,
369
+ cursor : "pointer"
370
+ } }
371
+ onClick = { ( ) =>
372
+ copytoclipboard (
373
+ `"page":${ coord ?. page } , "x": ${ coord . x } , "y": ${ coord . y } , "w": ${ coord . width } , "h": ${ coord . height } `
374
+ )
375
+ }
376
+ >
377
+ < i className = "fa-solid fa-copy" > </ i >
378
+ </ span >
379
+ < span
380
+ style = { {
381
+ borderRadius : 4 ,
382
+ padding : "3px 5px" ,
383
+ border : "1px solid gray" ,
384
+ fontSize : 12 ,
385
+ margin : 2 ,
386
+ cursor : "pointer"
387
+ } }
388
+ onClick = { ( ) => handleDelete ( coord . key ) }
389
+ >
390
+ < i className = "fa-solid fa-trash-can" > </ i >
391
+ </ span >
392
+ </ div >
384
393
</ li >
385
394
) ) }
386
395
</ ul >
0 commit comments