mirror of
https://github.com/nasa/openmct.git
synced 2025-01-19 11:17:04 +00:00
[Representation] Handle undefined scope
element.scope() may be undefined when wiring in the info gesture, so check for that. That this is sometimes undefined appears to be a consequence of changes to mct-representation, but which changes influence this are unclear. In any event, it appears that this cannot be relied-upon per https://github.com/angular/angular.js/issues/9515
This commit is contained in:
parent
0404303042
commit
ea9f607bba
@ -55,11 +55,6 @@ define(
|
||||
self.trackPosition(event);
|
||||
};
|
||||
|
||||
// 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.element = element;
|
||||
this.$timeout = $timeout;
|
||||
this.infoService = infoService;
|
||||
@ -131,6 +126,13 @@ define(
|
||||
this.pendingBubble = this.$timeout(displayBubble, this.delay);
|
||||
|
||||
this.element.on('mouseleave', this.hideBubbleCallback);
|
||||
|
||||
// Also make sure we dismiss bubble if representation is destroyed
|
||||
// before the mouse actually leaves it
|
||||
this.scopeOff =
|
||||
this.element.scope() &&
|
||||
this.element.scope().$on('$destroy', this.hideBubbleCallback);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -143,7 +145,9 @@ define(
|
||||
this.hideBubble();
|
||||
// ...and detach listeners
|
||||
this.element.off('mouseenter', this.showBubbleCallback);
|
||||
this.scopeOff();
|
||||
if (this.scopeOff) {
|
||||
this.scopeOff();
|
||||
}
|
||||
};
|
||||
|
||||
return InfoGesture;
|
||||
|
Loading…
Reference in New Issue
Block a user