From c0a20441189614f5ee723382fbfe639114249088 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Thu, 21 May 2015 14:31:18 +0200 Subject: [PATCH] Preview at the bottom of mouse if too high --- static/js/prototype/Previewer.js | 5 +++++ static/js/prototype/raycasterTools.js | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/static/js/prototype/Previewer.js b/static/js/prototype/Previewer.js index 4211183..60b6136 100644 --- a/static/js/prototype/Previewer.js +++ b/static/js/prototype/Previewer.js @@ -14,6 +14,11 @@ Previewer.prototype.render = function(prev, container_width, container_height) { if (!this.fixed) { left = Math.floor(prev.x - width/2); 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 { left = 0; bottom = 0; diff --git a/static/js/prototype/raycasterTools.js b/static/js/prototype/raycasterTools.js index a16013f..38e75fd 100644 --- a/static/js/prototype/raycasterTools.js +++ b/static/js/prototype/raycasterTools.js @@ -10,8 +10,8 @@ var CameraSelecter = function(renderer, cameras, buttonManager) { CameraSelecter.prototype.pointedCamera = function() { var returnCamera; - var x = ( this.mouse.x / renderer.domElement.width ) * 2 - 1; - var y = - (this.mouse.y / renderer.domElement.height) * 2 + 1; + var x = ( this.mouse.x / this.renderer.domElement.width ) * 2 - 1; + var y = - (this.mouse.y / this.renderer.domElement.height) * 2 + 1; var camera = this.cameras.mainCamera(); @@ -52,6 +52,7 @@ CameraSelecter.prototype.pointedCamera = function() { // } } } + this.currentPointedCamera = null; } CameraSelecter.prototype.update = function(event) {