Make ol.Map.isDef stricter
This commit is contained in:
@@ -671,8 +671,9 @@ ol.Map.prototype.handleViewportResize = function() {
|
|||||||
* @return {boolean} Is defined.
|
* @return {boolean} Is defined.
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.isDef = function() {
|
ol.Map.prototype.isDef = function() {
|
||||||
return goog.isDef(this.getCenter()) && goog.isDef(this.getResolution()) &&
|
return goog.isDefAndNotNull(this.getCenter()) &&
|
||||||
goog.isDef(this.getSize());
|
goog.isDef(this.getResolution()) &&
|
||||||
|
goog.isDefAndNotNull(this.getSize());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -845,10 +846,10 @@ ol.Map.prototype.updateMatrices_ = function() {
|
|||||||
|
|
||||||
if (this.matriciesDirty_) {
|
if (this.matriciesDirty_) {
|
||||||
|
|
||||||
var center = /** @type {ol.Coordinate} */ this.getCenter();
|
var center = /** @type {!ol.Coordinate} */ this.getCenter();
|
||||||
var resolution = /** @type {number} */ this.getResolution();
|
var resolution = /** @type {number} */ this.getResolution();
|
||||||
var rotation = /** @type {number} */ this.getRotation();
|
var rotation = this.getRotation();
|
||||||
var size = /** @type {ol.Size} */ this.getSize();
|
var size = /** @type {!ol.Size} */ this.getSize();
|
||||||
|
|
||||||
goog.vec.Mat4.makeIdentity(this.coordinateToPixelMatrix_);
|
goog.vec.Mat4.makeIdentity(this.coordinateToPixelMatrix_);
|
||||||
goog.vec.Mat4.translate(this.coordinateToPixelMatrix_,
|
goog.vec.Mat4.translate(this.coordinateToPixelMatrix_,
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ ol.control.Drag.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
|||||||
this.startY = browserEvent.clientY;
|
this.startY = browserEvent.clientY;
|
||||||
this.deltaX = 0;
|
this.deltaX = 0;
|
||||||
this.deltaY = 0;
|
this.deltaY = 0;
|
||||||
this.startCenter = /** @type {ol.Coordinate} */ map.getCenter();
|
this.startCenter = /** @type {!ol.Coordinate} */ map.getCenter();
|
||||||
this.startCoordinate = /** @type {ol.Coordinate} */
|
this.startCoordinate = /** @type {ol.Coordinate} */
|
||||||
mapBrowserEvent.getCoordinate();
|
mapBrowserEvent.getCoordinate();
|
||||||
if (this.handleDragStart(mapBrowserEvent)) {
|
if (this.handleDragStart(mapBrowserEvent)) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ ol.dom.TileLayerRenderer.prototype.render = function() {
|
|||||||
if (!map.isDef()) {
|
if (!map.isDef()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var mapExtent = /** @type {ol.Extent} */ map.getExtent();
|
var mapExtent = /** @type {!ol.Extent} */ map.getExtent();
|
||||||
var mapResolution = /** @type {number} */ map.getResolution();
|
var mapResolution = /** @type {number} */ map.getResolution();
|
||||||
|
|
||||||
var tileLayer = this.getLayer();
|
var tileLayer = this.getLayer();
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ ol.webgl.TileLayerRenderer.prototype.render = function() {
|
|||||||
var gl = this.getGL();
|
var gl = this.getGL();
|
||||||
|
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
|
goog.asserts.assert(map.isDef());
|
||||||
var mapExtent = /** @type {!ol.Extent} */ map.getExtent();
|
var mapExtent = /** @type {!ol.Extent} */ map.getExtent();
|
||||||
var mapResolution = /** @type {number} */ map.getResolution();
|
var mapResolution = /** @type {number} */ map.getResolution();
|
||||||
var mapSize = map.getSize();
|
var mapSize = map.getSize();
|
||||||
|
|||||||
Reference in New Issue
Block a user