nanzhouguo 2017-11-10 07:29 采纳率: 0%
浏览 1290
已结题

ARCGIS for JS中如何做可拖动的对话框?

arcgis中一般用InfoTemplate做信息展示,可是这个信息框是固定的。怎么做一个可任意拖动的对话框?

  • 写回答

1条回答

  • 战在春秋 2017-11-10 09:09
    关注

    可以参考以下代码:

    require([  
        "esri/arcgis/utils",   
        "dojo/dnd/Moveable"  
    ], function (arcgisUtils, Movable) {  
        "use strict";  
        var mapId = "bc6e18b0c332407e800c234de472939f"; // Replace with your own map ID from ArcGIS.com.  
    
        /** 
         * Makes the popup draggable. 
         * @returns {dojo/dnd/Movable} 
         */  
        function makePopupDraggable(){  
            var popupDiv = document.querySelector(".esriPopup");  
            var dnd;  
            if (popupDiv) {  
                dnd = new Movable(popupDiv);  
            }  
            // TODO: Figure out how to make the little arrow point the right way after dragging.  
            return dnd;  
        }  
    
        arcgisUtils.createMap(mapId, "map", {  
            usePopupManager: true,  
            mapOptions: {  
                center: [-120.80566406246835, 47.41322033015946],  
                zoom: 7,  
                minZoom: 7  
            }  
        }).then(makePopupDraggable);  
    
    });
    

    这种方法需要借助 dojo.dnd.Moveable
    其网址为:

    http://dojotoolkit.org/reference-guide/1.7/dojo/dnd/Moveable.html#dojo-dnd-moveable

    如果对您有帮助,请采纳答案好吗,谢谢!

    评论

报告相同问题?

悬赏问题

  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致