[ka-Map-users] Re: Zoom tool
Paul Spencer
pspencer at dmsolutions.ca
Wed May 17 07:21:19 EDT 2006
Wayne,
you are correct, there is no tool to zoom at the point of click. It
would be relatively straightforward to accomplish this with a
subclass of the query tool. Here's a sample (untested of course ;))
KAMAP_ZOOMIN = 0;
KAMAP_ZOOMOUT = 1;
function kaZoomOnClick( oKaMap, type ) {
kaQuery.apply( this, [oKaMap, KAMAP_POINT_QUERY] );
this.name = 'kaZoomOnClick';
this.cursor = 'auto';
this.type = type;
for (var p in kaQuery.prototype) {
if (!kaZoomOnClick.prototype[p])
kaZoomOnClick.prototype[p]= kaQuery.prototype[p];
}
};
kaQuery.prototype.onmouseup = function(e) {
var gp = this.kaMap.pixToGeo( -this.startx, -this.starty );
var map = this.kaMap.getCurrentMap();
var scales = this.kaMap.getScales();
var newScale = map.currentScale;
if (this.type == KAMAP_ZOOMIN && newScale < scales.length - 1) {
newScale ++;
} else if (this.type == KAMAP_ZOOMOUT && newScale > 0) {
newScale --;
}
this.kaMap.zoomTo(gp[0],gp[1], scales[newScale]);
return false;
};
Cheers
Paul
On 17-May-06, at 2:28 AM, Wei Yang, Ng - Wayne wrote:
> Hi Paul,
> I was asked to create a zoom tool that allows me to click any
> where on the map and either zoom in on the location or zoom out of
> it. Is there such a tool yet? From my understanding there is only
> the query and pan tool.
>
> Cheers,
> Wayne
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+
More information about the ka-Map-users
mailing list