Skip to content

Commit 6f3fe24

Browse files
Fix multiline label selection box
1 parent ef1904e commit 6f3fe24

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export default function LabelingSuiteLabeling() {
113113
if (!tokenLookup || !extractionRef.current) return;
114114
const handleMouseUp = (e) => {
115115
const [check, attributeIdStart, tokenStart, tokenEnd, startEl] = parseSelectionData();
116+
console.log(startEl)
116117
dispatch(setActiveTokenSelection({ attributeId: attributeIdStart, tokenStart, tokenEnd }));
117118
if (!check) {
118119
clearSelected();
@@ -492,8 +493,8 @@ export default function LabelingSuiteLabeling() {
492493
labelBoxPosition(e, startEl);
493494
}
494495

495-
function labelBoxPosition(e, startEl?: DOMRect) {
496-
const labelBox: DOMRect = startEl || e.target.getBoundingClientRect();
496+
function labelBoxPosition(e: any, startEl?: any) {
497+
const labelBox: DOMRect = startEl ? startEl.getBoundingClientRect() : (e.target as HTMLElement).getBoundingClientRect();
497498
if (!labelBox) return;
498499
const baseBox: DOMRect = document.getElementById('base-dom-element')?.getBoundingClientRect();
499500
if (!baseBox) return;

0 commit comments

Comments
 (0)