Skip to content

Commit 1727a25

Browse files
committed
No need to create own scope;
1 parent 7c52e1a commit 1727a25

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/CornerstoneViewport/CornerstoneViewport.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,24 +321,23 @@ class CornerstoneViewport extends Component {
321321
}
322322
];
323323

324-
// Enable the DOM Element for use with Cornerstone
325-
const onElementEnabled = function(evt) {
324+
// Pass ELEMENT_ENABLED event to parent
325+
const onElementEnabledFn = evt => {
326326
const enabledElement = evt.detail.element;
327-
console.warn('no match');
328327
if (enabledElement === this.element) {
329-
console.warn('match');
330328
if (this.props.onElementEnabled) {
331329
this.props.onElementEnabled(evt);
332330
}
333331
cornerstone.events.removeEventListener(
334332
cornerstone.EVENTS.ELEMENT_ENABLED,
335-
onElementEnabled
333+
onElementEnabledFn
336334
);
337335
}
338336
};
337+
339338
cornerstone.events.addEventListener(
340339
cornerstone.EVENTS.ELEMENT_ENABLED,
341-
onElementEnabled
340+
onElementEnabledFn
342341
);
343342
cornerstone.enable(element, this.props.cornerstoneOptions);
344343

0 commit comments

Comments
 (0)