Making map_ protected instead of private.

This commit is contained in:
ahocevar
2012-06-24 11:39:42 +02:00
parent 81577d6dce
commit 0c9b3d1d58
3 changed files with 9 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ ol.control.Control = function(opt_autoActivate) {
/** /**
* @type {ol.Map} map * @type {ol.Map} map
* @private * @protected
*/ */
this.map_ = null; this.map_ = null;

View File

@@ -27,7 +27,7 @@ goog.inherits(ol.control.Navigation, ol.control.Control);
ol.control.Navigation.prototype.activate = function() { ol.control.Navigation.prototype.activate = function() {
var active = goog.base(this, 'activate'); var active = goog.base(this, 'activate');
if (active) { if (active) {
var events = this.getMap().getEvents(); var events = this.map_.getEvents();
events.register("drag", this.moveMap, this); events.register("drag", this.moveMap, this);
events.register("scroll", this.zoomMap, this); events.register("scroll", this.zoomMap, this);
} }
@@ -38,7 +38,7 @@ ol.control.Navigation.prototype.activate = function() {
ol.control.Navigation.prototype.deactivate = function() { ol.control.Navigation.prototype.deactivate = function() {
var inactive = goog.base(this, 'deactivate'); var inactive = goog.base(this, 'deactivate');
if (inactive) { if (inactive) {
var events = this.getMap().getEvents(); var events = this.map_.getEvents();
events.unregister("drag", this.moveMap, this); events.unregister("drag", this.moveMap, this);
events.unregister("scroll", this.zoomMap, this); events.unregister("scroll", this.zoomMap, this);
} }
@@ -49,7 +49,7 @@ ol.control.Navigation.prototype.deactivate = function() {
* @param {Object} evt * @param {Object} evt
*/ */
ol.control.Navigation.prototype.moveMap = function(evt) { ol.control.Navigation.prototype.moveMap = function(evt) {
this.getMap().moveByPx(evt.deltaX, evt.deltaY); this.map_.moveByPx(evt.deltaX, evt.deltaY);
return false; return false;
}; };
@@ -57,7 +57,7 @@ ol.control.Navigation.prototype.moveMap = function(evt) {
* @param {Event} evt * @param {Event} evt
*/ */
ol.control.Navigation.prototype.zoomMap = function(evt) { ol.control.Navigation.prototype.zoomMap = function(evt) {
var map = this.getMap(), var map = this.map_,
delta = ((evt.deltaY / 3) | 0); delta = ((evt.deltaY / 3) | 0);
if (Math.abs(delta) === 0) { if (Math.abs(delta) === 0) {
return; return;

View File

@@ -58,7 +58,7 @@ ol.control.Zoom.prototype.setMap = function(map) {
ol.control.Zoom.prototype.activate = function() { ol.control.Zoom.prototype.activate = function() {
var active = goog.base(this, 'activate'); var active = goog.base(this, 'activate');
if (active) { if (active) {
this.getMap().getEvents().register("click", this.handle, this); this.map_.getEvents().register("click", this.handle, this);
} }
return active; return active;
}; };
@@ -67,7 +67,7 @@ ol.control.Zoom.prototype.activate = function() {
ol.control.Zoom.prototype.deactivate = function() { ol.control.Zoom.prototype.deactivate = function() {
var inactive = goog.base(this, 'deactivate'); var inactive = goog.base(this, 'deactivate');
if (inactive) { if (inactive) {
this.getMap().getEvents().unregister("click", this.handle, this); this.map_.getEvents().unregister("click", this.handle, this);
} }
return inactive; return inactive;
}; };
@@ -79,11 +79,11 @@ ol.control.Zoom.prototype.handle = function(evt) {
var target = /** @type {Node} */ (evt.target), var target = /** @type {Node} */ (evt.target),
handled = false; handled = false;
if (goog.dom.getAncestorByClass(target, ol.control.Zoom.RES.IN_CLS)) { if (goog.dom.getAncestorByClass(target, ol.control.Zoom.RES.IN_CLS)) {
this.getMap().zoomIn(); this.map_.zoomIn();
handled = true; handled = true;
} else } else
if (goog.dom.getAncestorByClass(target, ol.control.Zoom.RES.OUT_CLS)) { if (goog.dom.getAncestorByClass(target, ol.control.Zoom.RES.OUT_CLS)) {
this.getMap().zoomOut(); this.map_.zoomOut();
handled = true; handled = true;
} }
if (handled) { if (handled) {