mirror of
https://github.com/nasa/openmct.git
synced 2025-05-06 02:28:21 +00:00
[Common UI] Avoid apply-in-a-digest
Don't invoke from mct-resize when first observing an element's size during linking; observed issue in the context of adding domain selector to time conductor.
This commit is contained in:
parent
6bd8e7a47c
commit
1214a32c26
@ -58,6 +58,7 @@ define(
|
|||||||
// Link; start listening for changes to an element's size
|
// Link; start listening for changes to an element's size
|
||||||
function link(scope, element, attrs) {
|
function link(scope, element, attrs) {
|
||||||
var lastBounds,
|
var lastBounds,
|
||||||
|
linking = true,
|
||||||
active = true;
|
active = true;
|
||||||
|
|
||||||
// Determine how long to wait before the next update
|
// Determine how long to wait before the next update
|
||||||
@ -74,7 +75,9 @@ define(
|
|||||||
lastBounds.width !== bounds.width ||
|
lastBounds.width !== bounds.width ||
|
||||||
lastBounds.height !== bounds.height) {
|
lastBounds.height !== bounds.height) {
|
||||||
scope.$eval(attrs.mctResize, { bounds: bounds });
|
scope.$eval(attrs.mctResize, { bounds: bounds });
|
||||||
scope.$apply(); // Trigger a digest
|
if (!linking) { // Avoid apply-in-a-digest
|
||||||
|
scope.$apply();
|
||||||
|
}
|
||||||
lastBounds = bounds;
|
lastBounds = bounds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +104,9 @@ define(
|
|||||||
|
|
||||||
// Handle the initial callback
|
// Handle the initial callback
|
||||||
onInterval();
|
onInterval();
|
||||||
|
|
||||||
|
// Trigger scope.$apply on subsequent changes
|
||||||
|
linking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user