ios - Zooming increases self.map.visibleMapRect.origin.x and y, but why? -
i have realized through testing mkmapview.visiblemaprect.origin.x increases scroll map in right (east) direction, , mkmapview.visiblemaprect.origin.y increases scroll down (south) direction (given north up).
my question is: why mkmapview.visiblemaprect.origin.x increase when zoom in?
isn't mkmapview origin top left point of visible area? then, wouldn't mkmapview.visiblemaprect.origin.x decrease zoom in, because top left position lower on map?
it makes sense mkmapview.visiblemaprect.origin.y increase because visible area lower before.
so why mkmapview.visiblemaprect.origin.x increase when zoom in? shouldn't be!!
the map view's visiblemaprect property mkmaprect.
mkmaprect defines rectangle using mkmappoint units.
the map's mkmappoint grid system fixed set of points covering whole world.
the origin @ top-left , corresponds approximately real-word coordinate of 85° n, 180° w.
the x-axis goes 0 (left/west-most) , increases positively towards right/east large number.
the y-axis goes 0 (top/north-most) , increases positively towards bottom/south large number.
the visiblemaprect indicates portion of entire world's mkmaprect map showing.
so origin of visiblemaprect mkmappoint in entire world's mkmaprect showing @ top-left of map view.
suppose viewing whole world.
visiblemaprect.origin might x=0, y=0.
when zoom in, new top-left point being viewed further right of previous top-left point.
when go further right, x-axis value increases.
maybe crude diagram help:
x-axis 0 ----------------------------- positive ---> ________________________________________________ 0 | | : | | : | +=============================+ | y-axis : | |a | | : | | +==========+ | | : | | |b | | | positive | | | | | | : | | +==========+ | | : | | | | : | +=============================+ | v | | |________________________________________________| - the outer rectangle entire world's fixed
mkmaprect(mkmaprectworld). - the first inner rectangle top-left corner "a" initial
visiblemaprect. "a" might x=5000, y=2000. - the second inner rectangle top-left corner "b" zoomed-in
visiblemaprect. "b" have higher x , higher y.
way, don't need concerned specific mkmaprect or mkmappoint values themselves. answer related question might help: difficulties understanding mapkit coordinate system.
Comments
Post a Comment