LiveGadgets


I have a project requirement to have a maximum zoom level of 11. What I'd like to do is trap the onstartzoom event and set some form of cancel if requestedView.zoomLevel>11 but I don't see a way to do it. I've returned false from the event and even set requestedView.zoomLevel=11.

Right now I'm using the onendzoom event and calling SetZoomLevel(11), but the user sees a weird zoom in and out effect.

function onZoom(evt) {
if (map.GetZoomLevel()>11) {
map.SetZoomLevel(11);
}
}

Does anybody know a way to cancel an onstartzoom event





Re: restrict max zoomlevel

Derek Chan


I'm assuming you want to change the dashboard functionality so that the user can only go down to the zoomlevel=11 Also I think your getting this zoom in zoom out affected because you zoom in fully (or past level 11), and then your method fires and then it zooms it back to level 11.

From my understanding you will need to completely customize the dashboard in order to do that. I don't know the specifics, but a lookup on google for "Virtual Earth Dashboard Widgets" or something to that degree would be a good start.





Re: restrict max zoomlevel

SoulSolutions

It not just the dashboard as you can zoom with the keyboard or mouse also.

There is no way i know of built in. You could try to hack the js but rememeber it will be a hack and may not work in both browsers and 3D mode (lots of testing needed).

John.







Re: restrict max zoomlevel

LiveGadgets

Correct. I'm not concerned about the dashboard as I have it turned off. I'm concerned about all forms of zoom: the mouse scroll wheel, double clicking the map, etc.

What is needed in version.next is a cancel property of the onstartzoom event. I could then do this:

map.AttachEvent("onstartzoom", mapStartZoom);

function mapStartZoom(evt) {
if (evt.requestedView.zoomLevel>11) {
evt.cancel=
true;
}
}