Bugs, cleaning, and tutorial improved

This commit is contained in:
Thomas FORGIONE
2015-07-09 11:44:54 +02:00
parent 9158ec36bc
commit 7d449db916
11 changed files with 58 additions and 22 deletions

View File

@@ -440,7 +440,9 @@ L3D.PointerCamera.prototype.move = function(recommendation, toSave) {
var otherCamera = recommendation.camera || recommendation;
this.movingHermite = false;
this.moving = true;
this.new_target = otherCamera.target.clone();
this.new_position = otherCamera.position.clone();
var t = [0,1];
@@ -469,6 +471,7 @@ L3D.PointerCamera.prototype.moveHermite = function(recommendation, toSave) {
var otherCamera = recommendation.camera || recommendation;
this.moving = false;
this.movingHermite = true;
this.t = 0;

View File

@@ -179,3 +179,18 @@ L3D.MousePointer.prototype.clear = function(force) {
this.render(L3D.MousePointer.NONE, force);
};
/**
* Sets the size of the canvas
* @param {Number} width the new width of the canvas
* @param {Number} height the new height of the canvas
*/
L3D.MousePointer.prototype.setSize = function(width, height) {
this.domElement.width = width;
this.domElement.height = height;
this.render(this.style, true);
};

View File

@@ -173,3 +173,8 @@ L3D.Previewer.prototype.setPosition = function(x, y) {
this.mouse.x = x;
this.mouse.y = y;
}
L3D.Previewer.prototype.setSize = function(width, height) {
this.domElement.width = width;
this.domElement.height = height;
}

View File

@@ -30,11 +30,12 @@ L3D.StartCanvas = function(camera) {
};
/**
* Shows the canvas with a string in the middle of it
* Shows the canvas with a string in the middle of it (not done if already shown)
* @param {Boolean} force force the rendering
*/
L3D.StartCanvas.prototype.render = function() {
L3D.StartCanvas.prototype.render = function(force) {
if (!this.shown) {
if (!this.shown || force) {
this.ctx.fillStyle = 'white';
this.ctx.globalAlpha = 0.7;
@@ -67,3 +68,19 @@ L3D.StartCanvas.prototype.clear = function() {
}
};
/**
* Sets the size of the canvas
* @param {Number} width new width of the canvas
* @param {Number} height new height of the canvas
*/
L3D.StartCanvas.prototype.setSize = function(width, height) {
this.domElement.width = width;
this.domElement.height = height;
// If the canvas was shown, redraw it
if (this.shown)
this.render(true);
}

View File

@@ -91,8 +91,6 @@ L3D.BaseRecommendation.prototype.check = function() {
*/
L3D.BaseRecommendation.prototype.initExtremity = function() {
console.log("Init");
var geometry = new THREE.Geometry();
var direction = this.camera.target.clone();