默认头像
路人甲
路人甲
  • 注册日期2003-08-25
  • 发帖数59
  • QQ
  • 铜币374枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2127回复:3

JSP+ArcIMS能不能实现用鼠标滚轮来放大缩小的呀?

楼主#
更多 发布于:2007-07-17 16:11
JSP+ArcIMS能不能实现用鼠标滚轮来放大缩小的呀?<BR>
喜欢0 评分0
默认头像
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2007-07-17 20:30


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编辑过]
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
默认头像
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2007-07-17 20:31

脚本的原始来源:http://adomas.org/javascript-mouse-wheel/

我这里可以打开

[此贴子已经被作者于2007-7-17 20:32:52编辑过]
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2003-08-25
  • 发帖数59
  • QQ
  • 铜币374枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2007-07-19 15:21
谢谢了,正在试,有问题再联系你。
举报 回复(0) 喜欢(0)     评分
默认头像

返回顶部