Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Ensure that image.handleMouseDown() is unbound in annotation mode #319

Merged
merged 3 commits into from Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lib/annotations/Annotator.js
Expand Up @@ -375,7 +375,10 @@ class Annotator extends EventEmitter {
* @return {void}
*/
disableAnnotationMode(mode, buttonEl) {
this.emit(MODE_EXIT);
if (this.isInAnnotationMode(mode)) {
this.emit(MODE_EXIT);
}

this.annotatedElement.classList.remove(CLASS_ANNOTATION_MODE);
if (buttonEl) {
buttonEl.classList.remove(CLASS_ACTIVE);
Expand Down Expand Up @@ -732,6 +735,7 @@ class Annotator extends EventEmitter {
pointClickHandler(event) {
event.stopPropagation();
event.preventDefault();
this.emit(MODE_EXIT);

// Determine if a point annotation dialog is already open and close the
// current open dialog
Expand Down
5 changes: 4 additions & 1 deletion src/lib/viewers/BaseViewer.js
Expand Up @@ -727,7 +727,10 @@ class BaseViewer extends EventEmitter {
}
break;
case ANNOTATION_MODE_EXIT:
this.enableViewerControls();
if (!this.annotator.isInAnnotationMode(ANNOTATION_TYPE_POINT)) {
this.enableViewerControls();
}

this.emit('notificationhide');
break;
case 'annotationerror':
Expand Down
4 changes: 2 additions & 2 deletions src/lib/viewers/image/ImageBaseViewer.js
Expand Up @@ -335,8 +335,7 @@ class ImageBaseViewer extends BaseViewer {
*/
disableViewerControls() {
super.disableViewerControls();
this.imageEl.classList.remove(CSS_CLASS_ZOOMABLE);
this.imageEl.classList.remove(CSS_CLASS_PANNABLE);
this.unbindDOMListeners();
}

/**
Expand All @@ -347,6 +346,7 @@ class ImageBaseViewer extends BaseViewer {
*/
enableViewerControls() {
super.enableViewerControls();
this.bindDOMListeners();

if (!this.isMobile) {
this.updateCursor();
Expand Down