Esempio n. 1
0
        internal VNode(Node node, FrameworkElement frameworkElementOfNodeForLabelOfLabel,
                       Func <Edge, VEdge> funcFromDrawingEdgeToVEdge, Func <double> pathStrokeThicknessFunc)
        {
            PathStrokeThicknessFunc = pathStrokeThicknessFunc;
            Node = node;
            FrameworkElementOfNodeForLabel = frameworkElementOfNodeForLabelOfLabel;

            _funcFromDrawingEdgeToVEdge = funcFromDrawingEdgeToVEdge;

            CreateNodeBoundaryPath();
            if (FrameworkElementOfNodeForLabel != null)
            {
                FrameworkElementOfNodeForLabel.Tag = this; //get a backpointer to the VNode
                Common.PositionFrameworkElement(FrameworkElementOfNodeForLabel, node.GeometryNode.Center, 1);
                Panel.SetZIndex(FrameworkElementOfNodeForLabel, Panel.GetZIndex(BoundaryPath) + 1);
            }
            SetupSubgraphDrawing();
            Node.Attr.VisualsChanged += (a, b) => Invalidate();
            Node.IsVisibleChanged    += obj => {
                foreach (var frameworkElement in FrameworkElements)
                {
                    frameworkElement.Opacity = Node.IsVisible ? 1 : 0;
                }
            };
        }
Esempio n. 2
0
        void SetupCollapseSymbol()
        {
            var collapseBorderSize = GetCollapseBorderSymbolSize();

            Debug.Assert(collapseBorderSize > 0);
            _collapseButtonBorder = new Border {
                Background   = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive),
                Width        = collapseBorderSize,
                Height       = collapseBorderSize,
                CornerRadius = new CornerRadius(collapseBorderSize / 2)
            };

            Panel.SetZIndex(_collapseButtonBorder, Panel.GetZIndex(BoundaryPath) + 1);


            var collapseButtonCenter = GetCollapseButtonCenter(collapseBorderSize);

            Common.PositionFrameworkElement(_collapseButtonBorder, collapseButtonCenter, 1);

            double w = collapseBorderSize * 0.4;

            _collapseSymbolPath = new Path {
                Data            = CreateCollapseSymbolPath(collapseButtonCenter + new Point(0, -w / 2), w),
                Stroke          = _collapseSymbolPathInactive,
                StrokeThickness = 1
            };

            Panel.SetZIndex(_collapseSymbolPath, Panel.GetZIndex(_collapseButtonBorder) + 1);
            _topMarginRect.PointerPressed += (s, e) =>
                                             TopMarginRectMouseLeftButtonDown(e);
        }