From 62921c05984e4b59f76844519baca06ca6d23804 Mon Sep 17 00:00:00 2001 From: Patrick Arlt Date: Tue, 25 Feb 2014 10:26:58 -0800 Subject: [PATCH] fix for IE 10+11 on Win 8 --- dist/esri-leaflet-geocoder-src.css | 2 +- dist/esri-leaflet-geocoder-src.js | 14 +++++++------- dist/esri-leaflet-geocoder.css | 2 +- dist/esri-leaflet-geocoder.js | 4 ++-- src/esri-leaflet-geocoder.js | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dist/esri-leaflet-geocoder-src.css b/dist/esri-leaflet-geocoder-src.css index 607ecae..20a362e 100644 --- a/dist/esri-leaflet-geocoder-src.css +++ b/dist/esri-leaflet-geocoder-src.css @@ -1,4 +1,4 @@ -/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-24 +/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-25 * Copyright (c) 2014 Environmental Systems Research Institute, Inc. * Apache License*/ diff --git a/dist/esri-leaflet-geocoder-src.js b/dist/esri-leaflet-geocoder-src.js index 7e2d9d4..0eb0025 100644 --- a/dist/esri-leaflet-geocoder-src.js +++ b/dist/esri-leaflet-geocoder-src.js @@ -1,4 +1,4 @@ -/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-24 +/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-25 * Copyright (c) 2014 Environmental Systems Research Institute, Inc. * Apache License*/ @@ -110,12 +110,7 @@ useMapBounds: 11, collapseAfterResult: true, expanded: false, - maxResults: 25, - containerClass: "geocoder-control", - inputClass: "geocoder-control-input leaflet-bar", - suggestionsWrapperClass: "geocoder-control-suggestions leaflet-bar", - selectedSuggestionClass: "geocoder-control-selected", - expandedClass: "geocoder-control-expanded" + maxResults: 25 }, initialize: function (options) { L.Util.setOptions(this, options); @@ -264,6 +259,11 @@ L.DomUtil.addClass(this._container, "geocoder-control-expanded"); }, this); + L.DomEvent.addListener(this._container, "click", function(e){ + L.DomUtil.addClass(this._container, "geocoder-control-expanded"); + this._input.focus(); + }, this); + L.DomEvent.addListener(this._suggestions, "mousedown", function(e){ var suggestionItem = e.target || e.srcElement; this._geocode(suggestionItem.innerHTML, suggestionItem["data-magic-key"]); diff --git a/dist/esri-leaflet-geocoder.css b/dist/esri-leaflet-geocoder.css index adb0474..d099e96 100644 --- a/dist/esri-leaflet-geocoder.css +++ b/dist/esri-leaflet-geocoder.css @@ -1,3 +1,3 @@ -/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-24 +/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-25 * Copyright (c) 2014 Environmental Systems Research Institute, Inc. * Apache License*/.geocoder-control-input{background-color:#fff;background-repeat:no-repeat;background-image:url(img/search.png);background-size:14px 14px;border:0;padding:0;text-indent:6px;font-size:13px;height:26px;width:26px;line-height:26px;background-position:center center;-webkit-transition:all .125s ease-in;-moz-transition:all .125s ease-in;-ms-transition:all .125s ease-in;-o-transition:all .125s ease-in;transition:all .125s ease-in;cursor:pointer}.geocoder-control{width:26px;-webkit-transition:all .175s ease-in;-moz-transition:all .175s ease-in;-ms-transition:all .175s ease-in;-o-transition:all .175s ease-in;transition:all .175s ease-in}.geocoder-control-expanded,.geocoder-control-expanded .geocoder-control-input{width:275px}.geocoder-control.geocoder-control-expanded .geocoder-control-input{background-position:98% center}.geocoder-control-input.geocoder-control-loading{background-image:url(img/loading.gif);background-size:16px 16px}@media only screen and (min--moz-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/1),only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-device-pixel-ratio:2){.geocoder-control-input{background-image:url(img/search@2x.png)}.geocoder-control-input.geocoder-control-loading{background-image:url(img/loading@2x.gif)}}.geocoder-control-input:focus{outline:0;cursor:text}.geocoder-control-input::-ms-clear{display:none}.geocoder-control-suggestions{width:100%;list-style:none;padding:0;margin:10px 0 0;overflow:hidden;display:none}.geocoder-control-suggestions .geocoder-control-suggestion{font-size:13px;padding:7px;background:#fff;border-top:1px solid #f1f1f1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.geocoder-control-suggestions .geocoder-control-suggestion:first-child{border:0}.geocoder-control-suggestions .geocoder-control-suggestion.geocoder-control-selected,.geocoder-control-suggestions .geocoder-control-suggestion:hover{background:#00c0ff;border-color:#00c0ff}.leaflet-touch .geocoder-control-input{width:30px;height:30px;line-height:30px}.leaflet-touch .geocoder-control-expanded,.geocoder-control-expanded .geocoder-control-input{width:275px}.leaflet-oldie .geocoder-control-input{border:1px solid #999} \ No newline at end of file diff --git a/dist/esri-leaflet-geocoder.js b/dist/esri-leaflet-geocoder.js index ba04dcb..ad2f3ca 100644 --- a/dist/esri-leaflet-geocoder.js +++ b/dist/esri-leaflet-geocoder.js @@ -1,4 +1,4 @@ -/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-24 +/*! esri-leaflet-geocoder - v0.0.1 - 2014-02-25 * Copyright (c) 2014 Environmental Systems Research Institute, Inc. * Apache License*/ -!function(a){function b(a,b){b=b||window;for(var c,d=b,e=a.split(".");c=e.shift();)d[c]||(d[c]={}),d=d[c];return d}function c(a){var b="?";for(var c in a)if(a.hasOwnProperty(c)){var d=c,e=a[c];b+=encodeURIComponent(d),b+="=",b+=encodeURIComponent(e),b+="&"}return b.substring(0,b.length-1)}function d(b){var c=new a.LatLng(b.ymin,b.xmin),d=new a.LatLng(b.ymax,b.xmax);return new a.LatLngBounds(c,d)}b("L.esri.Services.Geocoding"),b("L.esri.Controls.Geosearch"),a.esri.Services.Geocoding=a.Class.extend({includes:a.Mixin.Events,options:{url:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/",outFields:"Subregion, Region, PlaceName, Match_addr, Country, Addr_type, City, Place_addr"},initialize:function(b){a.Util.setOptions(this,b)},request:function(b,d,e){var f="c"+(1e9*Math.random()).toString(36).replace(".","_");d.f="json",d.callback="L.esri.Services.Geocoding._callback."+f;var g=document.createElement("script");g.type="text/javascript",g.src=b+c(d),g.id=f,this.fire("loading"),a.esri.Services.Geocoding._callback[f]=a.Util.bind(function(b){this.fire("load"),e(b),document.body.removeChild(g),delete a.esri.Services.Geocoding._callback[f]},this),document.body.appendChild(g)},geocode:function(b,c,d){var e={outFields:this.options.outFields},f=a.extend(e,c);f.text=b,this.request(this.options.url+"find",f,d)},suggest:function(a,b,c){var d=b||{};d.text=a,this.request(this.options.url+"suggest",d,c)}}),a.esri.Services.geocoding=function(b){return new a.esri.Services.Geocoding(b)},a.esri.Services.Geocoding._callback={},a.esri.Controls.Geosearch=a.Control.extend({includes:a.Mixin.Events,options:{position:"topleft",zoomToResult:!0,useMapBounds:11,collapseAfterResult:!0,expanded:!1,maxResults:25,containerClass:"geocoder-control",inputClass:"geocoder-control-input leaflet-bar",suggestionsWrapperClass:"geocoder-control-suggestions leaflet-bar",selectedSuggestionClass:"geocoder-control-selected",expandedClass:"geocoder-control-expanded"},initialize:function(b){a.Util.setOptions(this,b),this._service=new a.esri.Services.Geocoding},_processMatch:function(b,c){var e=c.feature.attributes,f=d(c.extent);return{text:b,bounds:f,latlng:new a.LatLng(c.feature.geometry.y,c.feature.geometry.x),name:e.PlaceName,match:e.Addr_type,country:e.Country,region:e.Region,subregion:e.Subregion,city:e.City,address:e.Place_addr?e.Place_addr:e.Match_addr}},_geocode:function(b,c){var d={};if(c)d.magicKey=c;else{var e=this._map.getBounds(),f=e.getCenter(),g=e.getNorthWest();d.bbox=e.toBBoxString(),d.maxLocations=this.options.maxResults,d.location=f.lng+","+f.lat,d.distance=Math.min(Math.max(f.distanceTo(g),2e3),5e4)}a.DomUtil.addClass(this._input,"geocoder-control-loading"),this.fire("loading"),this._service.geocode(b,d,a.Util.bind(function(c){if(c.error)this.fire("error",{code:c.error.code,message:c.error.messsage});else if(c.locations.length){var d,e=[],f=new a.LatLngBounds;for(d=c.locations.length-1;d>=0;d--)e.push(this._processMatch(b,c.locations[d]));for(d=e.length-1;d>=0;d--)f.extend(e[d].bounds);this.fire("results",{results:e,bounds:f,latlng:f.getCenter()}),this.options.zoomToResult&&this._map.fitBounds(f)}else this.fire("results",{results:[],bounds:null,latlng:null,text:b});a.DomUtil.removeClass(this._input,"geocoder-control-loading"),this.fire("load"),this.clear(),this._input.blur()},this))},_suggest:function(b){a.DomUtil.addClass(this._input,"geocoder-control-loading");var c={};if(this.options.useMapBounds===!0||this._map.getZoom()>=this.options.useMapBounds){var d=this._map.getBounds(),e=d.getCenter(),f=d.getNorthWest();c.location=e.lng+","+e.lat,c.distance=Math.min(Math.max(e.distanceTo(f),2e3),5e4)}this._service.suggest(b,c,a.Util.bind(function(b){if(this._input.value){if(this._suggestions.innerHTML="",this._suggestions.style.display="none",b.suggestions){this._suggestions.style.display="block";for(var c=0;c=0;d--)e.push(this._processMatch(b,c.locations[d]));for(d=e.length-1;d>=0;d--)f.extend(e[d].bounds);this.fire("results",{results:e,bounds:f,latlng:f.getCenter()}),this.options.zoomToResult&&this._map.fitBounds(f)}else this.fire("results",{results:[],bounds:null,latlng:null,text:b});a.DomUtil.removeClass(this._input,"geocoder-control-loading"),this.fire("load"),this.clear(),this._input.blur()},this))},_suggest:function(b){a.DomUtil.addClass(this._input,"geocoder-control-loading");var c={};if(this.options.useMapBounds===!0||this._map.getZoom()>=this.options.useMapBounds){var d=this._map.getBounds(),e=d.getCenter(),f=d.getNorthWest();c.location=e.lng+","+e.lat,c.distance=Math.min(Math.max(e.distanceTo(f),2e3),5e4)}this._service.suggest(b,c,a.Util.bind(function(b){if(this._input.value){if(this._suggestions.innerHTML="",this._suggestions.style.display="none",b.suggestions){this._suggestions.style.display="block";for(var c=0;c