From ee580c71ee6bdaada7a1c24421ab2ba91341ad7d Mon Sep 17 00:00:00 2001 From: Jonatas Walker Date: Fri, 27 Jan 2017 07:48:04 -0200 Subject: [PATCH] Fix bad english isOpened --- README.md | 6 +++--- build/ol3-contextmenu-debug.js | 15 ++++++++++----- build/ol3-contextmenu.css | 26 ++++++++++---------------- build/ol3-contextmenu.js | 10 +++++----- build/ol3-contextmenu.js.map | 1 + build/ol3-contextmenu.min.css | 9 ++++----- package.json | 2 +- src/js/base.js | 9 +++++++-- test/spec/contextmenu.js | 8 ++++---- 9 files changed, 45 insertions(+), 41 deletions(-) create mode 100644 build/ol3-contextmenu.js.map diff --git a/README.md b/README.md index a778803..c492eb6 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ map.addControl(contextmenu); ##### You can add a (nested) submenu like this: -If you provide `items {Array}` a submenu will be created as a child of the current item. +If you provide `items {Array}` a submenu will be created as a child of the current item. ```javascript var all_items = [ @@ -190,9 +190,9 @@ Remove the last item of the menu. Get an array of default items. -#### contextmenu.isOpened() +#### contextmenu.isOpen() -Whether the menu is opened. +Whether the menu is open. #### contextmenu.updatePosition(pixel) diff --git a/build/ol3-contextmenu-debug.js b/build/ol3-contextmenu-debug.js index eea8b2b..d3af8a1 100644 --- a/build/ol3-contextmenu-debug.js +++ b/build/ol3-contextmenu-debug.js @@ -1,8 +1,8 @@ -/** +/*! + * ol3-contextmenu - v2.4.1 * Custom Context Menu for Openlayers 3 * https://github.com/jonataswalker/ol3-contextmenu - * Version: v2.4.0 - * Built: 2016-11-17T16:44:59-02:00 + * Built: Fri Jan 27 2017 07:46:19 GMT-0200 (BRST) */ (function (global, factory) { @@ -812,9 +812,14 @@ var Base = (function (superclass) { }; /** - * Am I opened?. + * bad english + * keep it (for a while) to not break changes */ Base.prototype.isOpened = function isOpened () { + return this.isOpen(); + }; + + Base.prototype.isOpen = function isOpen () { return this.Internal.opened; }; @@ -823,7 +828,7 @@ var Base = (function (superclass) { */ Base.prototype.updatePosition = function updatePosition (pixel) { utils.assert(Array.isArray(pixel), '@param `pixel` should be an Array.'); - if (this.isOpened()) { + if (this.isOpen()) { this.Internal.positionContainer(pixel); } }; diff --git a/build/ol3-contextmenu.css b/build/ol3-contextmenu.css index 32af79b..e4f16dc 100644 --- a/build/ol3-contextmenu.css +++ b/build/ol3-contextmenu.css @@ -1,10 +1,9 @@ -/** +/*! + * ol3-contextmenu - v2.4.1 * Custom Context Menu for Openlayers 3 * https://github.com/jonataswalker/ol3-contextmenu - * Version: v2.4.0 - * Built: 2016-11-17T16:44:59-02:00 + * Built: Fri Jan 27 2017 07:46:22 GMT-0200 (BRST) */ - .ol-ctx-menu-container { position: absolute; padding: 8px; @@ -38,7 +37,7 @@ position: relative; line-height: 20px; padding: 2px 5px; } - .ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover { + .ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover { cursor: pointer; background-color: #333; color: #eee; } @@ -71,26 +70,21 @@ border-color: #eee; } .ol-ctx-menu-container li.ol-ctx-menu-separator { padding: 0; } - .ol-ctx-menu-container li.ol-ctx-menu-separator hr { + .ol-ctx-menu-container li.ol-ctx-menu-separator hr { border: 0; height: 1px; background-image: -webkit-linear-gradient(right, transparent, rgba(0, 0, 0, 0.75), transparent); background-image: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.75), transparent); } - -.ol-ctx-menu-icon { + .ol-ctx-menu-icon { text-indent: 20px; background-size: 20px auto; background-repeat: no-repeat; background-position: left center; } - -.ol-ctx-menu-zoom-in { + .ol-ctx-menu-zoom-in { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg=="); } - -.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in { + .ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII="); } - -.ol-ctx-menu-zoom-out { + .ol-ctx-menu-zoom-out { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC"); } - -.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out { + .ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC"); } diff --git a/build/ol3-contextmenu.js b/build/ol3-contextmenu.js index f91cac0..4917caf 100644 --- a/build/ol3-contextmenu.js +++ b/build/ol3-contextmenu.js @@ -1,8 +1,8 @@ -/** +/*! + * ol3-contextmenu - v2.4.1 * Custom Context Menu for Openlayers 3 * https://github.com/jonataswalker/ol3-contextmenu - * Version: v2.4.0 - * Built: 2016-11-17T16:44:59-02:00 + * Built: Fri Jan 27 2017 07:46:19 GMT-0200 (BRST) */ - -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ContextMenu=e()}(this,function(){"use strict";var t="ol-ctx-menu",e="-container",n="-separator",i="-submenu",s="-hidden",o="-icon",a="-zoom-in",r="-zoom-out",l="ol-unselectable",c={BEFOREOPEN:"beforeopen",OPEN:"open",CLOSE:"close",ADD_MENU_ENTRY:"add-menu-entry",CONTEXTMENU:"contextmenu",HOVER:"mouseover"},h={container:t+e,separator:t+n,submenu:t+i,hidden:t+s,icon:t+o,zoomIn:t+a,zoomOut:t+r,OL_unselectable:l},u={width:150,scrollAt:4,eventType:c.CONTEXTMENU,defaultItems:!0},d=[{text:"Zoom In",classname:[h.zoomIn,h.icon].join(" "),callback:function(t,e){var n=e.getView(),i=ol.animation.pan({duration:1e3,source:n.getCenter()}),s=ol.animation.zoom({duration:1e3,resolution:n.getResolution()});e.beforeRender(i,s),n.setCenter(t.coordinate),n.setZoom(+n.getZoom()+1)}},{text:"Zoom Out",classname:[h.zoomOut,h.icon].join(" "),callback:function(t,e){var n=e.getView(),i=ol.animation.pan({duration:1e3,source:n.getCenter()}),s=ol.animation.zoom({duration:1e3,resolution:n.getResolution()});e.beforeRender(i,s),n.setCenter(t.coordinate),n.setZoom(+n.getZoom()-1)}}],p={isNumeric:function(t){return/^\d+$/.test(t)},classRegex:function(t){return new RegExp("(^|\\s+) "+t+" (\\s+|$)")},addClass:function(t,e,n){var i=this;if(Array.isArray(t))return void t.forEach(function(t){i.addClass(t,e)});for(var s=Array.isArray(e)?e:e.split(/\s+/),o=s.length;o--;)i.hasClass(t,s[o])||i._addClass(t,s[o],n)},_addClass:function(t,e,n){var i=this;t.classList?t.classList.add(e):t.className=(t.className+" "+e).trim(),n&&this.isNumeric(n)&&window.setTimeout(function(){i._removeClass(t,e)},n)},removeClass:function(t,e,n){var i=this;if(Array.isArray(t))return void t.forEach(function(t){i.removeClass(t,e,n)});for(var s=Array.isArray(e)?e:e.split(/\s+/),o=s.length;o--;)i.hasClass(t,s[o])&&i._removeClass(t,s[o],n)},_removeClass:function(t,e,n){var i=this;t.classList?t.classList.remove(e):t.className=t.className.replace(this.classRegex(e)," ").trim(),n&&this.isNumeric(n)&&window.setTimeout(function(){i._addClass(t,e)},n)},hasClass:function(t,e){return t.classList?t.classList.contains(e):this.classRegex(e).test(t.className)},toggleClass:function(t,e){var n=this;return Array.isArray(t)?void t.forEach(function(t){n.toggleClass(t,e)}):void(t.classList?t.classList.toggle(e):this.hasClass(t,e)?this._removeClass(t,e):this._addClass(t,e))},$:function(t){return t="#"===t[0]?t.substr(1,t.length):t,document.getElementById(t)},isElement:function(t){return"HTMLElement"in window?!!t&&t instanceof HTMLElement:!!t&&"object"==typeof t&&1===t.nodeType&&!!t.nodeName},find:function(t,e,n){void 0===e&&(e=window.document);var i=/^(#?[\w-]+|\.[\w-.]+)$/,s=/\./g,o=Array.prototype.slice,a=[];if(i.test(t))switch(t[0]){case"#":a=[this.$(t.substr(1))];break;case".":a=o.call(e.getElementsByClassName(t.substr(1).replace(s," ")));break;default:a=o.call(e.getElementsByTagName(t))}else a=o.call(e.querySelectorAll(t));return n?a:a[0]},offset:function(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+window.pageXOffset-n.clientLeft,top:e.top+window.pageYOffset-n.clientTop,width:t.offsetWidth,height:t.offsetHeight}},getViewportSize:function(){return{w:window.innerWidth||document.documentElement.clientWidth,h:window.innerHeight||document.documentElement.clientHeight}},getAllChildren:function(t,e){return[].slice.call(t.getElementsByTagName(e))},isEmpty:function(t){return!t||0===t.length},emptyArray:function(t){for(;t.length;)t.pop()},removeAllChildren:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},mergeOptions:function(t,e){var n={};for(var i in t)n[i]=t[i];for(var s in e)n[s]=e[s];return n},createFragment:function(t){var e=document.createDocumentFragment(),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)e.appendChild(n.firstChild);return e},contains:function(t,e){return!!~e.indexOf(t)},getUniqueId:function(){return"_"+Math.random().toString(36).substr(2,9)},isDefAndNotNull:function(t){return null!=t},assertEqual:function(t,e,n){if(t!==e)throw new Error(n+" mismatch: "+t+" != "+e)},assert:function(t,e){if(void 0===e&&(e="Assertion failed"),!t){if("undefined"!=typeof Error)throw new Error(e);throw e}}},m=function(t){return this.Base=t,this.map=void 0,this.mapElement=void 0,this.coordinateClicked=void 0,this.pixelClicked=void 0,this.lineHeight=0,this.items={},this.opened=!1,this.submenu={left:t.options.width-15+"px",lastLeft:""},this.eventHandler=this.handleEvent.bind(this),this};m.prototype.init=function(t){this.map=t,this.mapElement=t.getTargetElement(),this.setListeners(),this.Base.Html.createMenu(),this.lineHeight=this.getItemsLength()>0?this.Base.container.offsetHeight/this.getItemsLength():this.Base.Html.cloneAndGetLineHeight()},m.prototype.getItemsLength=function(){var t=this,e=0;return Object.keys(this.items).forEach(function(n){t.items[n].submenu||t.items[n].separator||e++}),e},m.prototype.getPixelClicked=function(){return this.pixelClicked},m.prototype.getCoordinateClicked=function(){return this.coordinateClicked},m.prototype.positionContainer=function(t){var e=this,n=this.map.getSize(),i=n[0],s=n[1],o=s-t[1],a=i-t[0],r={w:this.Base.container.offsetWidth,h:Math.round(this.lineHeight*this.getItemsLength())},l=p.find("li."+h.submenu+"> div",this.Base.container,!0);a>=r.w?(this.Base.container.style.right="auto",this.Base.container.style.left=t[0]+5+"px"):(this.Base.container.style.left="auto",this.Base.container.style.right="15px"),o>=r.h?(this.Base.container.style.bottom="auto",this.Base.container.style.top=t[1]-10+"px"):(this.Base.container.style.top="auto",this.Base.container.style.bottom=0),p.removeClass(this.Base.container,h.hidden),l.length&&(a<2*r.w?this.submenu.lastLeft="-"+r.w+"px":this.submenu.lastLeft=this.submenu.left,l.forEach(function(t){var n=p.getViewportSize(),i=p.offset(t),s=i.height,a=o-s;a<0&&(a=s-(n.h-i.top),t.style.top="-"+a+"px"),t.style.left=e.submenu.lastLeft}))},m.prototype.openMenu=function(t,e){this.Base.dispatchEvent({type:c.OPEN,pixel:t,coordinate:e}),this.opened=!0,this.positionContainer(t)},m.prototype.closeMenu=function(){this.opened=!1,p.addClass(this.Base.container,h.hidden),this.Base.dispatchEvent({type:c.CLOSE})},m.prototype.setListeners=function(){this.mapElement.addEventListener(this.Base.options.eventType,this.eventHandler,!1)},m.prototype.removeListeners=function(){this.mapElement.removeEventListener(this.Base.options.eventType,this.eventHandler,!1)},m.prototype.handleEvent=function(t){var e=this;this.coordinateClicked=this.map.getEventCoordinate(t),this.pixelClicked=this.map.getEventPixel(t),this.Base.dispatchEvent({type:c.BEFOREOPEN,pixel:this.pixelClicked,coordinate:this.coordinateClicked}),this.Base.disabled||(this.Base.options.eventType===c.CONTEXTMENU&&(t.stopPropagation(),t.preventDefault()),this.openMenu(this.pixelClicked,this.coordinateClicked),t.target.addEventListener("mousedown",{handleEvent:function(n){e.closeMenu(),t.target.removeEventListener(n.type,this,!1)}},!1))},m.prototype.setItemListener=function(t,e){var n=this;t&&"function"==typeof this.items[e].callback&&!function(i){t.addEventListener("click",function(t){t.preventDefault();var s={coordinate:n.getCoordinateClicked(),data:n.items[e].data||null};n.closeMenu(),i(s,n.map)},!1)}(this.items[e].callback)};var f=function(t){return this.Base=t,this.Base.container=this.container=this.createContainer(),this};f.prototype.createContainer=function(t){var e=document.createElement("div"),n=document.createElement("ul"),i=[h.container,h.OL_unselectable];return t&&i.push(h.hidden),e.className=i.join(" "),e.style.width=parseInt(this.Base.options.width,10)+"px",e.appendChild(n),e},f.prototype.createMenu=function(){var t=[];return"items"in this.Base.options?t=this.Base.options.defaultItems?this.Base.options.items.concat(d):this.Base.options.items:this.Base.options.defaultItems&&(t=d),0!==t.length&&void t.forEach(this.addMenuEntry,this)},f.prototype.addMenuEntry=function(t){var e=this;if(t.items&&Array.isArray(t.items)){t.classname=t.classname||"",p.contains(h.submenu,t.classname)||(t.classname=t.classname.length?" "+h.submenu:h.submenu);var n=this.generateHtmlAndPublish(this.container,t),i=this.createContainer();i.style.left=this.Base.Internal.submenu.lastLeft||this.Base.Internal.submenu.left,n.appendChild(i),t.items.forEach(function(t){e.generateHtmlAndPublish(i,t,!0)})}else this.generateHtmlAndPublish(this.container,t)},f.prototype.generateHtmlAndPublish=function(t,e,n){var i,s,o,a=!1,r=p.getUniqueId();return"string"==typeof e&&"-"===e.trim()?(i=['
  • ',"
  • "].join(""),s=p.createFragment(i),o=[].slice.call(s.childNodes,0)[0],t.firstChild.appendChild(s),a=!0):(e.classname=e.classname||"",i=""+e.text+"",s=p.createFragment(i),o=document.createElement("li"),e.icon&&(""===e.classname?e.classname=h.icon:e.classname.indexOf(h.icon)===-1&&(e.classname+=" "+h.icon),o.setAttribute("style","background-image:url("+e.icon+")")),o.id=r,o.className=e.classname,o.appendChild(s),t.firstChild.appendChild(o)),this.Base.Internal.items[r]={id:r,submenu:n||0,separator:a,callback:e.callback,data:e.data||null},this.Base.Internal.setItemListener(o,r),o},f.prototype.removeMenuEntry=function(t){var e=p.find("#"+t,this.container.firstChild);e&&this.container.firstChild.removeChild(e),delete this.Base.Internal.items[t]},f.prototype.cloneAndGetLineHeight=function(){var t=this.container.cloneNode(),e=p.createFragment("Foo"),n=p.createFragment("Foo"),i=document.createElement("li"),s=document.createElement("li");i.appendChild(e),s.appendChild(n),t.appendChild(i),t.appendChild(s),this.container.parentNode.appendChild(t);var o=t.offsetHeight/2;return this.container.parentNode.removeChild(t),o};var y=function(t){function e(e){void 0===e&&(e={}),p.assert("object"==typeof e,"@param `opt_options` should be object type!"),"default_items"in e&&(u.defaultItems=e.default_items),this.options=p.mergeOptions(u,e),this.disabled=!1,this.Internal=new m(this),this.Html=new f(this),t.call(this,{element:this.container})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clear=function(){var t=this;Object.keys(this.Internal.items).forEach(function(e){t.Html.removeMenuEntry(e)})},e.prototype.close=function(){this.Internal.closeMenu()},e.prototype.enable=function(){this.disabled=!1},e.prototype.disable=function(){this.disabled=!0},e.prototype.getDefaultItems=function(){return d},e.prototype.extend=function(t){p.assert(Array.isArray(t),"@param `arr` should be an Array."),t.forEach(this.push,this)},e.prototype.isOpened=function(){return this.Internal.opened},e.prototype.updatePosition=function(t){p.assert(Array.isArray(t),"@param `pixel` should be an Array."),this.isOpened()&&this.Internal.positionContainer(t)},e.prototype.pop=function(){var t=Object.keys(this.Internal.items);this.Html.removeMenuEntry(t[t.length-1])},e.prototype.push=function(t){p.assert(p.isDefAndNotNull(t),"@param `item` must be informed."),this.Html.addMenuEntry(t)},e.prototype.shift=function(){this.Html.removeMenuEntry(Object.keys(this.Internal.items)[0])},e.prototype.setMap=function(t){ol.control.Control.prototype.setMap.call(this,t),t?this.Internal.init(t,this):this.Internal.removeListeners()},e}(ol.control.Control);return y}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ContextMenu=e()}(this,function(){"use strict";var t="ol-ctx-menu",e="-container",n="-separator",i="-submenu",s="-hidden",o="-icon",a="-zoom-in",r="-zoom-out",l="ol-unselectable",c={BEFOREOPEN:"beforeopen",OPEN:"open",CLOSE:"close",ADD_MENU_ENTRY:"add-menu-entry",CONTEXTMENU:"contextmenu",HOVER:"mouseover"},h={container:t+e,separator:t+n,submenu:t+i,hidden:t+s,icon:t+o,zoomIn:t+a,zoomOut:t+r,OL_unselectable:l},u={width:150,scrollAt:4,eventType:c.CONTEXTMENU,defaultItems:!0},d=[{text:"Zoom In",classname:[h.zoomIn,h.icon].join(" "),callback:function(t,e){var n=e.getView(),i=ol.animation.pan({duration:1e3,source:n.getCenter()}),s=ol.animation.zoom({duration:1e3,resolution:n.getResolution()});e.beforeRender(i,s),n.setCenter(t.coordinate),n.setZoom(+n.getZoom()+1)}},{text:"Zoom Out",classname:[h.zoomOut,h.icon].join(" "),callback:function(t,e){var n=e.getView(),i=ol.animation.pan({duration:1e3,source:n.getCenter()}),s=ol.animation.zoom({duration:1e3,resolution:n.getResolution()});e.beforeRender(i,s),n.setCenter(t.coordinate),n.setZoom(+n.getZoom()-1)}}],p={isNumeric:function(t){return/^\d+$/.test(t)},classRegex:function(t){return new RegExp("(^|\\s+) "+t+" (\\s+|$)")},addClass:function(t,e,n){var i=this;if(Array.isArray(t))return void t.forEach(function(t){i.addClass(t,e)});for(var s=Array.isArray(e)?e:e.split(/\s+/),o=s.length;o--;)i.hasClass(t,s[o])||i._addClass(t,s[o],n)},_addClass:function(t,e,n){var i=this;t.classList?t.classList.add(e):t.className=(t.className+" "+e).trim(),n&&this.isNumeric(n)&&window.setTimeout(function(){i._removeClass(t,e)},n)},removeClass:function(t,e,n){var i=this;if(Array.isArray(t))return void t.forEach(function(t){i.removeClass(t,e,n)});for(var s=Array.isArray(e)?e:e.split(/\s+/),o=s.length;o--;)i.hasClass(t,s[o])&&i._removeClass(t,s[o],n)},_removeClass:function(t,e,n){var i=this;t.classList?t.classList.remove(e):t.className=t.className.replace(this.classRegex(e)," ").trim(),n&&this.isNumeric(n)&&window.setTimeout(function(){i._addClass(t,e)},n)},hasClass:function(t,e){return t.classList?t.classList.contains(e):this.classRegex(e).test(t.className)},toggleClass:function(t,e){var n=this;return Array.isArray(t)?void t.forEach(function(t){n.toggleClass(t,e)}):void(t.classList?t.classList.toggle(e):this.hasClass(t,e)?this._removeClass(t,e):this._addClass(t,e))},$:function(t){return t="#"===t[0]?t.substr(1,t.length):t,document.getElementById(t)},isElement:function(t){return"HTMLElement"in window?!!t&&t instanceof HTMLElement:!!t&&"object"==typeof t&&1===t.nodeType&&!!t.nodeName},find:function(t,e,n){void 0===e&&(e=window.document);var i=/^(#?[\w-]+|\.[\w-.]+)$/,s=/\./g,o=Array.prototype.slice,a=[];if(i.test(t))switch(t[0]){case"#":a=[this.$(t.substr(1))];break;case".":a=o.call(e.getElementsByClassName(t.substr(1).replace(s," ")));break;default:a=o.call(e.getElementsByTagName(t))}else a=o.call(e.querySelectorAll(t));return n?a:a[0]},offset:function(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+window.pageXOffset-n.clientLeft,top:e.top+window.pageYOffset-n.clientTop,width:t.offsetWidth,height:t.offsetHeight}},getViewportSize:function(){return{w:window.innerWidth||document.documentElement.clientWidth,h:window.innerHeight||document.documentElement.clientHeight}},getAllChildren:function(t,e){return[].slice.call(t.getElementsByTagName(e))},isEmpty:function(t){return!t||0===t.length},emptyArray:function(t){for(;t.length;)t.pop()},removeAllChildren:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},mergeOptions:function(t,e){var n={};for(var i in t)n[i]=t[i];for(var s in e)n[s]=e[s];return n},createFragment:function(t){var e=document.createDocumentFragment(),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)e.appendChild(n.firstChild);return e},contains:function(t,e){return!!~e.indexOf(t)},getUniqueId:function(){return"_"+Math.random().toString(36).substr(2,9)},isDefAndNotNull:function(t){return null!=t},assertEqual:function(t,e,n){if(t!==e)throw new Error(n+" mismatch: "+t+" != "+e)},assert:function(t,e){if(void 0===e&&(e="Assertion failed"),!t){if("undefined"!=typeof Error)throw new Error(e);throw e}}},m=function(t){return this.Base=t,this.map=void 0,this.mapElement=void 0,this.coordinateClicked=void 0,this.pixelClicked=void 0,this.lineHeight=0,this.items={},this.opened=!1,this.submenu={left:t.options.width-15+"px",lastLeft:""},this.eventHandler=this.handleEvent.bind(this),this};m.prototype.init=function(t){this.map=t,this.mapElement=t.getTargetElement(),this.setListeners(),this.Base.Html.createMenu(),this.lineHeight=this.getItemsLength()>0?this.Base.container.offsetHeight/this.getItemsLength():this.Base.Html.cloneAndGetLineHeight()},m.prototype.getItemsLength=function(){var t=this,e=0;return Object.keys(this.items).forEach(function(n){t.items[n].submenu||t.items[n].separator||e++}),e},m.prototype.getPixelClicked=function(){return this.pixelClicked},m.prototype.getCoordinateClicked=function(){return this.coordinateClicked},m.prototype.positionContainer=function(t){var e=this,n=this.map.getSize(),i=n[0],s=n[1],o=s-t[1],a=i-t[0],r={w:this.Base.container.offsetWidth,h:Math.round(this.lineHeight*this.getItemsLength())},l=p.find("li."+h.submenu+"> div",this.Base.container,!0);a>=r.w?(this.Base.container.style.right="auto",this.Base.container.style.left=t[0]+5+"px"):(this.Base.container.style.left="auto",this.Base.container.style.right="15px"),o>=r.h?(this.Base.container.style.bottom="auto",this.Base.container.style.top=t[1]-10+"px"):(this.Base.container.style.top="auto",this.Base.container.style.bottom=0),p.removeClass(this.Base.container,h.hidden),l.length&&(a<2*r.w?this.submenu.lastLeft="-"+r.w+"px":this.submenu.lastLeft=this.submenu.left,l.forEach(function(t){var n=p.getViewportSize(),i=p.offset(t),s=i.height,a=o-s;a<0&&(a=s-(n.h-i.top),t.style.top="-"+a+"px"),t.style.left=e.submenu.lastLeft}))},m.prototype.openMenu=function(t,e){this.Base.dispatchEvent({type:c.OPEN,pixel:t,coordinate:e}),this.opened=!0,this.positionContainer(t)},m.prototype.closeMenu=function(){this.opened=!1,p.addClass(this.Base.container,h.hidden),this.Base.dispatchEvent({type:c.CLOSE})},m.prototype.setListeners=function(){this.mapElement.addEventListener(this.Base.options.eventType,this.eventHandler,!1)},m.prototype.removeListeners=function(){this.mapElement.removeEventListener(this.Base.options.eventType,this.eventHandler,!1)},m.prototype.handleEvent=function(t){var e=this;this.coordinateClicked=this.map.getEventCoordinate(t),this.pixelClicked=this.map.getEventPixel(t),this.Base.dispatchEvent({type:c.BEFOREOPEN,pixel:this.pixelClicked,coordinate:this.coordinateClicked}),this.Base.disabled||(this.Base.options.eventType===c.CONTEXTMENU&&(t.stopPropagation(),t.preventDefault()),this.openMenu(this.pixelClicked,this.coordinateClicked),t.target.addEventListener("mousedown",{handleEvent:function(n){e.closeMenu(),t.target.removeEventListener(n.type,this,!1)}},!1))},m.prototype.setItemListener=function(t,e){var n=this;t&&"function"==typeof this.items[e].callback&&!function(i){t.addEventListener("click",function(t){t.preventDefault();var s={coordinate:n.getCoordinateClicked(),data:n.items[e].data||null};n.closeMenu(),i(s,n.map)},!1)}(this.items[e].callback)};var f=function(t){return this.Base=t,this.Base.container=this.container=this.createContainer(),this};f.prototype.createContainer=function(t){var e=document.createElement("div"),n=document.createElement("ul"),i=[h.container,h.OL_unselectable];return t&&i.push(h.hidden),e.className=i.join(" "),e.style.width=parseInt(this.Base.options.width,10)+"px",e.appendChild(n),e},f.prototype.createMenu=function(){var t=[];return"items"in this.Base.options?t=this.Base.options.defaultItems?this.Base.options.items.concat(d):this.Base.options.items:this.Base.options.defaultItems&&(t=d),0!==t.length&&void t.forEach(this.addMenuEntry,this)},f.prototype.addMenuEntry=function(t){var e=this;if(t.items&&Array.isArray(t.items)){t.classname=t.classname||"",p.contains(h.submenu,t.classname)||(t.classname=t.classname.length?" "+h.submenu:h.submenu);var n=this.generateHtmlAndPublish(this.container,t),i=this.createContainer();i.style.left=this.Base.Internal.submenu.lastLeft||this.Base.Internal.submenu.left,n.appendChild(i),t.items.forEach(function(t){e.generateHtmlAndPublish(i,t,!0)})}else this.generateHtmlAndPublish(this.container,t)},f.prototype.generateHtmlAndPublish=function(t,e,n){var i,s,o,a=!1,r=p.getUniqueId();return"string"==typeof e&&"-"===e.trim()?(i=['
  • ',"
  • "].join(""),s=p.createFragment(i),o=[].slice.call(s.childNodes,0)[0],t.firstChild.appendChild(s),a=!0):(e.classname=e.classname||"",i=""+e.text+"",s=p.createFragment(i),o=document.createElement("li"),e.icon&&(""===e.classname?e.classname=h.icon:e.classname.indexOf(h.icon)===-1&&(e.classname+=" "+h.icon),o.setAttribute("style","background-image:url("+e.icon+")")),o.id=r,o.className=e.classname,o.appendChild(s),t.firstChild.appendChild(o)),this.Base.Internal.items[r]={id:r,submenu:n||0,separator:a,callback:e.callback,data:e.data||null},this.Base.Internal.setItemListener(o,r),o},f.prototype.removeMenuEntry=function(t){var e=p.find("#"+t,this.container.firstChild);e&&this.container.firstChild.removeChild(e),delete this.Base.Internal.items[t]},f.prototype.cloneAndGetLineHeight=function(){var t=this.container.cloneNode(),e=p.createFragment("Foo"),n=p.createFragment("Foo"),i=document.createElement("li"),s=document.createElement("li");i.appendChild(e),s.appendChild(n),t.appendChild(i),t.appendChild(s),this.container.parentNode.appendChild(t);var o=t.offsetHeight/2;return this.container.parentNode.removeChild(t),o};var y=function(t){function e(e){void 0===e&&(e={}),p.assert("object"==typeof e,"@param `opt_options` should be object type!"),"default_items"in e&&(u.defaultItems=e.default_items),this.options=p.mergeOptions(u,e),this.disabled=!1,this.Internal=new m(this),this.Html=new f(this),t.call(this,{element:this.container})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clear=function(){var t=this;Object.keys(this.Internal.items).forEach(function(e){t.Html.removeMenuEntry(e)})},e.prototype.close=function(){this.Internal.closeMenu()},e.prototype.enable=function(){this.disabled=!1},e.prototype.disable=function(){this.disabled=!0},e.prototype.getDefaultItems=function(){return d},e.prototype.extend=function(t){p.assert(Array.isArray(t),"@param `arr` should be an Array."),t.forEach(this.push,this)},e.prototype.isOpened=function(){return this.isOpen()},e.prototype.isOpen=function(){return this.Internal.opened},e.prototype.updatePosition=function(t){p.assert(Array.isArray(t),"@param `pixel` should be an Array."),this.isOpen()&&this.Internal.positionContainer(t)},e.prototype.pop=function(){var t=Object.keys(this.Internal.items);this.Html.removeMenuEntry(t[t.length-1])},e.prototype.push=function(t){p.assert(p.isDefAndNotNull(t),"@param `item` must be informed."),this.Html.addMenuEntry(t)},e.prototype.shift=function(){this.Html.removeMenuEntry(Object.keys(this.Internal.items)[0])},e.prototype.setMap=function(t){ol.control.Control.prototype.setMap.call(this,t),t?this.Internal.init(t,this):this.Internal.removeListeners()},e}(ol.control.Control);return y}); +//# sourceMappingURL=ol3-contextmenu.js.map \ No newline at end of file diff --git a/build/ol3-contextmenu.js.map b/build/ol3-contextmenu.js.map new file mode 100644 index 0000000..d728ed1 --- /dev/null +++ b/build/ol3-contextmenu.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["?"],"names":["global","factory","exports","module","define","amd","ContextMenu","this","namespace","container_class","separator_class","submenu_class","hidden_class","icon_class","zoom_in_class","zoom_out_class","ol_unselectable_class","eventType","BEFOREOPEN","OPEN","CLOSE","ADD_MENU_ENTRY","CONTEXTMENU","HOVER","CLASSNAME","container","separator","submenu","hidden","icon","zoomIn","zoomOut","OL_unselectable","defaultOptions","width","scrollAt","defaultItems","text","classname","join","callback","obj","map","view","getView","pan","ol","animation","duration","source","getCenter","zoom","resolution","getResolution","beforeRender","setCenter","coordinate","setZoom","getZoom","utils","isNumeric","str","test","classRegex","RegExp","addClass","element","timeout","this$1","Array","isArray","forEach","each","array","split","i","length","hasClass","_addClass","el","klass","classList","add","className","trim","window","setTimeout","_removeClass","removeClass","remove","replace","c","contains","toggleClass","toggle","$","id","substr","document","getElementById","isElement","HTMLElement","nodeType","nodeName","find","selector","context","find_all","simpleRe","periodRe","slice","prototype","matches","call","getElementsByClassName","getElementsByTagName","querySelectorAll","offset","rect","getBoundingClientRect","docEl","documentElement","left","pageXOffset","clientLeft","top","pageYOffset","clientTop","offsetWidth","height","offsetHeight","getViewportSize","w","innerWidth","clientWidth","h","innerHeight","clientHeight","getAllChildren","node","tag","isEmpty","emptyArray","pop","removeAllChildren","firstChild","removeChild","mergeOptions","obj1","obj2","obj3","attr1","attr2","createFragment","html","frag","createDocumentFragment","temp","createElement","innerHTML","appendChild","str_test","indexOf","getUniqueId","Math","random","toString","isDefAndNotNull","val","assertEqual","a","b","message","Error","assert","condition","Internal","base","Base","undefined","mapElement","coordinateClicked","pixelClicked","lineHeight","items","opened","options","lastLeft","eventHandler","handleEvent","bind","init","getTargetElement","setListeners","Html","createMenu","getItemsLength","cloneAndGetLineHeight","count","Object","keys","k","getPixelClicked","getCoordinateClicked","positionContainer","pixel","map_size","getSize","map_w","map_h","space_left_h","space_left_w","menu_size","round","subs","style","right","bottom","sub","viewport","sub_offset","sub_height","sub_top","openMenu","dispatchEvent","type","closeMenu","addEventListener","removeListeners","removeEventListener","evt","this_","getEventCoordinate","getEventPixel","disabled","stopPropagation","preventDefault","target","e","setItemListener","li","index","data","createContainer","ul","klasses","push","parseInt","concat","addMenuEntry","item","generateHtmlAndPublish","parent","childNodes","setAttribute","removeMenuEntry","cloned","cloneNode","frag2","element2","parentNode","superclass","opt_options","default_items","__proto__","create","constructor","clear","close","enable","disable","getDefaultItems","extend","arr","isOpened","isOpen","updatePosition","shift","setMap","control","Control"],"mappings":";;;;;;CAOC,SAAUA,EAAQC,GACC,gBAAZC,UAA0C,mBAAXC,QAAyBA,OAAOD,QAAUD,IAC9D,kBAAXG,SAAyBA,OAAOC,IAAMD,OAAOH,GACnDD,EAAOM,YAAcL,KACrBM,KAAM,WAAe,YAEvB,IAAIC,GAAY,cACZC,EAAkB,aAClBC,EAAkB,aAClBC,EAAgB,WAChBC,EAAe,UACfC,EAAa,QACbC,EAAgB,WAChBC,EAAiB,YACjBC,EAAwB,kBAExBC,GAIFC,WAAY,aAIZC,KAAM,OAINC,MAAO,QAIPC,eAAgB,iBAIhBC,YAAa,cAIbC,MAAO,aAQLC,GACFC,UAAkBjB,EAAYC,EAC9BiB,UAAkBlB,EAAYE,EAC9BiB,QAAkBnB,EAAYG,EAC9BiB,OAAkBpB,EAAYI,EAC9BiB,KAAkBrB,EAAYK,EAC9BiB,OAAkBtB,EAAYM,EAC9BiB,QAAkBvB,EAAYO,EAC9BiB,gBAAkBhB,GAGhBiB,GACFC,MAAO,IACPC,SAAU,EACVlB,UAAWA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BxD,EAAKnE,UAAU+J,QAAU,WACvBvQ,KAAKmO,UAAW,GAMlBxD,EAAKnE,UAAUgK,gBAAkB,WAC/B,MAAO3O,IAQT8I,EAAKnE,UAAUiK,OAAS,SAAiBC,GACvCtN,EAAMmH,OAAOzG,MAAMC,QAAQ2M,GAAM,oCACjCA,EAAI1M,QAAQhE,KAAK+O,KAAM/O,OAOzB2K,EAAKnE,UAAUmK,SAAW,WACxB,MAAO3Q,MAAK4Q,UAGdjG,EAAKnE,UAAUoK,OAAS,WACtB,MAAO5Q,MAAKyK,SAASS,QAMvBP,EAAKnE,UAAUqK,eAAiB,SAAyBvE,GACvDlJ,EAAMmH,OAAOzG,MAAMC,QAAQuI,GAAQ,sCAC/BtM,KAAK4Q,UACP5Q,KAAKyK,SAAS4B,kBAAkBC,IAOpC3B,EAAKnE,UAAUgC,IAAM,WACnB,GAAIyD,GAAOD,OAAOC,KAAKjM,KAAKyK,SAASQ,MACrCjL,MAAK2L,KAAK6D,gBAAgBvD,EAAKA,EAAK5H,OAAS,KAO/CsG,EAAKnE,UAAUuI,KAAO,SAAeI,GACnC/L,EAAMmH,OACFnH,EAAM4G,gBAAgBmF,GAAO,mCACjCnP,KAAK2L,KAAKuD,aAAaC,IAMzBxE,EAAKnE,UAAUsK,MAAQ,WACrB9Q,KAAK2L,KAAK6D,gBAAgBxD,OAAOC,KAAKjM,KAAKyK,SAASQ,OAAO,KAM7DN,EAAKnE,UAAUuK,OAAS,SAAiB5O,GACvCI,GAAGyO,QAAQC,QAAQzK,UAAUuK,OAAOrK,KAAK1G,KAAMmC,GAC3CA,EAEFnC,KAAKyK,SAASe,KAAKrJ,EAAKnC,MAGxBA,KAAKyK,SAASoD,mBAIXlD,GACPpI,GAAGyO,QAAQC,QAEb,OAAOtG","file":"ol3-contextmenu.js"} \ No newline at end of file diff --git a/build/ol3-contextmenu.min.css b/build/ol3-contextmenu.min.css index 61bec36..23b9393 100644 --- a/build/ol3-contextmenu.min.css +++ b/build/ol3-contextmenu.min.css @@ -1,8 +1,7 @@ -/** +/*! + * ol3-contextmenu - v2.4.1 * Custom Context Menu for Openlayers 3 * https://github.com/jonataswalker/ol3-contextmenu - * Version: v2.4.0 - * Built: 2016-11-17T16:44:59-02:00 + * Built: Fri Jan 27 2017 07:46:22 GMT-0200 (BRST) */ - -.ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:rgba(0,0,0,.2) 3px 3px 5px;box-sizing:border-box}.ol-ctx-menu-container a,.ol-ctx-menu-container div,.ol-ctx-menu-container img,.ol-ctx-menu-container li,.ol-ctx-menu-container span,.ol-ctx-menu-container ul{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container ::after,.ol-ctx-menu-container ::before{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;-webkit-transition-delay:0s;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-submenu::after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover::after{border-color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.75),transparent);background-image:linear-gradient(to left,transparent,rgba(0,0,0,.75),transparent)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:left center}.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=)}.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC)} \ No newline at end of file +.ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,.2);box-sizing:border-box}.ol-ctx-menu-container a,.ol-ctx-menu-container div,.ol-ctx-menu-container img,.ol-ctx-menu-container li,.ol-ctx-menu-container span,.ol-ctx-menu-container ul{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container :after,.ol-ctx-menu-container :before{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;-webkit-transition-delay:0s;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.75),transparent);background-image:linear-gradient(270deg,transparent,rgba(0,0,0,.75),transparent)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:0}.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=")}.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC")} \ No newline at end of file diff --git a/package.json b/package.json index 0d48ab3..9c485af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ol3-contextmenu", - "version": "2.4.0", + "version": "2.4.1", "description": "Custom Context Menu for Openlayers 3", "main": "build/ol3-contextmenu.js", "author": "Jonatas Walker", diff --git a/src/js/base.js b/src/js/base.js index 5c339b8..6dd5661 100644 --- a/src/js/base.js +++ b/src/js/base.js @@ -84,9 +84,14 @@ export default class Base extends ol.control.Control { } /** - * Am I opened?. + * bad english + * keep it (for a while) to not break changes */ isOpened() { + return this.isOpen(); + } + + isOpen() { return this.Internal.opened; } @@ -95,7 +100,7 @@ export default class Base extends ol.control.Control { */ updatePosition(pixel) { utils.assert(Array.isArray(pixel), '@param `pixel` should be an Array.'); - if (this.isOpened()) { + if (this.isOpen()) { this.Internal.positionContainer(pixel); } } diff --git a/test/spec/contextmenu.js b/test/spec/contextmenu.js index c6de377..7fa96d6 100644 --- a/test/spec/contextmenu.js +++ b/test/spec/contextmenu.js @@ -167,17 +167,17 @@ casper.test.begin('Assert API Methods', 9, function (test) { default_items.length + 1, 'Ok, push() method'); }); - // isOpened() + // isOpen() closeAndRightClick(); casper.waitFor(function () { return this.evaluate(function () { - window.opened = window.contextmenu.isOpened(); + window.opened = window.contextmenu.isOpen(); return window.opened === true; }); }, function then() { - test.pass('Ok, #isOpened method'); + test.pass('Ok, #isOpen method'); }, function timeout() { - test.fail('Failed #isOpened method'); + test.fail('Failed #isOpen method'); }); casper.run(function () {