Skip to content

Commit 9657367

Browse files
galelisswederik
authored andcommitted
feat(callbacks): Add onMouseClick, onNewImage, and onTouchStart props
* fix(labelling): Closing labelling and contextMenu on viewport interaction * fix(optionalOverlays): Renaming reducer for reset overlays * fix(optionalOverlay) Removing old implementation and adding callbacks for the needed events * fix(optionalOverlays): Preventing to trigger both onMouseClick and onRightClick at same time. onMouseClick for 1 and 2 buttons onRightClick for 3 button * fix(optionalOverlays): Remove propType not used
1 parent ce19960 commit 9657367

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/CornerstoneViewport/CornerstoneViewport.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ class CornerstoneViewport extends Component {
8686
children: PropTypes.node,
8787
onDoubleClick: PropTypes.func,
8888
onRightClick: PropTypes.func,
89+
onMouseClick: PropTypes.func,
8990
onTouchPress: PropTypes.func,
91+
onNewImage: PropTypes.func,
92+
onTouchStart: PropTypes.func,
9093
setViewportActive: PropTypes.func,
9194
setViewportSpecificData: PropTypes.func,
9295
clearViewportSpecificData: PropTypes.func,
@@ -220,6 +223,10 @@ class CornerstoneViewport extends Component {
220223
this.setState({
221224
imageId: event.detail.image.imageId
222225
});
226+
227+
if (this.props.onNewImage) {
228+
this.props.onNewImage(event);
229+
}
223230
};
224231

225232
componentDidMount() {
@@ -766,6 +773,10 @@ class CornerstoneViewport extends Component {
766773
if (this.props.onRightClick) {
767774
this.props.onRightClick(event);
768775
}
776+
} else {
777+
if (this.props.onMouseClick) {
778+
this.props.onMouseClick(event);
779+
}
769780
}
770781
};
771782

@@ -779,6 +790,10 @@ class CornerstoneViewport extends Component {
779790

780791
onTouchStart = () => {
781792
this.setViewportActive();
793+
794+
if (this.props.onTouchStart) {
795+
this.props.onTouchStart(event);
796+
}
782797
};
783798

784799
imageSliderOnInputCallback = value => {

0 commit comments

Comments
 (0)