From: <jam...@us...> - 2007-01-23 00:02:10
|
Revision: 23 http://svn.sourceforge.net/nplot/?rev=23&view=rev Author: jamcquay Date: 2007-01-22 16:02:09 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Fixed [SF bug 1601158] The check for whether the rubberband was inbounds was only looking at the min & max points of the rubberband. The code now checks all four corner points to determine if the selection is inbounds (i.e. at least one corner is on the chart) Code fixed by: jamcquay Signed off by: jamcquay Modified Paths: -------------- trunk/src/Windows.PlotSurface2D.cs Modified: trunk/src/Windows.PlotSurface2D.cs =================================================================== --- trunk/src/Windows.PlotSurface2D.cs 2007-01-11 14:30:12 UTC (rev 22) +++ trunk/src/Windows.PlotSurface2D.cs 2007-01-23 00:02:09 UTC (rev 23) @@ -1360,8 +1360,24 @@ maxPoint.X = Math.Max(startPoint_.X, endPoint_.X); maxPoint.Y = Math.Max(startPoint_.Y, endPoint_.Y); + // We also need the point coordinates at the other two corners + // to check if the rubberband selection is inbounds + //(i.e. at least one corner is located inside the chart + Point cornerUpperRight = new Point(0, 0); + cornerUpperRight.X = Math.Max(startPoint_.X, endPoint_.X); + cornerUpperRight.Y = Math.Min(startPoint_.Y, endPoint_.Y); + + Point cornerLowerLeft = new Point(0, 0); + cornerLowerLeft.X = Math.Min(startPoint_.X, endPoint_.X); + cornerLowerLeft.Y = Math.Max(startPoint_.Y, endPoint_.Y); + Rectangle r = ps.PlotAreaBoundingBoxCache; - if (minPoint != maxPoint && (r.Contains(minPoint) || r.Contains(maxPoint))) + bool isRubberbandInbounds = r.Contains(minPoint) || + r.Contains(maxPoint) || + r.Contains(cornerUpperRight) || + r.Contains(cornerLowerLeft); + + if (isRubberbandInbounds && minPoint != maxPoint) { ((Windows.PlotSurface2D)ctr).CacheAxes(); @@ -1378,7 +1394,7 @@ return true; } - } + } return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |