From 10aebb58d294b78148af2b03180f15a1cbaf53b4 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 24 Apr 2017 09:32:36 +0200 Subject: [PATCH] Allow user selection in overlay container --- css/ol.css | 9 +++++++-- src/ol/css.js | 8 ++++++++ src/ol/overlay.js | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/css/ol.css b/css/ol.css index a3800baf14..36b63fbd8e 100644 --- a/css/ol.css +++ b/css/ol.css @@ -37,13 +37,18 @@ .ol-viewport, .ol-unselectable { -webkit-touch-callout: none; -webkit-user-select: none; - -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-tap-highlight-color: rgba(0,0,0,0); } - +.ol-selectable { + -webkit-touch-callout: default; + -webkit-user-select: auto; + -moz-user-select: auto; + -ms-user-select: auto; + user-select: auto; +} .ol-control { position: absolute; background-color: rgba(255,255,255,0.4); diff --git a/src/ol/css.js b/src/ol/css.js index 2d4247be14..915893ea34 100644 --- a/src/ol/css.js +++ b/src/ol/css.js @@ -10,6 +10,14 @@ goog.provide('ol.css'); ol.css.CLASS_HIDDEN = 'ol-hidden'; +/** + * The CSS class that we'll give the DOM elements to have them selectable. + * + * @const + * @type {string} + */ +ol.css.CLASS_SELECTABLE = 'ol-selectable'; + /** * The CSS class that we'll give the DOM elements to have them unselectable. * diff --git a/src/ol/overlay.js b/src/ol/overlay.js index 4be6ff6e3e..f69f4dd808 100644 --- a/src/ol/overlay.js +++ b/src/ol/overlay.js @@ -4,6 +4,7 @@ goog.require('ol'); goog.require('ol.MapEventType'); goog.require('ol.Object'); goog.require('ol.OverlayPositioning'); +goog.require('ol.css'); goog.require('ol.dom'); goog.require('ol.events'); goog.require('ol.extent'); @@ -58,7 +59,7 @@ ol.Overlay = function(options) { * @type {Element} */ this.element_ = document.createElement('DIV'); - this.element_.className = 'ol-overlay-container'; + this.element_.className = 'ol-overlay-container ' + ol.css.CLASS_SELECTABLE; this.element_.style.position = 'absolute'; /**