ZoomControl.ToContentRectangle(...) Not calculating selected area properly


The area selection logic does not appear to be correct to calculate the area for the coordinate system used in the ZoomControl. I modified the method ZoomControl.ToContentRectangle(...) to the following in order to get the proper area selection when a Vertex Control happens to occupy both a negative and positive plane. Since the passed in screenRectangle is in client pixels we should be able to use this with the current Zoom value to get the proper translation to compute an area rectangle used for intersection testing. Am I missing something in the logic?

The existing logic does not work properly when the Vertex Control resides in a negative plane.
        public Rect ToContentRectangle(Rect screenRectangle)
            var tl = TranslatePoint(new Point(screenRectangle.X, screenRectangle.Y), ContentVisual);
            //var br = TranslatePoint(new Point(screenRectangle.Right, screenRectangle.Bottom), ContentVisual);
            //return new Rect(tl.X, tl.Y, Math.Abs(Math.Abs(br.X) - Math.Abs(tl.X)), Math.Abs(Math.Abs(br.Y) - Math.Abs(tl.Y)));

            return new Rect(tl.X, tl.Y, screenRectangle.Width / Zoom, screenRectangle.Height / Zoom);


panthernet wrote Dec 7, 2014 at 3:49 PM

Hi, thanks for finding and fixing this issue, i'll include the fix asap. Btw, it's better to host issues on GitHub :)