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="bxbvt7p" 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="rlrnxx7" 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="aouck2c" id='0bgow'><tfoot id='0bgow'></tfoot><dl id='0bgow'><fieldset id='0bgow'></fieldset></dl></div>
                        • <tfoot id='0bgow'></tfoot>

                            主站蜘蛛池模板: 广州各区危化证办理_危险化学品经营许可证代办 | 楼梯定制_楼梯设计施工厂家_楼梯扶手安装制作-北京凌步楼梯 | 橡胶弹簧|复合弹簧|橡胶球|振动筛配件-新乡市永鑫橡胶厂 | Boden齿轮油泵-ketai齿轮泵-yuken油研-无锡新立液压有限公司 | 包装机传感器-搅拌站传感器-山东称重传感器厂家-济南泰钦电气 | 金环宇|金环宇电线|金环宇电缆|金环宇电线电缆|深圳市金环宇电线电缆有限公司|金环宇电缆集团 | B2B网站_B2B免费发布信息网站_B2B企业贸易平台 - 企资网 | 电表箱-浙江迈峰电力设备有限公司-电表箱专业制造商 | 山东臭氧发生器,臭氧发生器厂家-山东瑞华环保设备 | 手持气象站_便携式气象站_农业气象站_负氧离子监测站-山东万象环境 | 【ph计】|在线ph计|工业ph计|ph计厂家|ph计价格|酸度计生产厂家_武汉吉尔德科技有限公司 | 质构仪_鱼糜弹性仪-上海腾拔仪器科技有限公司 | 桁架楼承板-钢筋桁架楼承板-江苏众力达钢筋楼承板厂 | 全自动实验室洗瓶机,移液管|培养皿|进样瓶清洗机,清洗剂-广州摩特伟希尔机械设备有限责任公司 | 全自动烧卖机厂家_饺子机_烧麦机价格_小笼汤包机_宁波江北阜欣食品机械有限公司 | 蓝米云-专注于高性价比香港/美国VPS云服务器及海外公益型免费虚拟主机 | 北京宣传片拍摄_产品宣传片拍摄_宣传片制作公司-现像传媒 | 电子元器件呆滞料_元器件临期库存清仓尾料_尾料优选现货采购处理交易商城 | 暴风影音| 运动木地板厂家_体育木地板安装_篮球木地板选购_实木运动地板价格 | 卫生型双针压力表-高温防腐差压表-安徽康泰电气有限公司 | 订做不锈钢_不锈钢定做加工厂_不锈钢非标定制-重庆侨峰金属加工厂 | 陕西自考报名_陕西自学考试网 | 恒压供水控制柜|无负压|一体化泵站控制柜|PLC远程调试|MCGS触摸屏|自动控制方案-联致自控设备 | 拉伸膜,PE缠绕膜,打包带,封箱胶带,包装膜厂家-东莞宏展包装 | 切铝机-数控切割机-型材切割机-铝型材切割机-【昆山邓氏精密机械有限公司】 | 铝单板_铝窗花_铝单板厂家_氟碳包柱铝单板批发价格-佛山科阳金属 | 通辽信息港 - 免费发布房产、招聘、求职、二手、商铺等信息 www.tlxxg.net | 渣油泵,KCB齿轮泵,不锈钢齿轮泵,重油泵,煤焦油泵,泊头市泰邦泵阀制造有限公司 | 网站优化公司_SEO优化_北京关键词百度快速排名-智恒博网络 | 骨龄仪_骨龄检测仪_儿童骨龄测试仪_品牌生产厂家【品源医疗】 | 济南品牌设计-济南品牌策划-即合品牌策划设计-山东即合官网 | 武汉天安盾电子设备有限公司 - 安盾安检,武汉安检门,武汉安检机,武汉金属探测器,武汉测温安检门,武汉X光行李安检机,武汉防爆罐,武汉车底安全检查,武汉液体探测仪,武汉安检防爆设备 | 万博士范文网-您身边的范文参考网站Vanbs.com | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 京港视通报道-质量走进大江南北-京港视通传媒[北京]有限公司 | 代理记账_公司起名核名_公司注册_工商注册-睿婕实业有限公司 | 幂简集成 - 品种超全的API接口平台, 一站搜索、试用、集成国内外API接口 | 丹佛斯变频器-Danfoss战略代理经销商-上海津信变频器有限公司 | 亚克隆,RNAi干扰检测,miRNA定量检测-上海基屹生物科技有限公司 | 爱德华真空泵油/罗茨泵维修,爱发科-比其尔产品供应东莞/杭州/上海等全国各地 |