Export render from ol/control/MousePosition

This commit is contained in:
Tim Schaub
2018-02-18 22:40:00 -07:00
parent 2d46a15a3d
commit 6af726e72b

View File

@@ -41,12 +41,9 @@ const MousePosition = function(opt_options) {
const element = document.createElement('DIV'); const element = document.createElement('DIV');
element.className = options.className !== undefined ? options.className : 'ol-mouse-position'; element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
const render = options.render ?
options.render : MousePosition.render;
Control.call(this, { Control.call(this, {
element: element, element: element,
render: render, render: options.render || render,
target: options.target target: options.target
}); });
@@ -102,7 +99,7 @@ inherits(MousePosition, Control);
* @this {ol.control.MousePosition} * @this {ol.control.MousePosition}
* @api * @api
*/ */
MousePosition.render = function(mapEvent) { export function render(mapEvent) {
const frameState = mapEvent.frameState; const frameState = mapEvent.frameState;
if (!frameState) { if (!frameState) {
this.mapProjection_ = null; this.mapProjection_ = null;
@@ -113,7 +110,7 @@ MousePosition.render = function(mapEvent) {
} }
} }
this.updateHTML_(this.lastMouseMovePixel_); this.updateHTML_(this.lastMouseMovePixel_);
}; }
/** /**