@@ -118,7 +118,7 @@ export default function LabelingSuiteLabeling() {
118118 clearSelected ( ) ;
119119 } else {
120120 window . getSelection ( ) . empty ( ) ;
121- setSelected ( attributeIdStart , tokenStart , tokenEnd , startEl ) ;
121+ setSelected ( attributeIdStart , tokenStart , tokenEnd , e , startEl ) ;
122122 }
123123 } ;
124124 extractionRef . current . addEventListener ( 'mouseup' , handleMouseUp ) ;
@@ -474,7 +474,7 @@ export default function LabelingSuiteLabeling() {
474474 dispatch ( setActiveTokenSelection ( null ) ) ;
475475 } , [ tokenLookup ] ) ;
476476
477- function setSelected ( attributeId : string , tokenStart : number , tokenEnd : number , e ?: any ) {
477+ function setSelected ( attributeId : string , tokenStart : number , tokenEnd : number , e ?: any , startEl ?: DOMRect ) {
478478 if ( ! canEditLabels && user . role != UserRole . ANNOTATOR && userDisplayRole != UserRole . ANNOTATOR ) return ;
479479 const tokenLookupCopy = jsonCopy ( tokenLookup ) ;
480480 if ( ! tokenLookupCopy [ attributeId ] ) {
@@ -489,11 +489,11 @@ export default function LabelingSuiteLabeling() {
489489 setActiveTasksFuncRef . current ( lVars . taskLookup [ attributeId ] . lookup ) ;
490490 }
491491 setTokenLookup ( tokenLookupCopy ) ;
492- labelBoxPosition ( e ) ;
492+ labelBoxPosition ( e , startEl ) ;
493493 }
494494
495- function labelBoxPosition ( e ) {
496- const labelBox : DOMRect = e . target ? .getBoundingClientRect ( ) ;
495+ function labelBoxPosition ( e , startEl ?: DOMRect ) {
496+ const labelBox : DOMRect = startEl || e . target . getBoundingClientRect ( ) ;
497497 if ( ! labelBox ) return ;
498498 const baseBox : DOMRect = document . getElementById ( 'base-dom-element' ) ?. getBoundingClientRect ( ) ;
499499 if ( ! baseBox ) return ;
0 commit comments