12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title data-i18n="resources.title_dragpan"></title>
- <style type="text/css">
- .editPane {
- position: absolute;
- right: 50px;
- top: 50px;
- text-align: center;
- background: #FFF;
- z-index: 1000;
- }
- </style>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
- <div class='panel panel-primary editPane' id='editPane' style="z-index: 99999">
- <div class='panel-heading'>
- <h5 class='panel-title text-center' data-i18n="resources.text_dragpan"></h5>
- </div>
- <div class='panel-body' id='params'>
- <p></p>
- <div align='right' class='button-group'>
- <input type='button' id='btn1' class='btn btn-primary' data-i18n="[value]resources.text_input_value_dragMap" onclick="activated()"/>
- <input type='button' id='btn2' class='btn btn-primary' data-i18n="[value]resources.text_input_value_notDrag" onclick="deactivated()"/>
- </div>
- </div>
- </div>
- <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
- <script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
- <script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
- <script type="text/javascript">
- var host = window.isLocal ? window.server : "https://iserver.supermap.io";
- var map, layerWorld;
- var url = host + "/iserver/services/map-world/rest/maps/World";
- //初始化地图拖拽控件类
- dragPan = new SuperMap.Control.DragPan();
- //当该属性为true,拖拽地图时,鼠标移动到地图可视区域外依然有效。默认为false
- dragPan.documentDrag = true;
- //设置是否使用拖拽动画。默认为false,不使用动画
- dragPan.enableKinetic = true;
- //执行动画的间隔,默认为10,单位是毫秒
- dragPan.kineticInterval = 20;
- //初始化地图类,添加地图拖拽控件到Map
- map = new SuperMap.Map("map", {
- controls: [dragPan]
- });
- layerWorld = new SuperMap.Layer.TiledDynamicRESTLayer("World", url); //获取图层服务地址
- layerWorld.events.on({"layerInitialized": addLayer});
- //添加地图图层到map
- function addLayer() {
- map.addLayers([layerWorld]);
- map.setCenter(new SuperMap.LonLat(80, 37), 4);
- }
- //激活控件
- function activated() {
- dragPan.activate();
- }
- //注销控件
- function deactivated() {
- dragPan.deactivate();
- }
- </script>
- </body>
- </html>
|