Skip to content

Commit

Permalink
Closes #120
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainer Simon committed Feb 19, 2022
1 parent 94295c4 commit d2ad213
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/OSDAnnotationLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ export class AnnotationLayer extends EventEmitter {
}

_initMouseEvents = () => {
// User-configured OSD zoom gesture setting
let zoomGesture = this.viewer.gestureSettingsByDeviceType('mouse').clickToZoom;

// We use mouse-move to track which annotation is currently hovered on.
// Keep in mind that annotations are NOT automatically stacked from large
// to small. Therefore, smaller ones might be obscured underneath larger
Expand All @@ -244,17 +241,13 @@ export class AnnotationLayer extends EventEmitter {
// Hovered annotation changed
if (shape?.annotation !== this.hoveredShape?.annotation) {
if (this.hoveredShape) {
this.viewer.gestureSettingsByDeviceType('mouse').clickToZoom = zoomGesture;

const element = this.hoveredShape.element || this.hoveredShape;
removeClass(element, 'hover');

this.emit('mouseLeaveAnnotation', this.hoveredShape.annotation, this.hoveredShape);
}

if (shape) {
zoomGesture = this.viewer.gestureSettingsByDeviceType('mouse').clickToZoom;
this.viewer.gestureSettingsByDeviceType('mouse').clickToZoom = false;
addClass(shape, 'hover');
this.emit('mouseEnterAnnotation', shape.annotation, shape);
}
Expand Down Expand Up @@ -288,6 +281,7 @@ export class AnnotationLayer extends EventEmitter {

// Ignore clicks on selection
if (hoveredShape) {
evt.preventDefaultAction = true; // No zoom on click
this.selectShape(hoveredShape);
} else if (!hoveredShape) {
this.deselect();
Expand Down

0 comments on commit d2ad213

Please sign in to comment.