update camera aspect ratios when renderer size updates
parent
b72854c95b
commit
de0cad37ab
|
@ -279,20 +279,34 @@ GameLib.D3.Renderer.prototype.updateInstance = function(property) {
|
||||||
if (property === 'width') {
|
if (property === 'width') {
|
||||||
|
|
||||||
trueWidth = this.width * this.windowSize.x;
|
trueWidth = this.width * this.windowSize.x;
|
||||||
|
trueHeight = this.height * this.windowSize.y;
|
||||||
|
|
||||||
this.canvas.width = trueWidth;
|
this.canvas.width = trueWidth;
|
||||||
this.canvas.updateInstance('width');
|
this.canvas.updateInstance('width');
|
||||||
|
|
||||||
|
this.camera.aspect = trueWidth / trueHeight;
|
||||||
|
this.camera.updateInstance('aspect');
|
||||||
|
|
||||||
|
this.editCamera.aspect = trueWidth / trueHeight;
|
||||||
|
this.editCamera.updateInstance('aspect');
|
||||||
|
|
||||||
this.instance.setSize(trueWidth, this.height * this.windowSize.y);
|
this.instance.setSize(trueWidth, this.height * this.windowSize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'height') {
|
if (property === 'height') {
|
||||||
|
|
||||||
|
trueWidth = this.width * this.windowSize.x;
|
||||||
trueHeight = this.height * this.windowSize.y;
|
trueHeight = this.height * this.windowSize.y;
|
||||||
|
|
||||||
this.canvas.height = trueHeight;
|
this.canvas.height = trueHeight;
|
||||||
this.canvas.updateInstance('height');
|
this.canvas.updateInstance('height');
|
||||||
|
|
||||||
|
this.camera.aspect = trueWidth / trueHeight;
|
||||||
|
this.camera.updateInstance('aspect');
|
||||||
|
|
||||||
|
this.editCamera.aspect = trueWidth / trueHeight;
|
||||||
|
this.editCamera.updateInstance('aspect');
|
||||||
|
|
||||||
this.instance.setSize(this.width * this.windowSize.x, trueHeight);
|
this.instance.setSize(this.width * this.windowSize.x, trueHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,6 +321,12 @@ GameLib.D3.Renderer.prototype.updateInstance = function(property) {
|
||||||
this.canvas.updateInstance('width');
|
this.canvas.updateInstance('width');
|
||||||
this.canvas.updateInstance('height');
|
this.canvas.updateInstance('height');
|
||||||
|
|
||||||
|
this.camera.aspect = trueWidth / trueHeight;
|
||||||
|
this.camera.updateInstance('aspect');
|
||||||
|
|
||||||
|
this.editCamera.aspect = trueWidth / trueHeight;
|
||||||
|
this.editCamera.updateInstance('aspect');
|
||||||
|
|
||||||
this.instance.setSize(trueWidth, trueHeight);
|
this.instance.setSize(trueWidth, trueHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,6 +466,12 @@ GameLib.D3.Renderer.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
this.canvas.instance.style.left = (this.offset.x * this.windowSize.x) + 'px';
|
this.canvas.instance.style.left = (this.offset.x * this.windowSize.x) + 'px';
|
||||||
this.canvas.instance.style.top = (this.offset.y * this.windowSize.y) + 'px';
|
this.canvas.instance.style.top = (this.offset.y * this.windowSize.y) + 'px';
|
||||||
|
|
||||||
|
this.camera.aspect = trueWidth / trueHeight;
|
||||||
|
this.camera.updateInstance('aspect');
|
||||||
|
|
||||||
|
this.editCamera.aspect = trueWidth / trueHeight;
|
||||||
|
this.editCamera.updateInstance('aspect');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'offset') {
|
if (property === 'offset') {
|
||||||
|
|
Loading…
Reference in New Issue