[mapguide-trac] #1585: Zoom Rectange doesn't work properly in
Ajax viewer
MapGuide Open Source
trac_mapguide at osgeo.org
Tue Jan 18 02:16:36 EST 2011
#1585: Zoom Rectange doesn't work properly in Ajax viewer
---------------------------+------------------------------------------------
Reporter: wuma | Owner: Mars Wu
Type: defect | Status: new
Priority: low | Milestone: 2.2
Component: AJAX Viewer | Version: 2.2.0
Severity: trivial | Keywords:
External_id: |
---------------------------+------------------------------------------------
Comment(by wuma):
The reason is: in function ExecuteRectangleTool, the scale calculation and
zoom is done this way:
{{{
if(tool == 3)
{
if((x2 - x1 <= 2) && (y2 - y1 <= 2))
return;
pt1 = ScreenToMapUnits(x1, y1);
pt2 = ScreenToMapUnits(x2, y2);
mcsW = pt2.X - pt1.X;
mcsH = pt2.Y - pt1.Y;
scale = CalculateScale1(mcsW, mcsH, mapDevW, mapDevH);
scale = finscale? GetNearestFiniteScale(scale):
NormalizeScale(scale);
HideMapImage();
GotoView(pt1.X + mcsW/2, pt1.Y + mcsH/2, scale, true, false);
}
}}}
In screen space, coordinates increase from top-left corner to bottom-right
corner, while in map CS space, the coordinates increase from bottom-left
corner to top-right corner. As a result, mcsH will be a negative number.
While in above function, it is used as a positive number. Then the
calculated scale is wrong.
--
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/1585#comment:1>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals
More information about the mapguide-trac
mailing list