Merge pull request #1291 from fredj/canvasSize

Fix ol.Size order in ol.renderer.canvas.Map and ol.renderer.webgl.Map
This commit is contained in:
Frédéric Junod
2013-11-19 08:25:15 -08:00
2 changed files with 2 additions and 22 deletions

View File

@@ -7,7 +7,6 @@ goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.style');
goog.require('goog.vec.Mat4');
goog.require('ol.Size');
goog.require('ol.css');
goog.require('ol.layer.Image');
goog.require('ol.layer.Tile');
@@ -37,8 +36,6 @@ ol.renderer.canvas.Map = function(container, map) {
*/
this.canvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS));
this.canvas_.height = container.clientHeight;
this.canvas_.width = container.clientWidth;
this.canvas_.className = ol.css.CLASS_UNSELECTABLE;
goog.dom.insertChildAt(container, this.canvas_, 0);
@@ -48,12 +45,6 @@ ol.renderer.canvas.Map = function(container, map) {
*/
this.renderedVisible_ = true;
/**
* @private
* @type {ol.Size}
*/
this.canvasSize_ = [container.clientHeight, container.clientWidth];
/**
* @private
* @type {CanvasRenderingContext2D}
@@ -104,10 +95,9 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
}
var size = frameState.size;
if (!ol.size.equals(this.canvasSize_, size)) {
if (!ol.size.equals([this.canvas_.width, this.canvas_.height], size)) {
this.canvas_.width = size[0];
this.canvas_.height = size[1];
this.canvasSize_ = size;
}
var context = this.context_;

View File

@@ -14,7 +14,6 @@ goog.require('goog.object');
goog.require('goog.style');
goog.require('goog.webgl');
goog.require('ol.FrameState');
goog.require('ol.Size');
goog.require('ol.Tile');
goog.require('ol.css');
goog.require('ol.layer.Image');
@@ -72,8 +71,6 @@ ol.renderer.webgl.Map = function(container, map) {
*/
this.canvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS));
this.canvas_.height = container.clientHeight;
this.canvas_.width = container.clientWidth;
this.canvas_.className = ol.css.CLASS_UNSELECTABLE;
goog.dom.insertChildAt(container, this.canvas_, 0);
@@ -83,12 +80,6 @@ ol.renderer.webgl.Map = function(container, map) {
*/
this.renderedVisible_ = true;
/**
* @private
* @type {ol.Size}
*/
this.canvasSize_ = [container.clientHeight, container.clientWidth];
/**
* @private
* @type {WebGLRenderingContext}
@@ -564,10 +555,9 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
}
var size = frameState.size;
if (!ol.size.equals(this.canvasSize_, size)) {
if (!ol.size.equals([this.canvas_.width, this.canvas_.height], size)) {
this.canvas_.width = size[0];
this.canvas_.height = size[1];
this.canvasSize_ = size;
}
gl.bindFramebuffer(goog.webgl.FRAMEBUFFER, null);