diff --git a/dist/ol-ext.js b/dist/ol-ext.js index 775873fc..cb41fa0c 100644 --- a/dist/ol-ext.js +++ b/dist/ol-ext.js @@ -7748,7 +7748,9 @@ ol.inherits(ol.interaction.LongTouch, ol.interaction.Interaction); /** Offset interaction for offseting feature geometry * @constructor * @extends {ol.interaction.Pointer} - * @fires + * @fires offsetstart + * @fires offsetting + * @fires offsetend * @param {any} options * @param {ol.layer.Vector | Array} options.layers list of feature to transform * @param {ol.Collection.} options.features collection of feature to transform @@ -7911,6 +7913,7 @@ ol.interaction.Offset.prototype.handleUpEvent_ = function(e) { }; /** * @param {ol.MapBrowserEvent} e Event. + * @private */ ol.interaction.Offset.prototype.handleMoveEvent_ = function(e) { var f = this.getFeatureAtPixel_(e); @@ -11564,172 +11567,9 @@ ol.geom.LineString.prototype.splitAt = function(pt, tol) else return [this]; } /** Offset a polyline - * @param {Array} coords * @param {Number} offset - * @return {Array} pt points to split the line -* @param {Number} tol distance tolerance for 2 points to be equal -*/ -ol.geom.LineString.prototype.splitAt = function(pt, tol) -{ if (!pt) return [this]; - if (!tol) tol = 1e-10; - // Test if list of points - if (pt.length && pt[0].length) - { var result = [this]; - for (var i=0; i1) c.push (new ol.geom.LineString(ci)); - if (c.length) return c; - else return [this]; -} -/** Offset a polyline - * @param {Array} resulting coord * @see http://stackoverflow.com/a/11970006/796832 * @see https://drive.google.com/viewerng/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxqa2dhZGdldHN0b3JlfGd4OjQ4MzI5M2Y0MjNmNzI2MjY */ diff --git a/dist/ol-ext.min.js b/dist/ol-ext.min.js index 3b3b0377..73d0c6b0 100644 --- a/dist/ol-ext.min.js +++ b/dist/ol-ext.min.js @@ -6,4 +6,4 @@ * @see https://github.com/Viglino/ol-ext#, * @license BSD-3-Clause */ -ol.control.Search=function(t){var e=this;t||(t={}),void 0==t.typing&&(t.typing=300);var o=document.createElement("DIV"),i=(t.className||"")+" ol-search";t.target||(i+=" ol-unselectable ol-control ol-collapsed",this.button=document.createElement("BUTTON"),this.button.setAttribute("type","button"),this.button.setAttribute("title",t.label||"search"),this.button.addEventListener("click",function(){if(o.classList.toggle("ol-collapsed"),!o.classList.contains("ol-collapsed")){o.querySelector("input.search").focus();for(var t=o.querySelectorAll("li"),e=0;e=0)(s=l)?(r&&clearTimeout(r),r=setTimeout(function(){if(s.length>=e.get("minLength")){var t=e.autocomplete(s,function(t){e.drawList_(t)});t&&e.drawList_(t)}else e.drawList_()},t.typing)):e.drawList_();else{(n=o.querySelector("ul.autocomplete li"))&&n.classList.remove("select")}else o.classList.contains("ol-control")&&a.blur(),n.classList.remove("select"),s=l,e.select(e._list[n.getAttribute("data-search")]);else e.drawList_()};a.addEventListener("keyup",n),a.addEventListener("search",n),a.addEventListener("cut",n),a.addEventListener("paste",n),a.addEventListener("input",n),a.addEventListener("blur",function(){setTimeout(function(){o.classList.add("ol-collapsed")},200)}),a.addEventListener("focus",function(){o.classList.remove("ol-collapsed")}),o.appendChild(a);var l=document.createElement("UL");l.classList.add("autocomplete"),o.appendChild(l),ol.control.Control.call(this,{element:o,target:t.target}),"function"==typeof t.getTitle&&(this.getTitle=t.getTitle),"function"==typeof t.autocomplete&&(this.autocomplete=t.autocomplete),this.set("minLength",t.minLength||1),this.set("maxItems",t.maxItems||10)},ol.inherits(ol.control.Search,ol.control.Control),ol.control.Search.prototype.getTitle=function(t){return t.name||"No title"},ol.control.Search.prototype.search=function(){var t=this.element.querySelector("input.search");this._triggerCustomEvent("search",t)},ol.control.Search.prototype._triggerCustomEvent=function(t,e){var o;window.CustomEvent?o=new CustomEvent(t):(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,{}),e.dispatchEvent(o)},ol.control.Search.prototype.setInput=function(t,e){var o=this.element.querySelector("input.search");o.value=t,e&&this._triggerCustomEvent("keyup",o)},ol.control.Search.prototype.select=function(t){this.dispatchEvent({type:"select",search:t})},ol.control.Search.prototype.autocomplete=function(t,e){return e([]),!1},ol.control.Search.prototype.drawList_=function(t){var e=this.element.querySelector("ul.autocomplete");if(e.innerHTML="",t){var o=this,i=Math.min(o.get("maxItems"),t.length);this._list=[];for(var r=0;r=200&&this.status<400){var t=JSON.parse(this.response);e(i.handleResponse(t))}else console.log(r+s,arguments)},n.onerror=function(){i._request=null,i.element.classList.remove("searching"),console.log(r+s,arguments)},n.send()},ol.control.SearchJSON.prototype.requestData=function(t){return{q:t}},ol.control.SearchJSON.prototype.handleResponse=function(t){return t},ol.control.SearchPhoton=function(t){(t=t||{}).url=t.url||"http://photon.komoot.de/api/",ol.control.SearchJSON.call(this,t),this.set("lang",t.lang),this.set("position",t.position),this.set("copy","© OpenStreetMap contributors")},ol.inherits(ol.control.SearchPhoton,ol.control.SearchJSON),ol.control.SearchPhoton.prototype.getTitle=function(t){var e=t.properties;return(e.housenumber||"")+" "+(e.street||e.name||"")+" "+(e.postcode||"")+" "+(e.city||"")+" ("+e.country+")"},ol.control.SearchPhoton.prototype.requestData=function(t){var e={q:t,lang:this.get("lang"),limit:this.get("maxItems")};if(this.get("position")){var o=this.getMap().getView(),i=new ol.geom.Point(o.getCenter());i=i.transform(o.getProjection(),"EPSG:4326").getCoordinates(),e.lon=i[0],e.lat=i[1]}return e},ol.control.SearchPhoton.prototype.handleResponse=function(t,e){return t.features},ol.control.SearchPhoton.prototype.equalFeatures=function(t,e){return this.getTitle(t)===this.getTitle(e)&&t.geometry.coordinates[0]===e.geometry.coordinates[0]&&t.geometry.coordinates[1]===e.geometry.coordinates[1]},ol.control.SearchPhoton.prototype.select=function(t){var e=t.geometry.coordinates;try{e=ol.proj.transform(t.geometry.coordinates,"EPSG:4326",this.getMap().getView().getProjection())}catch(t){}this.dispatchEvent({type:"select",search:t,coordinate:e})},ol.control.LayerSwitcher=function(t){t=t||{};var e,o=this;this.dcount=0,this.show_progress=t.show_progress,this.oninfo="function"==typeof t.oninfo?t.oninfo:null,this.onextent="function"==typeof t.onextent?t.onextent:null,this.hasextent=t.extent||t.onextent,this.hastrash=t.trash,this.reordering=!1!==t.reordering,"function"==typeof t.displayInLayerSwitcher&&(this.displayInLayerSwitcher=t.displayInLayerSwitcher),t.target?e=$("
").addClass(t.switcherClass||"ol-layerswitcher"):(e=$("
").addClass((t.switcherClass||"ol-layerswitcher")+" ol-unselectable ol-control ol-collapsed"),this.button=$("