Remove goog.dom
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
goog.provide('ol.control.Attribution');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('ol');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
@@ -68,30 +68,37 @@ ol.control.Attribution = function(opt_options) {
|
||||
|
||||
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00BB';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.collapseLabel_ = typeof collapseLabel === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, collapseLabel) :
|
||||
collapseLabel;
|
||||
if (typeof collapseLabel === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.collapseLabel_ = document.createElement('span');
|
||||
this.collapseLabel_.textContent = collapseLabel;
|
||||
} else {
|
||||
this.collapseLabel_ = collapseLabel;
|
||||
}
|
||||
|
||||
var label = options.label !== undefined ? options.label : 'i';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.label_ = typeof label === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, label) :
|
||||
label;
|
||||
if (typeof label === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.label_ = document.createElement('span');
|
||||
this.label_.textContent = label;
|
||||
} else {
|
||||
this.label_ = label;
|
||||
}
|
||||
|
||||
|
||||
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
|
||||
this.collapseLabel_ : this.label_;
|
||||
var button = goog.dom.createDom('BUTTON', {
|
||||
'type': 'button',
|
||||
'title': tipLabel
|
||||
}, activeLabel);
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(activeLabel);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK, this.handleClick_, this);
|
||||
|
||||
@@ -99,8 +106,10 @@ ol.control.Attribution = function(opt_options) {
|
||||
ol.css.CLASS_CONTROL +
|
||||
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
|
||||
(this.collapsible_ ? '' : ' ol-uncollapsible');
|
||||
var element = goog.dom.createDom('DIV',
|
||||
cssClasses, this.ulElement_, button);
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(this.ulElement_);
|
||||
element.appendChild(button);
|
||||
|
||||
var render = options.render ? options.render : ol.control.Attribution.render;
|
||||
|
||||
@@ -240,7 +249,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
}
|
||||
delete hiddenAttributions[attributionKey];
|
||||
} else {
|
||||
goog.dom.removeNode(this.attributionElements_[attributionKey]);
|
||||
ol.dom.removeNode(this.attributionElements_[attributionKey]);
|
||||
delete this.attributionElements_[attributionKey];
|
||||
delete this.attributionElementRenderedVisible_[attributionKey];
|
||||
}
|
||||
@@ -293,7 +302,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
|
||||
for (logo in logoElements) {
|
||||
if (!(logo in logos)) {
|
||||
goog.dom.removeNode(logoElements[logo]);
|
||||
ol.dom.removeNode(logoElements[logo]);
|
||||
delete logoElements[logo];
|
||||
}
|
||||
}
|
||||
@@ -311,9 +320,8 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
if (logoValue === '') {
|
||||
logoElement = image;
|
||||
} else {
|
||||
logoElement = goog.dom.createDom('A', {
|
||||
'href': logoValue
|
||||
});
|
||||
logoElement = document.createElement('a');
|
||||
logoElement.href = logoValue;
|
||||
logoElement.appendChild(image);
|
||||
}
|
||||
this.logoLi_.appendChild(logoElement);
|
||||
@@ -342,9 +350,9 @@ ol.control.Attribution.prototype.handleClick_ = function(event) {
|
||||
ol.control.Attribution.prototype.handleToggle_ = function() {
|
||||
this.element.classList.toggle('ol-collapsed');
|
||||
if (this.collapsed_) {
|
||||
goog.dom.replaceNode(this.collapseLabel_, this.label_);
|
||||
ol.dom.replaceNode(this.collapseLabel_, this.label_);
|
||||
} else {
|
||||
goog.dom.replaceNode(this.label_, this.collapseLabel_);
|
||||
ol.dom.replaceNode(this.label_, this.collapseLabel_);
|
||||
}
|
||||
this.collapsed_ = !this.collapsed_;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
goog.provide('ol.control.Control');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol');
|
||||
goog.require('ol.MapEventType');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.dom');
|
||||
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ ol.inherits(ol.control.Control, ol.Object);
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.Control.prototype.disposeInternal = function() {
|
||||
goog.dom.removeNode(this.element);
|
||||
ol.dom.removeNode(this.element);
|
||||
ol.Object.prototype.disposeInternal.call(this);
|
||||
};
|
||||
|
||||
@@ -105,7 +105,7 @@ ol.control.Control.prototype.getMap = function() {
|
||||
*/
|
||||
ol.control.Control.prototype.setMap = function(map) {
|
||||
if (this.map_) {
|
||||
goog.dom.removeNode(this.element);
|
||||
ol.dom.removeNode(this.element);
|
||||
}
|
||||
for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
|
||||
ol.events.unlistenByKey(this.listenerKeys[i]);
|
||||
@@ -135,5 +135,7 @@ ol.control.Control.prototype.setMap = function(map) {
|
||||
* @api
|
||||
*/
|
||||
ol.control.Control.prototype.setTarget = function(target) {
|
||||
this.target_ = goog.dom.getElement(target);
|
||||
this.target_ = typeof target === 'string' ?
|
||||
document.getElementById(target) :
|
||||
target;
|
||||
};
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
goog.provide('ol.control.FullScreen');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.fullscreen');
|
||||
goog.require('goog.dom.fullscreen.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.css');
|
||||
|
||||
|
||||
@@ -58,19 +56,21 @@ ol.control.FullScreen = function(opt_options) {
|
||||
document.createTextNode(labelActive) : labelActive;
|
||||
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
|
||||
var button = goog.dom.createDom('BUTTON', {
|
||||
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen(),
|
||||
'type': 'button',
|
||||
'title': tipLabel
|
||||
}, this.labelNode_);
|
||||
var button = document.createElement('button');
|
||||
button.className = this.cssClassName_ + '-' + ol.control.FullScreen.isFullScreen();
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(this.labelNode_);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
var cssClasses = this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE +
|
||||
' ' + ol.css.CLASS_CONTROL + ' ' +
|
||||
(!goog.dom.fullscreen.isSupported() ? ol.css.CLASS_UNSUPPORTED : '');
|
||||
var element = goog.dom.createDom('DIV', cssClasses, button);
|
||||
(!ol.control.FullScreen.isFullScreenSupported() ? ol.css.CLASS_UNSUPPORTED : '');
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
element: element,
|
||||
@@ -107,23 +107,30 @@ ol.control.FullScreen.prototype.handleClick_ = function(event) {
|
||||
* @private
|
||||
*/
|
||||
ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
if (!goog.dom.fullscreen.isSupported()) {
|
||||
if (!ol.control.FullScreen.isFullScreenSupported()) {
|
||||
return;
|
||||
}
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
if (goog.dom.fullscreen.isFullScreen()) {
|
||||
goog.dom.fullscreen.exitFullScreen();
|
||||
if (ol.control.FullScreen.isFullScreen()) {
|
||||
ol.control.FullScreen.exitFullScreen();
|
||||
} else {
|
||||
var element = this.source_ ?
|
||||
goog.dom.getElement(this.source_) : map.getTargetElement();
|
||||
var element;
|
||||
if (this.source_) {
|
||||
element = typeof this.source_ === 'string' ?
|
||||
document.getElementById(this.source_) :
|
||||
this.source_;
|
||||
} else {
|
||||
element = map.getTargetElement();
|
||||
}
|
||||
goog.asserts.assert(element, 'element should be defined');
|
||||
if (this.keys_) {
|
||||
goog.dom.fullscreen.requestFullScreenWithKeys(element);
|
||||
ol.control.FullScreen.requestFullScreenWithKeys(element);
|
||||
|
||||
} else {
|
||||
goog.dom.fullscreen.requestFullScreen(element);
|
||||
ol.control.FullScreen.requestFullScreen(element);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -135,12 +142,12 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
|
||||
var button = this.element.firstElementChild;
|
||||
var map = this.getMap();
|
||||
if (goog.dom.fullscreen.isFullScreen()) {
|
||||
if (ol.control.FullScreen.isFullScreen()) {
|
||||
button.className = this.cssClassName_ + '-true';
|
||||
goog.dom.replaceNode(this.labelActiveNode_, this.labelNode_);
|
||||
ol.dom.replaceNode(this.labelActiveNode_, this.labelNode_);
|
||||
} else {
|
||||
button.className = this.cssClassName_ + '-false';
|
||||
goog.dom.replaceNode(this.labelNode_, this.labelActiveNode_);
|
||||
ol.dom.replaceNode(this.labelNode_, this.labelActiveNode_);
|
||||
}
|
||||
if (map) {
|
||||
map.updateSize();
|
||||
@@ -156,8 +163,93 @@ ol.control.FullScreen.prototype.setMap = function(map) {
|
||||
ol.control.Control.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
this.listenerKeys.push(
|
||||
ol.events.listen(ol.global.document, goog.dom.fullscreen.EventType.CHANGE,
|
||||
ol.events.listen(ol.global.document, ol.control.FullScreen.CHANGETYPE,
|
||||
this.handleFullScreenChange_, this)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean} Fullscreen is supported by the current platform.
|
||||
*/
|
||||
ol.control.FullScreen.isFullScreenSupported = function() {
|
||||
var body = document.body;
|
||||
return !!(
|
||||
body.webkitRequestFullscreen ||
|
||||
(body.mozRequestFullScreen && document.mozFullScreenEnabled) ||
|
||||
(body.msRequestFullscreen && document.msFullscreenEnabled) ||
|
||||
(body.requestFullscreen && document.fullscreenEnabled)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean} Element is currently in fullscreen.
|
||||
*/
|
||||
ol.control.FullScreen.isFullScreen = function() {
|
||||
return !!(
|
||||
document.webkitIsFullScreen || document.mozFullScreen ||
|
||||
document.msFullscreenElement || document.fullscreenElement
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Request to fullscreen an element.
|
||||
* @param {Node} element Element to request fullscreen
|
||||
*/
|
||||
ol.control.FullScreen.requestFullScreen = function(element) {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
} else if (element.msRequestFullscreen) {
|
||||
element.msRequestFullscreen();
|
||||
} else if (element.mozRequestFullScreen) {
|
||||
element.mozRequestFullScreen();
|
||||
} else if (element.webkitRequestFullscreen) {
|
||||
element.webkitRequestFullscreen();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Request to fullscreen an element with keyboard input.
|
||||
* @param {Node} element Element to request fullscreen
|
||||
*/
|
||||
ol.control.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);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Exit fullscreen.
|
||||
*/
|
||||
ol.control.FullScreen.exitFullScreen = function() {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.webkitExitFullscreen) {
|
||||
document.webkitExitFullscreen();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
ol.control.FullScreen.CHANGETYPE = (function() {
|
||||
var body = document.body;
|
||||
if (body.webkitRequestFullscreen) {
|
||||
return 'webkitfullscreenchange';
|
||||
} else if (body.mozRequestFullScreen) {
|
||||
return 'mozfullscreenchange';
|
||||
} else if (body.msRequestFullscreen) {
|
||||
return 'MSFullscreenChange';
|
||||
} else if (body.requestFullscreen) {
|
||||
return 'fullscreenchange';
|
||||
}
|
||||
return undefined;
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.control.OverviewMap');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol');
|
||||
@@ -17,6 +16,7 @@ goog.require('ol.ViewProperty');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.extent');
|
||||
|
||||
|
||||
@@ -55,30 +55,37 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
|
||||
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00AB';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.collapseLabel_ = typeof collapseLabel === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, collapseLabel) :
|
||||
collapseLabel;
|
||||
if (typeof collapseLabel === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.collapseLabel_ = document.createElement('span');
|
||||
this.collapseLabel_.textContent = collapseLabel;
|
||||
} else {
|
||||
this.collapseLabel_ = collapseLabel;
|
||||
}
|
||||
|
||||
var label = options.label !== undefined ? options.label : '\u00BB';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.label_ = typeof label === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, label) :
|
||||
label;
|
||||
|
||||
if (typeof label === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.label_ = document.createElement('span');
|
||||
this.label_.textContent = label;
|
||||
} else {
|
||||
this.label_ = label;
|
||||
}
|
||||
|
||||
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
|
||||
this.collapseLabel_ : this.label_;
|
||||
var button = goog.dom.createDom('BUTTON', {
|
||||
'type': 'button',
|
||||
'title': tipLabel
|
||||
}, activeLabel);
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(activeLabel);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
this.handleClick_, this);
|
||||
@@ -127,8 +134,10 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
ol.css.CLASS_CONTROL +
|
||||
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
|
||||
(this.collapsible_ ? '' : ' ol-uncollapsible');
|
||||
var element = goog.dom.createDom('DIV',
|
||||
cssClasses, ovmapDiv, button);
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(ovmapDiv);
|
||||
element.appendChild(button);
|
||||
|
||||
var render = options.render ? options.render : ol.control.OverviewMap.render;
|
||||
|
||||
@@ -445,9 +454,9 @@ ol.control.OverviewMap.prototype.handleClick_ = function(event) {
|
||||
ol.control.OverviewMap.prototype.handleToggle_ = function() {
|
||||
this.element.classList.toggle('ol-collapsed');
|
||||
if (this.collapsed_) {
|
||||
goog.dom.replaceNode(this.collapseLabel_, this.label_);
|
||||
ol.dom.replaceNode(this.collapseLabel_, this.label_);
|
||||
} else {
|
||||
goog.dom.replaceNode(this.label_, this.collapseLabel_);
|
||||
ol.dom.replaceNode(this.label_, this.collapseLabel_);
|
||||
}
|
||||
this.collapsed_ = !this.collapsed_;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
goog.provide('ol.control.Rotate');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol');
|
||||
@@ -36,8 +35,9 @@ ol.control.Rotate = function(opt_options) {
|
||||
this.label_ = null;
|
||||
|
||||
if (typeof label === 'string') {
|
||||
this.label_ = goog.dom.createDom('SPAN',
|
||||
'ol-compass', label);
|
||||
this.label_ = document.createElement('span');
|
||||
this.label_.className = 'ol-compass';
|
||||
this.label_.textContent = label;
|
||||
} else {
|
||||
this.label_ = label;
|
||||
this.label_.classList.add('ol-compass');
|
||||
@@ -45,18 +45,20 @@ ol.control.Rotate = function(opt_options) {
|
||||
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';
|
||||
|
||||
var button = goog.dom.createDom('BUTTON', {
|
||||
'class': className + '-reset',
|
||||
'type' : 'button',
|
||||
'title': tipLabel
|
||||
}, this.label_);
|
||||
var button = document.createElement('button');
|
||||
button.className = className + '-reset';
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(this.label_);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
ol.control.Rotate.prototype.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
var element = goog.dom.createDom('DIV', cssClasses, button);
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
var render = options.render ? options.render : ol.control.Rotate.render;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
goog.provide('ol.control.Zoom');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.animation');
|
||||
@@ -36,27 +35,34 @@ ol.control.Zoom = function(opt_options) {
|
||||
var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?
|
||||
options.zoomOutTipLabel : 'Zoom out';
|
||||
|
||||
var inElement = goog.dom.createDom('BUTTON', {
|
||||
'class': className + '-in',
|
||||
'type' : 'button',
|
||||
'title': zoomInTipLabel
|
||||
}, zoomInLabel);
|
||||
var inElement = document.createElement('button');
|
||||
inElement.className = className + '-in';
|
||||
inElement.setAttribute('type', 'button');
|
||||
inElement.title = zoomInTipLabel;
|
||||
inElement.appendChild(
|
||||
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
|
||||
);
|
||||
|
||||
ol.events.listen(inElement, ol.events.EventType.CLICK,
|
||||
ol.control.Zoom.prototype.handleClick_.bind(this, delta));
|
||||
|
||||
var outElement = goog.dom.createDom('BUTTON', {
|
||||
'class': className + '-out',
|
||||
'type' : 'button',
|
||||
'title': zoomOutTipLabel
|
||||
}, zoomOutLabel);
|
||||
var outElement = document.createElement('button');
|
||||
outElement.className = className + '-out';
|
||||
outElement.setAttribute('type', 'button');
|
||||
outElement.title = zoomOutTipLabel;
|
||||
outElement.appendChild(
|
||||
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
|
||||
);
|
||||
|
||||
ol.events.listen(outElement, ol.events.EventType.CLICK,
|
||||
ol.control.Zoom.prototype.handleClick_.bind(this, -delta));
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
var element = goog.dom.createDom('DIV', cssClasses, inElement, outElement);
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(inElement);
|
||||
element.appendChild(outElement);
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
element: element,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
goog.provide('ol.control.ZoomSlider');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.events.EventType');
|
||||
@@ -108,14 +107,12 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 200;
|
||||
|
||||
var className = options.className !== undefined ? options.className : 'ol-zoomslider';
|
||||
var thumbElement = goog.dom.createDom('BUTTON', {
|
||||
'type': 'button',
|
||||
'class': className + '-thumb ' + ol.css.CLASS_UNSELECTABLE
|
||||
});
|
||||
var containerElement = goog.dom.createDom('DIV',
|
||||
[className, ol.css.CLASS_UNSELECTABLE, ol.css.CLASS_CONTROL],
|
||||
thumbElement);
|
||||
|
||||
var thumbElement = document.createElement('button');
|
||||
thumbElement.setAttribute('type', 'button');
|
||||
thumbElement.className = className + '-thumb ' + ol.css.CLASS_UNSELECTABLE;
|
||||
var containerElement = document.createElement('div');
|
||||
containerElement.className = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + ol.css.CLASS_CONTROL;
|
||||
containerElement.appendChild(thumbElement);
|
||||
/**
|
||||
* @type {ol.pointer.PointerEventHandler}
|
||||
* @private
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.control.ZoomToExtent');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.control.Control');
|
||||
@@ -33,17 +32,21 @@ ol.control.ZoomToExtent = function(opt_options) {
|
||||
var label = options.label !== undefined ? options.label : 'E';
|
||||
var tipLabel = options.tipLabel !== undefined ?
|
||||
options.tipLabel : 'Fit to extent';
|
||||
var button = goog.dom.createDom('BUTTON', {
|
||||
'type': 'button',
|
||||
'title': tipLabel
|
||||
}, label);
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(
|
||||
typeof label === 'string' ? document.createTextNode(label) : label
|
||||
);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
var element = goog.dom.createDom('DIV', cssClasses, button);
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
element: element,
|
||||
|
||||
Reference in New Issue
Block a user