Ejemplo n.º 1
0
        public void Start(MouseController mc)
        {
            this.mc = mc;

            //calc min and max
            var         points  = line.Grid.Nodes.Select(n => line.IsHorizontal ? n.OriginalLocation.Y : n.OriginalLocation.X).OrderBy(x => x).ToArray();
            const float padding = 1;

            minLocation = points.Where(x => x < line.Location).LastOrDefault() + padding;
            maxLocation = points.Where(x => x > line.Location).FirstOrDefault() - padding;
            if (maxLocation.Around(-padding))
            {
                maxLocation = 10000;
            }

            //get my node list
            nodes = line.Grid.Nodes.Where(n => line.IsHorizontal
            ? n.OriginalLocation.Y.Around(line.Location)
            : n.OriginalLocation.X.Around(line.Location)).ToList();
            mc.MouseMove += Mc_MouseMove;
            mc.MouseUp   += Mc_MouseUp;
        }