algairim commented on a change in pull request #255:
URL: https://github.com/apache/brooklyn-ui/pull/255#discussion_r675444372



##########
File path: ui-modules/blueprint-composer/app/views/main/main.controller.js
##########
@@ -110,8 +117,37 @@ export function MainController($scope, $element, $log, 
$state, $stateParams, brB
                 $log.error('Cannot save layers preferences: ' + ex.message);
             }
         }
+    };
+
+    // Relationship arcs and labels.
+    let isRelationshipArcsLayerActive = true;
+    let isRelationshipLabelsLayerActive = true;
+
+    // Re-apply filters when selected filters changed or graph is changed.
+    $scope.$watch('vm.layers', () => {
+        applyFilters();
+
+        let relationshipArcsLayer = vm.layers.find(l => l.id === 
PATHS_SELECTOR_ID);
+        let relationshipLabelsLayer = vm.layers.find(l => l.id === 
LABELS_SELECTOR_ID);
+
+        // Turning on labels turns on arcs.
+        if (relationshipLabelsLayer.active && 
!isRelationshipLabelsLayerActive) {
+            relationshipArcsLayer.active = true;
+        }
+
+        // Turning off arcs turns off labels.
+        if (!relationshipArcsLayer.active && isRelationshipArcsLayerActive) {
+            relationshipLabelsLayer.active = false;
+        }
+
+        // Update cached state for arc and labels.
+        isRelationshipArcsLayerActive = relationshipArcsLayer.active;
+        isRelationshipLabelsLayerActive = relationshipLabelsLayer.active;
+
     }, true);
 
+    $scope.$on('layers.filter', () => applyFilters());

Review comment:
       We need to redraw it for cases when filter is changed first and graph is 
changed after. Filter change in Layers applies changes styling changes to all 
existing elements on the canvas. Re-draw event is to re-apply those styling 
effects for graph changes.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to