socketref,再见!高德

https://github.com/adoggie

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  246 Posts :: 4 Stories :: 312 Comments :: 0 Trackbacks

常用链接

留言簿(54)

我参与的团队

搜索

  •  

最新评论

阅读排行榜

评论排行榜

openscales基于事件驱动,一般对地图的操作应用openscales已经提供了基本的访问框架和部件来支持不同的应用
ClickHandler处于event/mouse包内,我们遇到要处理点击地图捕捉Click,doubleClick,DropDrag时就会用到这个东东了
那很简单,我们只需要new ClickHandler(map,false) , 设置几个回调函数(click,doubleclick等等),最后调用这个handler.active =true即可
启用这个handler了。
在地图上用鼠标点击即可测试了
注意到ClickHandler里面用到了一个Timer,觉得奇怪的
 1 protected function mouseUp(evt:MouseEvent):void {
 2             if (evt) {
 3                 
 4                 this.map.removeEventListener(MouseEvent.MOUSE_MOVE,this.mouseMove);
 5                 
 6                 if (this._downPixel != null) {
 7                     // It was not a drag, but was it a simple or a double click ?
 8                     // Just wait for a timer duration to know and call the right function.
 9                     this._upPixel = new Pixel(evt.currentTarget.mouseX, evt.currentTarget.mouseY);
10                     this._ctrlKey = evt.ctrlKey;
11                     this._shiftKey = evt.shiftKey;
12                     this._clickNum++;
13                     this._timer.start();
14                 }
15             }
想了一下就明白了期间的用意,看看注释,目的是为了推迟回调,防止回调处理繁忙阻塞交互界面


posted on 2011-07-02 00:39 放屁阿狗 阅读(522) 评论(0)  编辑 收藏 引用 所属分类: OpenScales

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理