Browse Source

fix: do not set mouseout event delay when user is not dragging label (#135)

main
Bobbie Goede 4 years ago committed by GitHub
parent
commit
0aa8820a90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      src/marker.ts

31
src/marker.ts

@ -159,26 +159,33 @@ export class MarkerWithLabel extends MarkerSafe {
if (this.mouseOutTimeout) { if (this.mouseOutTimeout) {
clearTimeout(this.mouseOutTimeout); clearTimeout(this.mouseOutTimeout);
} }
this.mouseOutTimeout = setTimeout(() => {
if (this.isMouseDownOnLabel) {
this.isMouseDownOnLabel = false;
google.maps.event.trigger(this, MOUSEUP, {
latLng: this.getPosition(),
});
if (this.isDraggingLabel) { if (this.isMouseDownOnLabel) {
this.isDraggingLabel = false; this.mouseOutTimeout = setTimeout(() => {
this.shouldIgnoreClick = true; if (this.isMouseDownOnLabel) {
google.maps.event.trigger(this, DRAGEND, { this.isMouseDownOnLabel = false;
google.maps.event.trigger(this, MOUSEUP, {
latLng: this.getPosition(), latLng: this.getPosition(),
}); });
if (this.isDraggingLabel) {
this.isDraggingLabel = false;
this.shouldIgnoreClick = true;
google.maps.event.trigger(this, DRAGEND, {
latLng: this.getPosition(),
});
}
} }
}
google.maps.event.trigger(this, MOUSEOUT, {
latLng: this.getPosition(),
});
}, 200);
} else {
google.maps.event.trigger(this, MOUSEOUT, { google.maps.event.trigger(this, MOUSEOUT, {
latLng: this.getPosition(), latLng: this.getPosition(),
}); });
}, 200); }
abortEvent(e); abortEvent(e);
} }

Loading…
Cancel
Save