Add ol.BrowserFeature.HAS_FULLSCREEN constant

This commit is contained in:
Frederic Junod
2014-02-26 14:40:04 +01:00
parent f9a9f70a43
commit 5a940c207a
3 changed files with 14 additions and 2 deletions

View File

@@ -3,5 +3,6 @@
@exportProperty ol.BrowserFeature.HAS_CANVAS
@exportProperty ol.BrowserFeature.HAS_DEVICE_ORIENTATION
@exportProperty ol.BrowserFeature.HAS_GEOLOCATION
@exportProperty ol.BrowserFeature.HAS_FULLSCREEN
@exportProperty ol.BrowserFeature.HAS_TOUCH
@exportProperty ol.BrowserFeature.HAS_WEBGL

View File

@@ -2,6 +2,7 @@ goog.provide('ol.BrowserFeature');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.dom.fullscreen');
goog.require('goog.userAgent');
goog.require('ol.webgl');
@@ -141,6 +142,15 @@ ol.BrowserFeature.HAS_DEVICE_ORIENTATION =
ol.BrowserFeature.HAS_DOM = ol.ENABLE_DOM;
/**
* True if browser supports the fullscreen API.
* @const
* @type {boolean}
* @todo stability experimental
*/
ol.BrowserFeature.HAS_FULLSCREEN = goog.dom.fullscreen.isSupported();
/**
* Is HTML5 geolocation supported in the current browser?
* @const

View File

@@ -8,6 +8,7 @@ goog.require('goog.dom.fullscreen');
goog.require('goog.dom.fullscreen.EventType');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.BrowserFeature');
goog.require('ol.control.Control');
goog.require('ol.css');
@@ -64,7 +65,7 @@ ol.control.FullScreen = function(opt_options) {
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
'class': this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
(!goog.dom.fullscreen.isSupported() ? ol.css.CLASS_UNSUPPORTED : '')
(!ol.BrowserFeature.HAS_FULLSCREEN ? ol.css.CLASS_UNSUPPORTED : '')
}, button);
goog.base(this, {
@@ -87,7 +88,7 @@ goog.inherits(ol.control.FullScreen, ol.control.Control);
* @private
*/
ol.control.FullScreen.prototype.handleClick_ = function(browserEvent) {
if (!goog.dom.fullscreen.isSupported()) {
if (!ol.BrowserFeature.HAS_FULLSCREEN) {
return;
}
browserEvent.preventDefault();