Skip to content

Commit

Permalink
Add double click event
Browse files Browse the repository at this point in the history
  • Loading branch information
igoroctaviano committed May 1, 2024
1 parent ca8fd50 commit 79d133a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/components/SlideViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,19 @@ class SlideViewer extends React.Component<SlideViewerProps, SlideViewerState> {
}
}

onRoiDoubleClicked = (event: CustomEventInit): void => {
const selectedRoi = event.detail.payload as dmv.roi.ROI
if (selectedRoi != null) {
this.setState({
isSelectedRoiModalVisible: true
})
} else {
this.setState({
isSelectedRoiModalVisible: false
})
}
}

onRoiSelected = (event: CustomEventInit): void => {
const selectedRoi = event.detail.payload as dmv.roi.ROI
if (selectedRoi != null) {
Expand All @@ -1431,13 +1444,11 @@ class SlideViewer extends React.Component<SlideViewerProps, SlideViewerState> {
this.setState({
selectedRoiUIDs: new Set([selectedRoi.uid]),
selectedRoi: selectedRoi,
isSelectedRoiModalVisible: true
})
} else {
this.setState({
selectedRoiUIDs: new Set(),
selectedRoi: undefined,
isSelectedRoiModalVisible: false
selectedRoi: undefined
})
}
}
Expand Down Expand Up @@ -1565,6 +1576,10 @@ class SlideViewer extends React.Component<SlideViewerProps, SlideViewerState> {
'dicommicroscopyviewer_roi_selected',
this.onRoiSelected
)
document.body.removeEventListener(
'dicommicroscopyviewer_roi_double_clicked',
this.onRoiDoubleClicked
)
document.body.removeEventListener(
'dicommicroscopyviewer_roi_removed',
this.onRoiRemoved
Expand Down Expand Up @@ -1664,6 +1679,10 @@ class SlideViewer extends React.Component<SlideViewerProps, SlideViewerState> {
'dicommicroscopyviewer_roi_selected',
this.onRoiSelected
)
document.body.addEventListener(
'dicommicroscopyviewer_roi_double_clicked',
this.onRoiDoubleClicked
)
document.body.addEventListener(
'dicommicroscopyviewer_roi_removed',
this.onRoiRemoved
Expand Down

0 comments on commit 79d133a

Please sign in to comment.