实现 mouse-drag 的图标拖动
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>Maps Toolbar</title> <link rel="stylesheet" href="http://localhost:6081/arcgis_js/3.13/library/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://localhost:6081/arcgis_js/3.13/library/esri/css/esri.css">
<script src="http://localhost:6081/arcgis_js/3.13/library/init.js"></script> <style>
body {
width:100%;
height:100%;
margin:0;
padding:0;
position:absolute;
}
</style> <script type="text/javascript">
var map,_x,_y,isDrag,layers={};
require([
'esri/map',
'esri/layers/ArcGISTiledMapServiceLayer', 'esri/layers/GraphicsLayer','esri/layers/TiledMapServiceLayer', 'esri/layers/FeatureLayer',
'esri/graphic','esri/geometry/Point','esri/geometry/Circle','esri/InfoTemplate','esri/toolbars/draw', 'esri/toolbars/edit',
'esri/symbols/SimpleFillSymbol', 'esri/symbols/SimpleLineSymbol', 'esri/symbols/PictureMarkerSymbol','esri/symbols/SimpleMarkerSymbol',
'esri/renderers/SimpleRenderer', 'esri/Color','esri/tasks/LengthsParameters','esri/tasks/AreasAndLengthsParameters','esri/tasks/BufferParameters',
'dijit/registry'],function(){ init(); }); function init() {
map = new esri.Map("map");
var bk_map = new esri.layers.ArcGISTiledMapServiceLayer('http://192.168.0.244:6080/arcgis/rest/services/bkMap_VEC_BS/MapServer');
map.addLayer(bk_map);
dojo.connect(map, "onMouseDrag", showCoordinates);
dojo.connect(map, "onMouseMove", showCoordinates); layers.dragIocLayer = new esri.layers.GraphicsLayer();
map.addLayer(layers.dragIocLayer);
var pointSymbol = new esri.symbol.PictureMarkerSymbol('img/center.jpg', 23, 23);
var drawSimpleRender = new esri.renderer.SimpleRenderer(pointSymbol);
layers.dragIocLayer.setRenderer(drawSimpleRender);
layers.dragIocLayer.add(new esri.Graphic(new esri.geometry.Point(106.22572,29.65875, map.spatialReference))); layers.dragIocLayer.on("mouse-down", function(evt) {
map.disablePan();
isDrag = true;
});
map.on("mouse-up", function(evt) {
if(isDrag){
isDrag = false;
map.enablePan();
console.info(_x+","+_y);
}
}); } // 显示坐标
function showCoordinates(evt) {
var mp = evt.mapPoint;
_x = mp.x.toFixed(5);
_y = mp.y.toFixed(5);
if(isDrag){
layers.dragIocLayer.clear();
layers.dragIocLayer.add(new esri.Graphic(new esri.geometry.Point(_x,_y, map.spatialReference)));
}
} </script>
</head>
<body>
<div id="map" style="width:100%; height:100%;"></div>
</body>
</html>
实现 mouse-drag 的图标拖动的更多相关文章
- web桌面程序之图标拖动排序的分析
在web桌面程序里,图标拖动并重新排序是个比较常见的功能.这个功能我之前反复修改了好几遍,现在终于整理出了比较理想的解决思路,决定拿出来分享下. 这一功能主要有哪些难点呢?我总结了一下一共有2处难点: ...
- qt学习笔记(五) QGraphicsPixmapItem与QGraphicsScene的编程实例 图标拖动渐变效果
应大家的要求,还是把完整的project文件贴出来,大家省点事:http://www.kuaipan.cn/file/id_48923272389086450.htm 先看看执行效果,我用的群创7寸屏 ...
- WPF拖动总结[转载]
WPF拖动总结 这篇博文总结下WPF中的拖动,文章内容主要包括: 1.拖动窗口 2.拖动控件 Using Visual Studio 2.1thumb控件 2.2Drag.Drop(不连续,没有中 ...
- 原生 drag drop HTML5
drag事件( dragstart -- drag -- dragend ) 当按下鼠标开始drag一个可以拖动的对象时,触发dragstart事件,如果元素是不可拖动的话,会出现一个不可拖动的图 ...
- HTML5 学习05—— 拖放(Drag 和 Drop)
拖放(Drag 和 drop)是 HTML5 标准的组成部分.即抓取对象以后拖到另一个位置. 例:将w3cschool图标拖动到矩形框中. <script> function allowD ...
- [转载]WPF控件拖动
这篇博文总结下WPF中的拖动,文章内容主要包括: 1.拖动窗口 2.拖动控件 Using Visual Studio 2.1thumb控件 2.2Drag.Drop(不连续,没有中间动画) 2.3拖动 ...
- Android长按及拖动事件探究
Android中长按拖动还是比较常见的.比如Launcher中的图标拖动及屏幕切换,ListView中item顺序的改变,新闻类App中新闻类别的顺序改变等.下面就这个事件做一下分析. 就目前而言,A ...
- [RxJS] Drag and Drop example
Improving our mouse drag event Our mouse drag event is a little too simple. Notice that when we drag ...
- jquery简单的拖动效果
<!DOCTYPE html> <html> <meta http-equiv="Content-Type" content="text/h ...
随机推荐
- UVa 825 - Walking on the Safe Side
题目:在一个N*M的网格中,从左上角走到右下角,有一些点不能经过,求最短路的条数. 分析:dp,帕斯卡三角.每一个点最短的就是走N条向下,M条向右的路. 到达每一个点的路径条数为左边和上面的路径之和. ...
- virtio-netdev 发送数据包
在前面几文中已经大体介绍了virtio的重要组成,包含virtio net设备的创建,vring的创建,与virtio设备的交互方式.我们就从网络数据包的发送角度来看下virtio的详细使用流程. [ ...
- CKEditor上传插件
CKEditor上传插件 前言 CKEditor上传插件是不是免费的,与您分享在此开发.这个插件是基于ASP.NET MVC下开发的,假设是webform的用户或者其他语言的用户.能够參考把serve ...
- clientIDMode的应用
以前我们可以通过ClientID在JavaScript脚本中服务器端控件.比如: document.getElementById("<%=控件.ClientID %>" ...
- spring mvc 错误摘要--。位。
1....identifier of an instance of org.szgzw.ent.profile.baseinfo.enterprise.EnterpriseEntity was alt ...
- [LeetCode145]Binary Tree Postorder Traversal
题目: Given a list, rotate the list to the right by k places, where k is non-negative. For example:Giv ...
- 一个简单的样例看明确怎样利用window.location.hash实现ajax操作时浏览器的前进/后退功能
我们知道JavaScript中非常早就提供了window.history对象,利用history对象的forward().go().back()方法可以方便实现不同页面之间的前进.后退等这样的导航功能 ...
- VS2010或2012中,如何设置代码格式化?
ctrl + E,D菜单在 编辑-->高级 里面 第一个菜单项
- 设计模式-----观察者模式(Obsever)
它定义了对象之间一对多的依赖关系.因此,.当一个对象的状态变化,对吸毒成瘾者,他将收到通知和更新自己主动. 观察者模式的组成: 抽象主题角色:把全部对观察者对象的引用保存在一个集合中.抽象主题提供一个 ...
- ZOJ3629 Treasure Hunt IV(找到规律,按公式)
Treasure Hunt IV Time Limit: 2 Seconds Memory Limit: 65536 KB Alice is exploring the wonderland ...