pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<i id='KW8Fd'><tr id='KW8Fd'><dt id='KW8Fd'><q id='KW8Fd'><span id='KW8Fd'><b id='KW8Fd'><form id='KW8Fd'><ins id='KW8Fd'></ins><ul id='KW8Fd'></ul><sub id='KW8Fd'></sub></form><legend id='KW8Fd'></legend><bdo id='KW8Fd'><pre id='KW8Fd'><center id='KW8Fd'></center></pre></bdo></b><th id='KW8Fd'></th></span></q></dt></tr></i><div class="c2ntlri" id='KW8Fd'><tfoot id='KW8Fd'></tfoot><dl id='KW8Fd'><fieldset id='KW8Fd'></fieldset></dl></div>
    <bdo id='KW8Fd'></bdo><ul id='KW8Fd'></ul>
    1. <tfoot id='KW8Fd'></tfoot>
    2. <legend id='KW8Fd'><style id='KW8Fd'><dir id='KW8Fd'><q id='KW8Fd'></q></dir></style></legend>

      <small id='KW8Fd'></small><noframes id='KW8Fd'>

      1. 單擊(右鍵單擊)使用傳單地圖庫獲取圖像疊加層的

        Getting pixel coordinates of an image overlay using leaflet map library on click (right click)(單擊(右鍵單擊)使用傳單地圖庫獲取圖像疊加層的像素坐標)

          <i id='sJUTa'><tr id='sJUTa'><dt id='sJUTa'><q id='sJUTa'><span id='sJUTa'><b id='sJUTa'><form id='sJUTa'><ins id='sJUTa'></ins><ul id='sJUTa'></ul><sub id='sJUTa'></sub></form><legend id='sJUTa'></legend><bdo id='sJUTa'><pre id='sJUTa'><center id='sJUTa'></center></pre></bdo></b><th id='sJUTa'></th></span></q></dt></tr></i><div class="kgrujtz" id='sJUTa'><tfoot id='sJUTa'></tfoot><dl id='sJUTa'><fieldset id='sJUTa'></fieldset></dl></div>

            <legend id='sJUTa'><style id='sJUTa'><dir id='sJUTa'><q id='sJUTa'></q></dir></style></legend>

                <small id='sJUTa'></small><noframes id='sJUTa'>

              1. <tfoot id='sJUTa'></tfoot>
                • <bdo id='sJUTa'></bdo><ul id='sJUTa'></ul>
                    <tbody id='sJUTa'></tbody>

                • 本文介紹了單擊(右鍵單擊)使用傳單地圖庫獲取圖像疊加層的像素坐標的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試使用傳單地圖庫在單擊(右鍵單擊/上下文菜單)時獲取圖像疊加層的像素坐標.本質上,當用戶點擊圖片時,我需要找到用戶點擊圖片位置的 x、y 或寬度、高度.

                  I'm trying to get the pixel coordinates of an image overlay on click (right click/contextmenu) using the leaflet map library. Essentially when a user clicks on the image, I need to find the x,y or width,height of where the user clicked on the image.

                  目前這就是我所擁有的.

                  Currently this is what I have.

                  // Using leaflet.js to pan and zoom a big image.
                  // See also: http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html
                  
                  // create the slippy map
                  var map = L.map('image-map', {
                      minZoom: 1,
                      maxZoom: 4,
                      center: [0, 0],
                      zoom: 1,
                      crs: L.CRS.Simple,
                  });
                  
                  // dimensions of the image
                  var w = 2000,
                      h = 1500,
                      url = 'http://kempe.net/images/newspaper-big.jpg';
                  
                  // calculate the edges of the image, in coordinate space
                  var southWest = map.unproject([0, h], map.getMaxZoom() - 1);
                  var northEast = map.unproject([w, 0], map.getMaxZoom() - 1);
                  var bounds = new L.LatLngBounds(southWest, northEast);
                  
                  // add the image overlay, 
                  // so that it covers the entire map
                  L.imageOverlay(url, bounds).addTo(map);
                  
                  // tell leaflet that the map is exactly as big as the image
                  map.setMaxBounds(bounds);
                  
                  function onMapClick(e) {
                  
                   //returns on right click events   
                   console.log(e);
                  
                  
                  }
                  
                  //Hadnel on right click functions TODO: MOVE THIS LATER
                  map.on('contextmenu', onMapClick);
                  

                  目前 onMapClick(e) 在檢查點擊返回的事件時,我看不到所有返回坐標的證據,任何靠近我點擊位置的 x、y 或寬度和高度.

                  Currently onMapClick(e) upon inspecting the returned events on click I see no evidence of all returned coordinates any where near to the x,y or width and height of the location I clicked.

                  鑒于圖像的尺寸為 20000x15000,基本上我想看到的是我單擊的圖像位置的 x、y 或寬度、高度.

                  Essentially what I would like to see is the x,y or width,height of the location of the image I clicked given that the image is 20000x15000 in dimension.

                  這里是小提琴 http://jsfiddle.net/rayshinn/yvfwzfw4/1/

                  不知道為什么,但是當您一直放大時,它似乎有點錯誤.只需一直放大它就可以阻止 jsfiddle 上的錯誤.這個錯誤不是重點,因為它不會發生在我的本地環境中!似乎和小提琴有關.

                  推薦答案

                  傳單為您提供沿image-map" div 的 x,y 坐標,該坐標會隨著放大和縮小而調整大小.事件坐標不會縮放到您的圖像大小.

                  The leaflet is giving you the x,y coordinates along the "image-map" div which resizes with the zoom in and out. The event coordinates do not scale to your image size.

                  為了獲得相對于實際圖片大小的 x,y,您需要將坐標乘以 當前 div 尺寸與全尺寸圖片的比率 尺寸.

                  In order to get x,y relative to actual picture size, you need to multiply the coordinates against the ratio of current div dimensions and full sized image dimensions.

                  我通過獲取事件坐標,將它們乘以您的 var wvar h 并除以地圖的高度和寬度來計算您的 x,y:

                  I calculated your x,y by taking the events coordinates, multiplying them by your var w and var h and dividing them by the maps height and width:

                  function onMapClick(e) {
                  
                      var mapWidth=map._container.offsetWidth;
                      var mapHeight=map._container.offsetHeight;
                      console.log(e.containerPoint.x * w / mapWidth);
                      console.log(e.containerPoint.y * h / mapHeight);
                      console.log(e);
                  
                  
                  }
                  

                  這篇關于單擊(右鍵單擊)使用傳單地圖庫獲取圖像疊加層的像素坐標的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經度)
                  <legend id='0bgow'><style id='0bgow'><dir id='0bgow'><q id='0bgow'></q></dir></style></legend>
                    <bdo id='0bgow'></bdo><ul id='0bgow'></ul>
                    • <small id='0bgow'></small><noframes id='0bgow'>

                            <tbody id='0bgow'></tbody>

                          <i id='0bgow'><tr id='0bgow'><dt id='0bgow'><q id='0bgow'><span id='0bgow'><b id='0bgow'><form id='0bgow'><ins id='0bgow'></ins><ul id='0bgow'></ul><sub id='0bgow'></sub></form><legend id='0bgow'></legend><bdo id='0bgow'><pre id='0bgow'><center id='0bgow'></center></pre></bdo></b><th id='0bgow'></th></span></q></dt></tr></i><div class="ykvnqpg" id='0bgow'><tfoot id='0bgow'></tfoot><dl id='0bgow'><fieldset id='0bgow'></fieldset></dl></div>
                        • <tfoot id='0bgow'></tfoot>

                            主站蜘蛛池模板: 上海乾拓贸易有限公司-日本SMC电磁阀_德国FESTO电磁阀_德国FESTO气缸 | 水篦子|雨篦子|镀锌格栅雨水篦子|不锈钢排水篦子|地下车库水箅子—安平县云航丝网制品厂 | UV固化机_UVLED光固化机_UV干燥机生产厂家-上海冠顶公司专业生产UV固化机设备 | 灌装封尾机_胶水灌装机_软管灌装封尾机_无锡和博自动化机械制造有限公司 | 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 机器视觉检测系统-视觉检测系统-机器视觉系统-ccd检测系统-视觉控制器-视控一体机 -海克易邦 | 青岛球场围网,青岛车间隔离网,青岛机器人围栏,青岛水源地围网,青岛围网,青岛隔离栅-青岛晟腾金属制品有限公司 | 股指期货-期货开户-交易手续费佣金加1分-保证金低-期货公司排名靠前-万利信息开户 | 篷房[仓储-婚庆-展览-活动]生产厂家-江苏正德装配式帐篷有限公司 | 设定时间记录电子秤-自动累计储存电子秤-昆山巨天仪器设备有限公司 | 合肥礼品公司-合肥礼品定制-商务礼品定制公司-安徽柏榽商贸有限公司 | 广州监控安装公司_远程监控_安防弱电工程_无线wifi覆盖_泉威安防科技 | 污水/卧式/潜水/钻井/矿用/大型/小型/泥浆泵,价格,参数,型号,厂家 - 安平县鼎千泵业制造厂 | 环讯传媒,永康网络公司,永康网站建设,永康小程序开发制作,永康网站制作,武义网页设计,金华地区网站SEO优化推广 - 永康市环讯电子商务有限公司 | 酒精检测棒,数显温湿度计,酒安酒精测试仪,酒精检测仪,呼气式酒精检测仪-郑州欧诺仪器有限公司 | 武汉高低温试验箱_恒温恒湿试验箱厂家-武汉蓝锐环境科技有限公司 | 北京网站建设|北京网站开发|北京网站设计|高端做网站公司 | 厂房出租_厂房出售_产业园区招商_工业地产&nbsp;-&nbsp;中工招商网 | 志高装潢官网-苏州老房旧房装修改造-二手房装修翻新 | 好看的韩国漫画_韩漫在线免费阅读-汗汗漫画| 珠海网站建设_响应网站建设_珠海建站公司_珠海网站设计与制作_珠海网讯互联 | 太空舱_民宿太空舱厂家_移动房屋太空舱价格-豪品建筑 | 翰墨AI智能写作助手官网_人工智能问答在线AI写作免费一键生成 | 日本SMC气缸接头-速度控制阀-日本三菱伺服电机-苏州禾力自动化科技有限公司 | 西门子伺服电机维修,西门子电源模块维修,西门子驱动模块维修-上海渠利 | 低噪声电流前置放大器-SR570电流前置放大器-深圳市嘉士达精密仪器有限公司 | 洁净化验室净化工程_成都实验室装修设计施工_四川华锐净化公司 | 拖鞋定制厂家-品牌拖鞋代加工厂-振扬实业中国高端拖鞋大型制造商 | 无刷电机_直流无刷电机_行星减速机-佛山市藤尺机电设备有限公司 无菌检查集菌仪,微生物限度仪器-苏州长留仪器百科 | 环氧铁红防锈漆_环氧漆_无溶剂环氧涂料_环氧防腐漆-华川涂料 | 橡胶膜片,夹布膜片,橡胶隔膜密封,泵阀设备密封膜片-衡水汉丰橡塑科技公司网站 | 冷却塔降噪隔音_冷却塔噪声治理_冷却塔噪音处理厂家-广东康明冷却塔降噪厂家 | 政府回应:200块在义乌小巷能买到爱情吗?——揭秘打工族省钱约会的生存智慧 | 气动调节阀,电动调节阀,自力式压力调节阀,切断阀「厂家」-浙江利沃夫自控阀门 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 光伏家 - 太阳能光伏发电_分布式光伏发电_太阳能光伏网 | 内六角扳手「厂家」-温州市威豪五金工具有限公司 | 超声波流量计_流量标准装置生产厂家 _河南盛天精密测控 | 大流量卧式砂磨机_强力分散机_双行星双动力混合机_同心双轴搅拌机-莱州市龙跃化工机械有限公司 | 搅拌磨|搅拌球磨机|循环磨|循环球磨机-无锡市少宏粉体科技有限公司 | POM塑料_PBT材料「进口」聚甲醛POM杜邦原料、加纤PBT塑料报价格找利隆塑料 |