Rename _ol_control_Rotate_ to Rotate
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import _ol_Collection_ from './Collection.js';
|
import _ol_Collection_ from './Collection.js';
|
||||||
import Attribution from './control/Attribution.js';
|
import Attribution from './control/Attribution.js';
|
||||||
import _ol_control_Rotate_ from './control/Rotate.js';
|
import Rotate from './control/Rotate.js';
|
||||||
import _ol_control_Zoom_ from './control/Zoom.js';
|
import _ol_control_Zoom_ from './control/Zoom.js';
|
||||||
var _ol_control_ = {};
|
var _ol_control_ = {};
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ _ol_control_.defaults = function(opt_options) {
|
|||||||
|
|
||||||
var rotateControl = options.rotate !== undefined ? options.rotate : true;
|
var rotateControl = options.rotate !== undefined ? options.rotate : true;
|
||||||
if (rotateControl) {
|
if (rotateControl) {
|
||||||
controls.push(new _ol_control_Rotate_(options.rotateOptions));
|
controls.push(new Rotate(options.rotateOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributionControl = options.attribution !== undefined ?
|
var attributionControl = options.attribution !== undefined ?
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {inherits} from '../index.js';
|
|||||||
* @param {olx.control.RotateOptions=} opt_options Rotate options.
|
* @param {olx.control.RotateOptions=} opt_options Rotate options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_control_Rotate_ = function(opt_options) {
|
var Rotate = function(opt_options) {
|
||||||
|
|
||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ var _ol_control_Rotate_ = function(opt_options) {
|
|||||||
button.appendChild(this.label_);
|
button.appendChild(this.label_);
|
||||||
|
|
||||||
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
|
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
|
||||||
_ol_control_Rotate_.prototype.handleClick_, this);
|
Rotate.prototype.handleClick_, this);
|
||||||
|
|
||||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||||
_ol_css_.CLASS_CONTROL;
|
_ol_css_.CLASS_CONTROL;
|
||||||
@@ -60,7 +60,7 @@ var _ol_control_Rotate_ = function(opt_options) {
|
|||||||
element.className = cssClasses;
|
element.className = cssClasses;
|
||||||
element.appendChild(button);
|
element.appendChild(button);
|
||||||
|
|
||||||
var render = options.render ? options.render : _ol_control_Rotate_.render;
|
var render = options.render ? options.render : Rotate.render;
|
||||||
|
|
||||||
this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
|
this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
|
||||||
|
|
||||||
@@ -94,14 +94,14 @@ var _ol_control_Rotate_ = function(opt_options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_control_Rotate_, Control);
|
inherits(Rotate, Control);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Event} event The event to handle
|
* @param {Event} event The event to handle
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_control_Rotate_.prototype.handleClick_ = function(event) {
|
Rotate.prototype.handleClick_ = function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (this.callResetNorth_ !== undefined) {
|
if (this.callResetNorth_ !== undefined) {
|
||||||
this.callResetNorth_();
|
this.callResetNorth_();
|
||||||
@@ -114,7 +114,7 @@ _ol_control_Rotate_.prototype.handleClick_ = function(event) {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_control_Rotate_.prototype.resetNorth_ = function() {
|
Rotate.prototype.resetNorth_ = function() {
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
if (!view) {
|
if (!view) {
|
||||||
@@ -142,7 +142,7 @@ _ol_control_Rotate_.prototype.resetNorth_ = function() {
|
|||||||
* @this {ol.control.Rotate}
|
* @this {ol.control.Rotate}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_control_Rotate_.render = function(mapEvent) {
|
Rotate.render = function(mapEvent) {
|
||||||
var frameState = mapEvent.frameState;
|
var frameState = mapEvent.frameState;
|
||||||
if (!frameState) {
|
if (!frameState) {
|
||||||
return;
|
return;
|
||||||
@@ -164,4 +164,4 @@ _ol_control_Rotate_.render = function(mapEvent) {
|
|||||||
}
|
}
|
||||||
this.rotation_ = rotation;
|
this.rotation_ = rotation;
|
||||||
};
|
};
|
||||||
export default _ol_control_Rotate_;
|
export default Rotate;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import _ol_control_Rotate_ from '../../../../src/ol/control/Rotate.js';
|
import Rotate from '../../../../src/ol/control/Rotate.js';
|
||||||
|
|
||||||
describe('ol.control.Rotate', function() {
|
describe('ol.control.Rotate', 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_Rotate_();
|
var instance = new Rotate();
|
||||||
expect(instance).to.be.an(_ol_control_Rotate_);
|
expect(instance).to.be.an(Rotate);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user