diff --git a/platform/commonUI/edit/src/controllers/ElementsController.js b/platform/commonUI/edit/src/controllers/ElementsController.js index bd614aef26..d0c14c3807 100644 --- a/platform/commonUI/edit/src/controllers/ElementsController.js +++ b/platform/commonUI/edit/src/controllers/ElementsController.js @@ -64,8 +64,10 @@ define( var domainObject = selection[0].context.oldItem; self.refreshComposition(domainObject); - self.mutationListener = domainObject.getCapability('mutation') - .listen(self.refreshComposition.bind(self, domainObject)); + if (domainObject) { + self.mutationListener = domainObject.getCapability('mutation') + .listen(self.refreshComposition.bind(self, domainObject)); + } } $scope.filterBy = filterBy; @@ -86,7 +88,7 @@ define( * @private */ ElementsController.prototype.refreshComposition = function (domainObject) { - var selectedObjectComposition = domainObject.useCapability('composition'); + var selectedObjectComposition = domainObject && domainObject.useCapability('composition'); if (selectedObjectComposition) { selectedObjectComposition.then(function (composition) { diff --git a/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js b/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js index b3be02eac9..52480af741 100644 --- a/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js @@ -127,6 +127,16 @@ define( expect(mockUnlisten).toHaveBeenCalled(); }); + it("does not listen on mutation for element proxy selectable", function () { + selectable[0] = { + context: { + elementProxy: {} + } + }; + mockOpenMCT.selection.on.mostRecentCall.args[1](selectable); + + expect(mockDomainObject.getCapability).not.toHaveBeenCalledWith('mutation'); + }); }); } ); diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index bb916d4ae8..210bc945e2 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -272,7 +272,7 @@ define( self.resizeHandles = self.generateDragHandles(self.selectedElementProxy); } else { // Make fixed view selectable if it's not already. - if (!self.fixedViewSelectable) { + if (!self.fixedViewSelectable && selectable.length === 1) { self.fixedViewSelectable = true; selection.context.viewProxy = new FixedProxy(addElement, $q, dialogService); self.openmct.selection.select(selection);