From d9f8667d2beb78f9c0410cc74bfb806d92f4fe2e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 14 Dec 2017 12:58:47 -0700 Subject: [PATCH] Rename _ol_control_FullScreen_ to FullScreen --- examples/full-screen-drag-rotate-and-zoom.js | 4 +- examples/full-screen-source.js | 4 +- examples/full-screen.js | 4 +- src/ol/control/FullScreen.js | 46 ++++++++++---------- test/spec/ol/control/fullscreen.test.js | 6 +-- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/full-screen-drag-rotate-and-zoom.js b/examples/full-screen-drag-rotate-and-zoom.js index 50d2c7a7ce..aaa96173a4 100644 --- a/examples/full-screen-drag-rotate-and-zoom.js +++ b/examples/full-screen-drag-rotate-and-zoom.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.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_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.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_({ controls: _ol_control_.defaults().extend([ - new _ol_control_FullScreen_() + new FullScreen() ]), interactions: _ol_interaction_.defaults().extend([ new _ol_interaction_DragRotateAndZoom_() diff --git a/examples/full-screen-source.js b/examples/full-screen-source.js index 1b781d0c95..3260e1e5c4 100644 --- a/examples/full-screen-source.js +++ b/examples/full-screen-source.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.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_source_OSM_ from '../src/ol/source/OSM.js'; @@ -13,7 +13,7 @@ var view = new _ol_View_({ var map = new _ol_Map_({ controls: _ol_control_.defaults().extend([ - new _ol_control_FullScreen_({ + new FullScreen({ source: 'fullscreen' }) ]), diff --git a/examples/full-screen.js b/examples/full-screen.js index b5da25da7a..a8ed090a79 100644 --- a/examples/full-screen.js +++ b/examples/full-screen.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.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_source_BingMaps_ from '../src/ol/source/BingMaps.js'; @@ -13,7 +13,7 @@ var view = new _ol_View_({ var map = new _ol_Map_({ controls: _ol_control_.defaults().extend([ - new _ol_control_FullScreen_() + new FullScreen() ]), layers: [ new _ol_layer_Tile_({ diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index dbcd0766bc..1feefca4b5 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -25,7 +25,7 @@ import _ol_events_EventType_ from '../events/EventType.js'; * @param {olx.control.FullScreenOptions=} opt_options Options. * @api */ -var _ol_control_FullScreen_ = function(opt_options) { +var FullScreen = function(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 button = document.createElement('button'); - button.className = this.cssClassName_ + '-' + _ol_control_FullScreen_.isFullScreen(); + button.className = this.cssClassName_ + '-' + FullScreen.isFullScreen(); button.setAttribute('type', 'button'); button.title = tipLabel; button.appendChild(this.labelNode_); @@ -66,7 +66,7 @@ var _ol_control_FullScreen_ = function(opt_options) { var cssClasses = this.cssClassName_ + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' + _ol_css_.CLASS_CONTROL + ' ' + - (!_ol_control_FullScreen_.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : ''); + (!FullScreen.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : ''); var element = document.createElement('div'); element.className = cssClasses; 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 * @private */ -_ol_control_FullScreen_.prototype.handleClick_ = function(event) { +FullScreen.prototype.handleClick_ = function(event) { event.preventDefault(); this.handleFullScreen_(); }; @@ -106,16 +106,16 @@ _ol_control_FullScreen_.prototype.handleClick_ = function(event) { /** * @private */ -_ol_control_FullScreen_.prototype.handleFullScreen_ = function() { - if (!_ol_control_FullScreen_.isFullScreenSupported()) { +FullScreen.prototype.handleFullScreen_ = function() { + if (!FullScreen.isFullScreenSupported()) { return; } var map = this.getMap(); if (!map) { return; } - if (_ol_control_FullScreen_.isFullScreen()) { - _ol_control_FullScreen_.exitFullScreen(); + if (FullScreen.isFullScreen()) { + FullScreen.exitFullScreen(); } else { var element; if (this.source_) { @@ -126,10 +126,10 @@ _ol_control_FullScreen_.prototype.handleFullScreen_ = function() { element = map.getTargetElement(); } if (this.keys_) { - _ol_control_FullScreen_.requestFullScreenWithKeys(element); + FullScreen.requestFullScreenWithKeys(element); } else { - _ol_control_FullScreen_.requestFullScreen(element); + FullScreen.requestFullScreen(element); } } }; @@ -138,10 +138,10 @@ _ol_control_FullScreen_.prototype.handleFullScreen_ = function() { /** * @private */ -_ol_control_FullScreen_.prototype.handleFullScreenChange_ = function() { +FullScreen.prototype.handleFullScreenChange_ = function() { var button = this.element.firstElementChild; var map = this.getMap(); - if (_ol_control_FullScreen_.isFullScreen()) { + if (FullScreen.isFullScreen()) { button.className = this.cssClassName_ + '-true'; replaceNode(this.labelActiveNode_, this.labelNode_); } else { @@ -158,11 +158,11 @@ _ol_control_FullScreen_.prototype.handleFullScreenChange_ = function() { * @inheritDoc * @api */ -_ol_control_FullScreen_.prototype.setMap = function(map) { +FullScreen.prototype.setMap = function(map) { Control.prototype.setMap.call(this, map); if (map) { this.listenerKeys.push(_ol_events_.listen(document, - _ol_control_FullScreen_.getChangeType_(), + FullScreen.getChangeType_(), this.handleFullScreenChange_, this) ); } @@ -171,7 +171,7 @@ _ol_control_FullScreen_.prototype.setMap = function(map) { /** * @return {boolean} Fullscreen is supported by the current platform. */ -_ol_control_FullScreen_.isFullScreenSupported = function() { +FullScreen.isFullScreenSupported = function() { var body = document.body; return !!( body.webkitRequestFullscreen || @@ -184,7 +184,7 @@ _ol_control_FullScreen_.isFullScreenSupported = function() { /** * @return {boolean} Element is currently in fullscreen. */ -_ol_control_FullScreen_.isFullScreen = function() { +FullScreen.isFullScreen = function() { return !!( document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement || document.fullscreenElement @@ -195,7 +195,7 @@ _ol_control_FullScreen_.isFullScreen = function() { * Request to fullscreen an element. * @param {Node} element Element to request fullscreen */ -_ol_control_FullScreen_.requestFullScreen = function(element) { +FullScreen.requestFullScreen = function(element) { if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.msRequestFullscreen) { @@ -211,20 +211,20 @@ _ol_control_FullScreen_.requestFullScreen = function(element) { * Request to fullscreen an element with keyboard input. * @param {Node} element Element to request fullscreen */ -_ol_control_FullScreen_.requestFullScreenWithKeys = function(element) { +FullScreen.requestFullScreenWithKeys = function(element) { if (element.mozRequestFullScreenWithKeys) { element.mozRequestFullScreenWithKeys(); } else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } else { - _ol_control_FullScreen_.requestFullScreen(element); + FullScreen.requestFullScreen(element); } }; /** * Exit fullscreen. */ -_ol_control_FullScreen_.exitFullScreen = function() { +FullScreen.exitFullScreen = function() { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.msExitFullscreen) { @@ -240,7 +240,7 @@ _ol_control_FullScreen_.exitFullScreen = function() { * @return {string} Change type. * @private */ -_ol_control_FullScreen_.getChangeType_ = (function() { +FullScreen.getChangeType_ = (function() { var changeType; return function() { if (!changeType) { @@ -258,4 +258,4 @@ _ol_control_FullScreen_.getChangeType_ = (function() { return changeType; }; })(); -export default _ol_control_FullScreen_; +export default FullScreen; diff --git a/test/spec/ol/control/fullscreen.test.js b/test/spec/ol/control/fullscreen.test.js index 9dae5d3c67..46207b75bb 100644 --- a/test/spec/ol/control/fullscreen.test.js +++ b/test/spec/ol/control/fullscreen.test.js @@ -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('constructor', function() { it('can be constructed without arguments', function() { - var instance = new _ol_control_FullScreen_(); - expect(instance).to.be.an(_ol_control_FullScreen_); + var instance = new FullScreen(); + expect(instance).to.be.an(FullScreen); }); });