Merge pull request #946 from tschaub/control-options

Remove map from ControlOptions.
This commit is contained in:
Tim Schaub
2013-09-02 05:40:45 -07:00
15 changed files with 10 additions and 38 deletions
-1
View File
@@ -50,7 +50,6 @@ app.RotateNorthControl = function(opt_options) {
ol.control.Control.call(this, { ol.control.Control.call(this, {
element: element, element: element,
map: options.map,
target: options.target target: options.target
}); });
+2 -3
View File
@@ -26,9 +26,8 @@ var createMap = function(divId) {
zoom: 2 zoom: 2
}) })
}); });
zoomslider = new ol.control.ZoomSlider({ zoomslider = new ol.control.ZoomSlider();
map: map map.addControl(zoomslider);
});
return map; return map;
}; };
-9
View File
@@ -159,14 +159,12 @@
/** /**
* @typedef {Object} ol.control.AttributionOptions * @typedef {Object} ol.control.AttributionOptions
* @property {string|undefined} className CSS class name. Default is 'ol-attribution'. * @property {string|undefined} className CSS class name. Default is 'ol-attribution'.
* @property {ol.Map|undefined} map Map.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
*/ */
/** /**
* @typedef {Object} ol.control.ControlOptions * @typedef {Object} ol.control.ControlOptions
* @property {Element|undefined} element Element. * @property {Element|undefined} element Element.
* @property {ol.Map|undefined} map Map.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
*/ */
@@ -185,14 +183,12 @@
* @typedef {Object} ol.control.FullScreenOptions * @typedef {Object} ol.control.FullScreenOptions
* @property {string|undefined} className CSS class name. Default is 'ol-full-screen'. * @property {string|undefined} className CSS class name. Default is 'ol-full-screen'.
* @property {boolean|undefined} keys Full keyboard access. * @property {boolean|undefined} keys Full keyboard access.
* @property {ol.Map|undefined} map Map.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
*/ */
/** /**
* @typedef {Object} ol.control.LogoOptions * @typedef {Object} ol.control.LogoOptions
* @property {string|undefined} className CSS class name. Default is 'ol-logo'. * @property {string|undefined} className CSS class name. Default is 'ol-logo'.
* @property {ol.Map|undefined} map Map.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
*/ */
@@ -201,7 +197,6 @@
* @property {string|undefined} className CSS class name. Default is 'ol-mouse-position'. * @property {string|undefined} className CSS class name. Default is 'ol-mouse-position'.
* @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate * @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate
* format. * format.
* @property {ol.Map|undefined} map Map.
* @property {ol.ProjectionLike} projection Projection. * @property {ol.ProjectionLike} projection Projection.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
* @property {string|undefined} undefinedHTML Markup for undefined coordinates. * @property {string|undefined} undefinedHTML Markup for undefined coordinates.
@@ -211,7 +206,6 @@
/** /**
* @typedef {Object} ol.control.ScaleLineOptions * @typedef {Object} ol.control.ScaleLineOptions
* @property {string|undefined} className CSS Class name. Default is 'ol-scale-line'. * @property {string|undefined} className CSS Class name. Default is 'ol-scale-line'.
* @property {ol.Map|undefined} map Map.
* @property {number|undefined} minWidth Minimum width in pixels. * @property {number|undefined} minWidth Minimum width in pixels.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
* @property {ol.control.ScaleLineUnits|undefined} units Units. * @property {ol.control.ScaleLineUnits|undefined} units Units.
@@ -221,14 +215,12 @@
* @typedef {Object} ol.control.ZoomOptions * @typedef {Object} ol.control.ZoomOptions
* @property {string|undefined} className CSS class name. Default is 'ol-zoom'. * @property {string|undefined} className CSS class name. Default is 'ol-zoom'.
* @property {number|undefined} delta The zoom delta applied on each click. * @property {number|undefined} delta The zoom delta applied on each click.
* @property {ol.Map|undefined} map Map.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
*/ */
/** /**
* @typedef {Object} ol.control.ZoomSliderOptions * @typedef {Object} ol.control.ZoomSliderOptions
* @property {string|undefined} className CSS class name. * @property {string|undefined} className CSS class name.
* @property {ol.Map|undefined} map Map.
* @property {number|undefined} maxResolution Maximum resolution. * @property {number|undefined} maxResolution Maximum resolution.
* @property {number|undefined} minResolution Minimum resolution. * @property {number|undefined} minResolution Minimum resolution.
*/ */
@@ -236,7 +228,6 @@
/** /**
* @typedef {Object} ol.control.ZoomToExtentOptions * @typedef {Object} ol.control.ZoomToExtentOptions
* @property {string|undefined} className Class name. * @property {string|undefined} className Class name.
* @property {ol.Map|undefined} map Map.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
* @property {ol.Extent|undefined} extent The extent to zoom to. If * @property {ol.Extent|undefined} extent The extent to zoom to. If
* undefined the validity extent of the view projection is used. * undefined the validity extent of the view projection is used.
-1
View File
@@ -41,7 +41,6 @@ ol.control.Attribution = function(opt_options) {
goog.base(this, { goog.base(this, {
element: element, element: element,
map: options.map,
target: options.target target: options.target
}); });
-4
View File
@@ -45,10 +45,6 @@ ol.control.Control = function(options) {
*/ */
this.listenerKeys = []; this.listenerKeys = [];
if (goog.isDef(options.map)) {
this.setMap(options.map);
}
}; };
goog.inherits(ol.control.Control, ol.Object); goog.inherits(ol.control.Control, ol.Object);
+2 -4
View File
@@ -14,8 +14,7 @@ goog.require('ol.control.Control');
/** /**
* @typedef {{map: (ol.Map|undefined), * @typedef {{startCoordinate: ol.Coordinate}}
* startCoordinate: ol.Coordinate}}
*/ */
ol.control.DragBoxOptions; ol.control.DragBoxOptions;
@@ -43,8 +42,7 @@ ol.control.DragBox = function(options) {
this.startCoordinate_ = options.startCoordinate; this.startCoordinate_ = options.startCoordinate;
goog.base(this, { goog.base(this, {
element: element, element: element
map: options.map
}); });
}; };
-1
View File
@@ -51,7 +51,6 @@ ol.control.FullScreen = function(opt_options) {
goog.base(this, { goog.base(this, {
element: element, element: element,
map: options.map,
target: options.target target: options.target
}); });
-1
View File
@@ -37,7 +37,6 @@ ol.control.Logo = function(opt_options) {
goog.base(this, { goog.base(this, {
element: element, element: element,
map: options.map,
target: options.target target: options.target
}); });
-1
View File
@@ -51,7 +51,6 @@ ol.control.MousePosition = function(opt_options) {
goog.base(this, { goog.base(this, {
element: element, element: element,
map: options.map,
target: options.target target: options.target
}); });
-1
View File
@@ -108,7 +108,6 @@ ol.control.ScaleLine = function(opt_options) {
goog.base(this, { goog.base(this, {
element: this.element_, element: this.element_,
map: options.map,
target: options.target target: options.target
}); });
-1
View File
@@ -59,7 +59,6 @@ ol.control.Zoom = function(opt_options) {
goog.base(this, { goog.base(this, {
element: element, element: element,
map: options.map,
target: options.target target: options.target
}); });
+2 -5
View File
@@ -33,9 +33,7 @@ ol.control.ZOOMSLIDER_ANIMATION_DURATION = 200;
* *
* Example: * Example:
* *
* var zoomslider = new ol.control.ZoomSlider({ * map.addControl(new ol.control.ZoomSlider());
* map: map
* });
* *
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
@@ -91,8 +89,7 @@ ol.control.ZoomSlider = function(opt_options) {
], this.handleContainerClick_, false, this); ], this.handleContainerClick_, false, this);
goog.base(this, { goog.base(this, {
element: element, element: element
map: options.map
}); });
}; };
goog.inherits(ol.control.ZoomSlider, ol.control.Control); goog.inherits(ol.control.ZoomSlider, ol.control.Control);
-1
View File
@@ -46,7 +46,6 @@ ol.control.ZoomToExtent = function(opt_options) {
goog.base(this, { goog.base(this, {
element: element, element: element,
map: options.map,
target: options.target target: options.target
}); });
}; };
+1 -1
View File
@@ -90,9 +90,9 @@ ol.interaction.DragZoom.prototype.handleDragStart =
var browserEvent = mapBrowserEvent.browserEvent; var browserEvent = mapBrowserEvent.browserEvent;
if (browserEvent.isMouseActionButton() && this.condition_(browserEvent)) { if (browserEvent.isMouseActionButton() && this.condition_(browserEvent)) {
this.dragBox_ = new ol.control.DragBox({ this.dragBox_ = new ol.control.DragBox({
map: mapBrowserEvent.map,
startCoordinate: this.startCoordinate startCoordinate: this.startCoordinate
}); });
this.dragBox_.setMap(mapBrowserEvent.map);
return true; return true;
} else { } else {
return false; return false;
@@ -6,11 +6,10 @@ describe('ol.control.ZoomSlider', function() {
beforeEach(function() { beforeEach(function() {
target = document.createElement('div'); target = document.createElement('div');
document.body.appendChild(target); document.body.appendChild(target);
zoomslider = new ol.control.ZoomSlider();
map = new ol.Map({ map = new ol.Map({
target: target target: target,
}); controls: [zoomslider]
zoomslider = new ol.control.ZoomSlider({
map: map
}); });
}); });