Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainer Simon committed Aug 8, 2021
1 parent 009506b commit 2e01aa2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/OSDAnnotationLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,13 @@ export default class OSDAnnotationLayer extends EventEmitter {

this.selectedShape.element.annotation = annotation;

setTimeout(() =>
this._attachMouseListeners(this.selectedShape.element, annotation), 10);
// If we attach immediately 'mouseEnter' will fire when the editable shape
// is added to the DOM!
setTimeout(() => {
// Can be undefined in headless mode, when saving immediately
if (this.selectedShape)
this._attachMouseListeners(this.selectedShape.element, annotation);
}, 10);

// Disable normal OSD nav
const editableShapeMouseTracker = new OpenSeadragon.MouseTracker({
Expand Down

0 comments on commit 2e01aa2

Please sign in to comment.