Rename _ol_control_FullScreen_ to FullScreen

This commit is contained in:
Tim Schaub
2017-12-14 12:58:47 -07:00
parent 681f1285f8
commit d9f8667d2b
5 changed files with 32 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js'; import _ol_control_ from '../src/ol/control.js';
import _ol_control_FullScreen_ from '../src/ol/control/FullScreen.js'; import FullScreen from '../src/ol/control/FullScreen.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import _ol_interaction_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.js'; import _ol_interaction_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -10,7 +10,7 @@ import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
var map = new _ol_Map_({ var map = new _ol_Map_({
controls: _ol_control_.defaults().extend([ controls: _ol_control_.defaults().extend([
new _ol_control_FullScreen_() new FullScreen()
]), ]),
interactions: _ol_interaction_.defaults().extend([ interactions: _ol_interaction_.defaults().extend([
new _ol_interaction_DragRotateAndZoom_() new _ol_interaction_DragRotateAndZoom_()

View File

@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js'; import _ol_control_ from '../src/ol/control.js';
import _ol_control_FullScreen_ from '../src/ol/control/FullScreen.js'; import FullScreen from '../src/ol/control/FullScreen.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -13,7 +13,7 @@ var view = new _ol_View_({
var map = new _ol_Map_({ var map = new _ol_Map_({
controls: _ol_control_.defaults().extend([ controls: _ol_control_.defaults().extend([
new _ol_control_FullScreen_({ new FullScreen({
source: 'fullscreen' source: 'fullscreen'
}) })
]), ]),

View File

@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js'; import _ol_control_ from '../src/ol/control.js';
import _ol_control_FullScreen_ from '../src/ol/control/FullScreen.js'; import FullScreen from '../src/ol/control/FullScreen.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -13,7 +13,7 @@ var view = new _ol_View_({
var map = new _ol_Map_({ var map = new _ol_Map_({
controls: _ol_control_.defaults().extend([ controls: _ol_control_.defaults().extend([
new _ol_control_FullScreen_() new FullScreen()
]), ]),
layers: [ layers: [
new _ol_layer_Tile_({ new _ol_layer_Tile_({

View File

@@ -25,7 +25,7 @@ import _ol_events_EventType_ from '../events/EventType.js';
* @param {olx.control.FullScreenOptions=} opt_options Options. * @param {olx.control.FullScreenOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_control_FullScreen_ = function(opt_options) { var FullScreen = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
@@ -56,7 +56,7 @@ var _ol_control_FullScreen_ = function(opt_options) {
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen'; var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
var button = document.createElement('button'); var button = document.createElement('button');
button.className = this.cssClassName_ + '-' + _ol_control_FullScreen_.isFullScreen(); button.className = this.cssClassName_ + '-' + FullScreen.isFullScreen();
button.setAttribute('type', 'button'); button.setAttribute('type', 'button');
button.title = tipLabel; button.title = tipLabel;
button.appendChild(this.labelNode_); button.appendChild(this.labelNode_);
@@ -66,7 +66,7 @@ var _ol_control_FullScreen_ = function(opt_options) {
var cssClasses = this.cssClassName_ + ' ' + _ol_css_.CLASS_UNSELECTABLE + var cssClasses = this.cssClassName_ + ' ' + _ol_css_.CLASS_UNSELECTABLE +
' ' + _ol_css_.CLASS_CONTROL + ' ' + ' ' + _ol_css_.CLASS_CONTROL + ' ' +
(!_ol_control_FullScreen_.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : ''); (!FullScreen.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : '');
var element = document.createElement('div'); var element = document.createElement('div');
element.className = cssClasses; element.className = cssClasses;
element.appendChild(button); element.appendChild(button);
@@ -90,14 +90,14 @@ var _ol_control_FullScreen_ = function(opt_options) {
}; };
inherits(_ol_control_FullScreen_, Control); inherits(FullScreen, Control);
/** /**
* @param {Event} event The event to handle * @param {Event} event The event to handle
* @private * @private
*/ */
_ol_control_FullScreen_.prototype.handleClick_ = function(event) { FullScreen.prototype.handleClick_ = function(event) {
event.preventDefault(); event.preventDefault();
this.handleFullScreen_(); this.handleFullScreen_();
}; };
@@ -106,16 +106,16 @@ _ol_control_FullScreen_.prototype.handleClick_ = function(event) {
/** /**
* @private * @private
*/ */
_ol_control_FullScreen_.prototype.handleFullScreen_ = function() { FullScreen.prototype.handleFullScreen_ = function() {
if (!_ol_control_FullScreen_.isFullScreenSupported()) { if (!FullScreen.isFullScreenSupported()) {
return; return;
} }
var map = this.getMap(); var map = this.getMap();
if (!map) { if (!map) {
return; return;
} }
if (_ol_control_FullScreen_.isFullScreen()) { if (FullScreen.isFullScreen()) {
_ol_control_FullScreen_.exitFullScreen(); FullScreen.exitFullScreen();
} else { } else {
var element; var element;
if (this.source_) { if (this.source_) {
@@ -126,10 +126,10 @@ _ol_control_FullScreen_.prototype.handleFullScreen_ = function() {
element = map.getTargetElement(); element = map.getTargetElement();
} }
if (this.keys_) { if (this.keys_) {
_ol_control_FullScreen_.requestFullScreenWithKeys(element); FullScreen.requestFullScreenWithKeys(element);
} else { } else {
_ol_control_FullScreen_.requestFullScreen(element); FullScreen.requestFullScreen(element);
} }
} }
}; };
@@ -138,10 +138,10 @@ _ol_control_FullScreen_.prototype.handleFullScreen_ = function() {
/** /**
* @private * @private
*/ */
_ol_control_FullScreen_.prototype.handleFullScreenChange_ = function() { FullScreen.prototype.handleFullScreenChange_ = function() {
var button = this.element.firstElementChild; var button = this.element.firstElementChild;
var map = this.getMap(); var map = this.getMap();
if (_ol_control_FullScreen_.isFullScreen()) { if (FullScreen.isFullScreen()) {
button.className = this.cssClassName_ + '-true'; button.className = this.cssClassName_ + '-true';
replaceNode(this.labelActiveNode_, this.labelNode_); replaceNode(this.labelActiveNode_, this.labelNode_);
} else { } else {
@@ -158,11 +158,11 @@ _ol_control_FullScreen_.prototype.handleFullScreenChange_ = function() {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_control_FullScreen_.prototype.setMap = function(map) { FullScreen.prototype.setMap = function(map) {
Control.prototype.setMap.call(this, map); Control.prototype.setMap.call(this, map);
if (map) { if (map) {
this.listenerKeys.push(_ol_events_.listen(document, this.listenerKeys.push(_ol_events_.listen(document,
_ol_control_FullScreen_.getChangeType_(), FullScreen.getChangeType_(),
this.handleFullScreenChange_, this) this.handleFullScreenChange_, this)
); );
} }
@@ -171,7 +171,7 @@ _ol_control_FullScreen_.prototype.setMap = function(map) {
/** /**
* @return {boolean} Fullscreen is supported by the current platform. * @return {boolean} Fullscreen is supported by the current platform.
*/ */
_ol_control_FullScreen_.isFullScreenSupported = function() { FullScreen.isFullScreenSupported = function() {
var body = document.body; var body = document.body;
return !!( return !!(
body.webkitRequestFullscreen || body.webkitRequestFullscreen ||
@@ -184,7 +184,7 @@ _ol_control_FullScreen_.isFullScreenSupported = function() {
/** /**
* @return {boolean} Element is currently in fullscreen. * @return {boolean} Element is currently in fullscreen.
*/ */
_ol_control_FullScreen_.isFullScreen = function() { FullScreen.isFullScreen = function() {
return !!( return !!(
document.webkitIsFullScreen || document.mozFullScreen || document.webkitIsFullScreen || document.mozFullScreen ||
document.msFullscreenElement || document.fullscreenElement document.msFullscreenElement || document.fullscreenElement
@@ -195,7 +195,7 @@ _ol_control_FullScreen_.isFullScreen = function() {
* Request to fullscreen an element. * Request to fullscreen an element.
* @param {Node} element Element to request fullscreen * @param {Node} element Element to request fullscreen
*/ */
_ol_control_FullScreen_.requestFullScreen = function(element) { FullScreen.requestFullScreen = function(element) {
if (element.requestFullscreen) { if (element.requestFullscreen) {
element.requestFullscreen(); element.requestFullscreen();
} else if (element.msRequestFullscreen) { } else if (element.msRequestFullscreen) {
@@ -211,20 +211,20 @@ _ol_control_FullScreen_.requestFullScreen = function(element) {
* Request to fullscreen an element with keyboard input. * Request to fullscreen an element with keyboard input.
* @param {Node} element Element to request fullscreen * @param {Node} element Element to request fullscreen
*/ */
_ol_control_FullScreen_.requestFullScreenWithKeys = function(element) { FullScreen.requestFullScreenWithKeys = function(element) {
if (element.mozRequestFullScreenWithKeys) { if (element.mozRequestFullScreenWithKeys) {
element.mozRequestFullScreenWithKeys(); element.mozRequestFullScreenWithKeys();
} else if (element.webkitRequestFullscreen) { } else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
} else { } else {
_ol_control_FullScreen_.requestFullScreen(element); FullScreen.requestFullScreen(element);
} }
}; };
/** /**
* Exit fullscreen. * Exit fullscreen.
*/ */
_ol_control_FullScreen_.exitFullScreen = function() { FullScreen.exitFullScreen = function() {
if (document.exitFullscreen) { if (document.exitFullscreen) {
document.exitFullscreen(); document.exitFullscreen();
} else if (document.msExitFullscreen) { } else if (document.msExitFullscreen) {
@@ -240,7 +240,7 @@ _ol_control_FullScreen_.exitFullScreen = function() {
* @return {string} Change type. * @return {string} Change type.
* @private * @private
*/ */
_ol_control_FullScreen_.getChangeType_ = (function() { FullScreen.getChangeType_ = (function() {
var changeType; var changeType;
return function() { return function() {
if (!changeType) { if (!changeType) {
@@ -258,4 +258,4 @@ _ol_control_FullScreen_.getChangeType_ = (function() {
return changeType; return changeType;
}; };
})(); })();
export default _ol_control_FullScreen_; export default FullScreen;

View File

@@ -1,12 +1,12 @@
import _ol_control_FullScreen_ from '../../../../src/ol/control/FullScreen.js'; import FullScreen from '../../../../src/ol/control/FullScreen.js';
describe('ol.control.FullScreen', function() { describe('ol.control.FullScreen', function() {
describe('constructor', function() { describe('constructor', function() {
it('can be constructed without arguments', function() { it('can be constructed without arguments', function() {
var instance = new _ol_control_FullScreen_(); var instance = new FullScreen();
expect(instance).to.be.an(_ol_control_FullScreen_); expect(instance).to.be.an(FullScreen);
}); });
}); });