Hide the control if the Fullscreen API is not supported

This commit is contained in:
Frederic Junod
2013-04-10 10:59:38 +02:00
committed by Tom Payne
parent 8206cf111f
commit 7b0e036b83
4 changed files with 17 additions and 4 deletions

View File

@@ -41,7 +41,8 @@ ol.control.FullScreen = function(opt_options) {
this.handleFullScreenChange_, false, this);
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
'class': this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE
'class': this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE +
(!goog.dom.fullscreen.isSupported() ? ol.css.CLASS_UNSUPPORTED : '')
}, aElement);
goog.base(this, {
@@ -65,14 +66,14 @@ goog.inherits(ol.control.FullScreen, ol.control.Control);
* @private
*/
ol.control.FullScreen.prototype.handleClick_ = function(browserEvent) {
if (!goog.dom.fullscreen.isSupported()) {
return;
}
browserEvent.preventDefault();
var map = this.getMap();
if (goog.isNull(map)) {
return;
}
if (!goog.dom.fullscreen.isSupported()) {
return;
}
if (goog.dom.fullscreen.isFullScreen()) {
goog.dom.fullscreen.exitFullScreen();
} else {

View File

@@ -7,3 +7,11 @@ goog.provide('ol.css');
* @const {string}
*/
ol.css.CLASS_UNSELECTABLE = 'ol-unselectable';
/**
* The CSS class for unsupported feature.
*
* @const {string}
*/
ol.css.CLASS_UNSUPPORTED = 'ol-unsupported';