[Angular] Amend InfoGesture for compatibility
Update the info gesture so that it does not schedule multiple bubbles to be shown when multiple events fire, for AngularJS 1.4.4 compatibility.
This commit is contained in:
@@ -57,7 +57,8 @@ define(
|
||||
|
||||
// Also make sure we dismiss bubble if representation is destroyed
|
||||
// before the mouse actually leaves it
|
||||
this.scopeOff = element.scope().$on('$destroy', this.hideBubbleCallback);
|
||||
this.scopeOff =
|
||||
element.scope().$on('$destroy', this.hideBubbleCallback);
|
||||
|
||||
this.element = element;
|
||||
this.$timeout = $timeout;
|
||||
@@ -97,14 +98,7 @@ define(
|
||||
InfoGesture.prototype.showBubble = function (event) {
|
||||
var self = this;
|
||||
|
||||
this.trackPosition(event);
|
||||
|
||||
// Also need to track position during hover
|
||||
this.element.on('mousemove', this.trackPositionCallback);
|
||||
|
||||
// Show the bubble, after a suitable delay (if mouse has
|
||||
// left before this time is up, this will be canceled.)
|
||||
this.pendingBubble = this.$timeout(function () {
|
||||
function displayBubble() {
|
||||
self.dismissBubble = self.infoService.display(
|
||||
"info-table",
|
||||
self.domainObject.getModel().name,
|
||||
@@ -113,7 +107,22 @@ define(
|
||||
);
|
||||
self.element.off('mousemove', self.trackPositionCallback);
|
||||
self.pendingBubble = undefined;
|
||||
}, this.delay);
|
||||
}
|
||||
|
||||
this.trackPosition(event);
|
||||
|
||||
// If we're already going to sho
|
||||
if (this.pendingBubble) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Also need to track position during hover
|
||||
this.element.on('mousemove', this.trackPositionCallback);
|
||||
|
||||
// Show the bubble, after a suitable delay (if mouse has
|
||||
// left before this time is up, this will be canceled.)
|
||||
this.pendingBubble = this.pendingBubble ||
|
||||
this.$timeout(displayBubble, this.delay);
|
||||
|
||||
this.element.on('mouseleave', this.hideBubbleCallback);
|
||||
};
|
||||
|
||||
@@ -92,7 +92,9 @@ define(
|
||||
body.append(bubble);
|
||||
|
||||
// Return a function to dismiss the bubble
|
||||
return function () { bubble.remove(); };
|
||||
return function () {
|
||||
bubble.remove();
|
||||
};
|
||||
};
|
||||
|
||||
return InfoService;
|
||||
|
||||
Reference in New Issue
Block a user