From: Tom MacWright Date: Mon, 10 Jun 2013 19:40:59 +0000 (-0700) Subject: Prevent click propagation on ui panes X-Git-Tag: live~5402^2~59 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/2a9286a16a0ca0e6aa025b13771d3118040b9d60 Prevent click propagation on ui panes --- diff --git a/app/assets/javascripts/index/map_ui.js b/app/assets/javascripts/index/map_ui.js index 1360c7024..6d98f6642 100644 --- a/app/assets/javascripts/index/map_ui.js +++ b/app/assets/javascripts/index/map_ui.js @@ -15,6 +15,10 @@ OSM.MapUI = L.Control.extend({ link.title = 'Layers'; this._uiPane = L.DomUtil.create('div', 'leaflet-map-ui', map._container); + L.DomEvent + .on(this._uiPane, 'click', L.DomEvent.stopPropagation) + .on(this._uiPane, 'click', L.DomEvent.preventDefault) + .on(this._uiPane, 'dblclick', L.DomEvent.preventDefault); $(link).on('click', $.proxy(this.toggleLayers, this)); }, @@ -27,12 +31,12 @@ OSM.MapUI = L.Control.extend({ if ($(this._uiPane).is(':visible')) { $(this._uiPane).hide(); - controlContainer.css({paddingRight: '0'}) + controlContainer.css({paddingRight: '0'}); } else { $(this._uiPane) .show() .html(JST["templates/map/layers"]()); - controlContainer.css({paddingRight: '200px'}) + controlContainer.css({paddingRight: '200px'}); } } }); diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index eced07a7c..7d5eb0cc9 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -19,6 +19,15 @@ L.Control.Share = L.Control.extend({ link.title = this.options.title; this._uiPane = L.DomUtil.create('div', 'leaflet-map-ui', map._container); + + L.DomEvent + .on(this._uiPane, 'click', L.DomEvent.stopPropagation) + .on(this._uiPane, 'click', L.DomEvent.preventDefault) + .on(this._uiPane, 'dblclick', L.DomEvent.preventDefault); + + var h2 = L.DomUtil.create('h2', '', this._uiPane); + h2.innerHTML = I18n.t('javascripts.share.title'); + this._linkInput = L.DomUtil.create('input', '', this._uiPane); L.DomEvent