Preview at the bottom of mouse if too high

This commit is contained in:
Thomas FORGIONE 2015-05-21 14:31:18 +02:00
parent a6f637223f
commit c0a2044118
2 changed files with 8 additions and 2 deletions

View File

@ -14,6 +14,11 @@ Previewer.prototype.render = function(prev, container_width, container_height) {
if (!this.fixed) { if (!this.fixed) {
left = Math.floor(prev.x - width/2); left = Math.floor(prev.x - width/2);
bottom = Math.floor(this.renderer.domElement.height - prev.y + height/5); bottom = Math.floor(this.renderer.domElement.height - prev.y + height/5);
if (bottom + height > this.renderer.domElement.height) {
bottom -= 7 * height / 5;
console.log(bottom);
}
console.log(bottom, this.renderer.domElement.height);
} else { } else {
left = 0; left = 0;
bottom = 0; bottom = 0;

View File

@ -10,8 +10,8 @@ var CameraSelecter = function(renderer, cameras, buttonManager) {
CameraSelecter.prototype.pointedCamera = function() { CameraSelecter.prototype.pointedCamera = function() {
var returnCamera; var returnCamera;
var x = ( this.mouse.x / renderer.domElement.width ) * 2 - 1; var x = ( this.mouse.x / this.renderer.domElement.width ) * 2 - 1;
var y = - (this.mouse.y / renderer.domElement.height) * 2 + 1; var y = - (this.mouse.y / this.renderer.domElement.height) * 2 + 1;
var camera = this.cameras.mainCamera(); var camera = this.cameras.mainCamera();
@ -52,6 +52,7 @@ CameraSelecter.prototype.pointedCamera = function() {
// } // }
} }
} }
this.currentPointedCamera = null;
} }
CameraSelecter.prototype.update = function(event) { CameraSelecter.prototype.update = function(event) {