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

@@ -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);
}