Adds mouse wheel support to the HTML viewer in 9.2 ArcIMS - no reason why it should not work in others as it call the existing zoomin() and zoomout() functions.
The original script I used at http://adomas.org/javascript-mouse-wheel/
claims to work in IE, Mozilla, Firefox, Opera. I have tested in in Firefox 2 and IE 6.
The wheel action zooms in by the preset zoom level around where the mouse pointer is NOT the centre of the map
Add to the end of aimsClick.js
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//ACM Wheel Mouse function
//Code originall from http://adomas.org/javascript-mouse-wheel/
function handle(delta) {
if (delta < 0)
zoomout();
else
zoomin();
}
/** Event handler for mouse wheel event.
*/
function wheel(event){
var delta = 0;
if (!event) /* For IE. */
event = window.event;
if (event.wheelDelta) { /* IE/Opera. */
delta = event.wheelDelta/120;
/** In Opera 9, delta differs in sign as compared to IE.
*/
if (window.opera)
delta = -delta;
} else if (event.detail) { /** Mozilla case. */
/** In Mozilla, sign of delta is different than in IE.
* Also, delta is multiple of 3.
*/
delta = -event.detail/3;
}
/** If delta is nonzero, handle it.
* Basically, delta is now positive if wheel was scrolled up,
* and negative, if wheel was scrolled down.
*/
if (delta)
handle(delta);
/** Prevent default actions caused by mouse wheel.
* That might be ugly, but we handle scrolls somehow
* anyway, so don't bother here..
*/
if (event.preventDefault)
event.preventDefault();
event.returnValue = false;
}
/** Initialization code.
* If you use your own event management code, change it as required.
*/
if (window.addEventListener)
/** DOMMouseScroll is for mozilla. */
window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;
//end ACM
[此贴子已经被作者于2007-7-17 20:30:37编辑过]