Example #1
0
        private void LokForRectangleDistanceAligment(MonitorRectangle inDraggingRectangle)  //LOOK FOR INTERSECT WITH VIRTUAL AROUNDING RECT
        {
            var distanceValue = 8;

            if (MonitorRectanglesList != null && MonitorRectanglesList.Count > 1 && inDraggingRectangle.draggingStarted)
            {
                foreach (var monitor in MonitorRectanglesList)
                {
                    if (monitor != inDraggingRectangle && monitor.VirtualAroundRegionRect.IntersectsWith(inDraggingRectangle.TmpRectangle) && !monitor.TmpRectangle.IntersectsWith(inDraggingRectangle.TmpRectangle))
                    {
                        if (Math.Abs(inDraggingRectangle.Right - monitor.Left) < distanceValue && inDraggingRectangle.Right <= monitor.Left)
                        {
                            inDraggingRectangle.SetRight(monitor.Left - distanceValue);
                        }
                        else if (Math.Abs(inDraggingRectangle.Left - monitor.Right) < distanceValue && inDraggingRectangle.Left >= monitor.Right)
                        {
                            inDraggingRectangle.SetLeft(monitor.Right + distanceValue);
                        }
                        else if (Math.Abs(inDraggingRectangle.Bottom - monitor.Top) < distanceValue && inDraggingRectangle.Bottom <= monitor.Top)
                        {
                            inDraggingRectangle.SetBottom(monitor.Top - distanceValue);
                        }
                        else if (Math.Abs(inDraggingRectangle.Top - monitor.Bottom) < distanceValue && inDraggingRectangle.Top >= monitor.Bottom)
                        {
                            inDraggingRectangle.SetTop(monitor.Bottom + distanceValue);
                        }
                    }
                }
            }
        }
Example #2
0
        //Work with Rectangles aligment TEST functions   //po potrebi uraditi nove
        #region Look For Rectangle Side Aligment function
        private void LookForRectangleSideAligment(MonitorRectangle inDraggingRectangle, bool compareWithFarAwayRectangles = false)
        {
            var responseValue = 3;


            if (inDraggingRectangle.draggingStarted)
            {
                if (MonitorRectanglesList != null && MonitorRectanglesList.Count > 1)
                {
                    foreach (var monitor in MonitorRectanglesList)
                    {
                        if (monitor != inDraggingRectangle && (monitor.VirtualAroundRegionRect.IntersectsWith(inDraggingRectangle.TmpRectangle) || compareWithFarAwayRectangles))
                        {
                            if (Math.Abs(monitor.Left - inDraggingRectangle.Left) < responseValue) //Aligment stranica
                            {
                                inDraggingRectangle.SetLeft(monitor.Left);
                            }
                            else if (Math.Abs(monitor.Right - inDraggingRectangle.Right) < responseValue)
                            {
                                inDraggingRectangle.SetRight(monitor.Right);
                            }
                            else if (Math.Abs(monitor.Bottom - inDraggingRectangle.Bottom) < responseValue)
                            {
                                inDraggingRectangle.SetBottom(monitor.Bottom);
                            }
                            else if (Math.Abs(monitor.Top - inDraggingRectangle.Top) < responseValue)
                            {
                                inDraggingRectangle.SetTop(monitor.Top);
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        private void LokForRectangleDistanceAligment(MonitorRectangle inDraggingRectangle, MonitorRectangle inClosestRectangle) //GIVE CLOSEST MONITOR RECTANGLE FUNCTION WAY
        {
            var distanceValue = 6;

            if (inDraggingRectangle != null && inClosestRectangle != null)
            {
                if (Math.Abs(inDraggingRectangle.Right - inClosestRectangle.Left) < distanceValue && inDraggingRectangle.Right <= inClosestRectangle.Left)
                {
                    inDraggingRectangle.SetRight(inClosestRectangle.Left - distanceValue);
                }
                else if (Math.Abs(inDraggingRectangle.Left - inClosestRectangle.Right) < distanceValue && inDraggingRectangle.Left >= inClosestRectangle.Right)
                {
                    inDraggingRectangle.SetLeft(inClosestRectangle.Right + distanceValue);
                }
                else if (Math.Abs(inDraggingRectangle.Bottom - inClosestRectangle.Top) < distanceValue && inDraggingRectangle.Bottom <= inClosestRectangle.Top)
                {
                    inDraggingRectangle.SetBottom(inClosestRectangle.Top - distanceValue);
                }
                else if (Math.Abs(inDraggingRectangle.Top - inClosestRectangle.Bottom) < distanceValue && inDraggingRectangle.Top >= inClosestRectangle.Bottom)
                {
                    inDraggingRectangle.SetTop(inClosestRectangle.Bottom + distanceValue);
                }
            }
        }