<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>pointer-move</title> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } </style> <!--官网接口。--> <!--<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css">--> <!--<script src="https://js.arcgis.com/4.11/"></script>--> <!--龙哥的接口。--> <!--<link rel="stylesheet" href="http://118.89.225.237:8025/arcgis_js_api/library/4.11/4.11/esri/css/main.css">--> <!--<script src="http://118.89.225.237:8025/arcgis_js_api/library/4.11/4.11/init.js"></script>--> <!--我的接口。--> <link rel="stylesheet" href="http://localhost:8080/arcgis_js_v411_api/arcgis_js_api/library/4.11/esri/css/main.css"> <script src="http://localhost:8080/arcgis_js_v411_api/arcgis_js_api/library/4.11/dojo/dojo.js"></script> <!--上下两接口都行。--> <!--<script src="http://localhost:8080/arcgis_js_v411_api/arcgis_js_api/library/4.11/init.js"></script>--> <script> require([ "esri/Map", "esri/views/MapView" ], function(Map, MapView) { var map = new Map({ // osm,中文地图。 // topo,streets,satellite,hybrid,dark-gray,gray,national-geographic, // oceans,osm,terrain,dark-gray-vector,gray-vector,streets-vector, // streets-night-vector,streets-navigation-vector // topo-vector,streets-relief-vector basemap: "osm" }); var view = new MapView({ container: "viewDiv", map: map, center: [116.397245, 39.900930], zoom: 8 }); // pointer-move事件的触发条件: // 1.按住Shift的同时,在视图上移动鼠标。前提:传递参数["Shift"]。 // 2.在视图上移动鼠标。前提:传递参数[]。 view.on('pointer-move', [], function(evt){ var point = view.toMap({x: evt.x, y: evt.y}); console.log("point:", point); }); }); </script> </head> <body> <div id="viewDiv"></div> </body> </html>
pointer-move.html
最新推荐文章于 2024-06-18 17:18:11 发布