Add a "render" control option

This commit is contained in:
Éric Lemoine
2014-12-08 17:03:44 +01:00
parent ca355d2887
commit df170859cc
8 changed files with 129 additions and 29 deletions
+8 -2
View File
@@ -112,8 +112,12 @@ ol.control.ScaleLine = function(opt_options) {
*/
this.toEPSG4326_ = null;
var render = goog.isDef(options.render) ?
options.render : ol.control.ScaleLine.render;
goog.base(this, {
element: this.element_,
render: render,
target: options.target
});
@@ -152,9 +156,11 @@ goog.exportProperty(
/**
* @inheritDoc
* @param {ol.MapEvent} mapEvent Map event.
* @this {ol.control.ScaleLine}
* @api
*/
ol.control.ScaleLine.prototype.handleMapPostrender = function(mapEvent) {
ol.control.ScaleLine.render = function(mapEvent) {
var frameState = mapEvent.frameState;
if (goog.isNull(frameState)) {
this.viewState_ = null;