예제 #1
0
        private Service MouseOverService()
        {
            for (int i = 0; i < nodes.Length; i++)
            {
                Node node = nodes[i];
                if (node is Composite)
                {
                    Composite composite = node as Composite;

                    float sharedHeight = node.position.yMax - 14;
                    for (int j = composite.services.Length - 1; j >= 0; j--)
                    {
                        Service service = composite.services[j];

                        Rect serviceRect = node.position;
                        serviceRect.xMin += 7 + 13;
                        serviceRect.xMax -= 7;
                        serviceRect.yMin  = sharedHeight - (32 + NodeDrawer.GetCommentHeight(service.comment));
                        serviceRect.yMax  = sharedHeight;

                        if (serviceRect.Contains(_mousePosition))
                        {
                            return(service);
                        }

                        sharedHeight -= serviceRect.yMax - serviceRect.yMin + 5;
                    }
                }
            }
            return(null);
        }
예제 #2
0
        private Decorator MouseOverDecorator()
        {
            for (int i = 0; i < nodes.Length; i++)
            {
                Node  node         = nodes[i];
                float sharedHeight = node.position.yMin + 7;
                float sharedWidth  = node.position.width - 14;
                for (int j = 0; j < node.decorators.Length; j++)
                {
                    Decorator decorator = node.decorators[j];

                    Rect decoratorRect = node.position;
                    decoratorRect.width = sharedWidth;
                    decoratorRect.yMin  = sharedHeight;
                    decoratorRect.yMax  = sharedHeight + 32 + NodeDrawer.GetCommentHeight(decorator.comment);

                    if (decoratorRect.Contains(_mousePosition))
                    {
                        return(decorator);
                    }

                    sharedHeight += decoratorRect.yMax - decoratorRect.yMin + 5;
                }
            }
            return(null);
        }