Added namespaces
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
var MousePointer = function(camera) {
|
||||
L3D.MousePointer = function(camera) {
|
||||
|
||||
this.domElement = document.createElement('canvas');
|
||||
this.domElement.style.position = 'absolute';
|
||||
@@ -7,37 +7,37 @@ var MousePointer = function(camera) {
|
||||
this.size = 10;
|
||||
this.drawn = false;
|
||||
camera.mousePointer = this;
|
||||
this.style = MousePointer.NONE;
|
||||
this.style = L3D.MousePointer.NONE;
|
||||
};
|
||||
|
||||
MousePointer.NONE = 0;
|
||||
MousePointer.BLACK = 1;
|
||||
MousePointer.RED = 2;
|
||||
L3D.MousePointer.NONE = 0;
|
||||
L3D.MousePointer.BLACK = 1;
|
||||
L3D.MousePointer.RED = 2;
|
||||
|
||||
MousePointer.toColor = function(style) {
|
||||
L3D.MousePointer.toColor = function(style) {
|
||||
|
||||
switch (style) {
|
||||
|
||||
case MousePointer.NONE:
|
||||
case L3D.MousePointer.NONE:
|
||||
return null;
|
||||
case MousePointer.BLACK:
|
||||
case L3D.MousePointer.BLACK:
|
||||
return '#000000';
|
||||
case MousePointer.RED:
|
||||
case L3D.MousePointer.RED:
|
||||
return '#ff0000';
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
MousePointer.prototype.render = function(style) {
|
||||
L3D.MousePointer.prototype.render = function(style) {
|
||||
|
||||
if (this.style !== style) {
|
||||
|
||||
if (style === MousePointer.NONE) {
|
||||
if (style === L3D.MousePointer.NONE) {
|
||||
|
||||
// Clear canvas
|
||||
this.domElement.width = this.domElement.width;
|
||||
this.style = MousePointer.NONE;
|
||||
this.style = L3D.MousePointer.NONE;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -64,7 +64,7 @@ MousePointer.prototype.render = function(style) {
|
||||
this.ctx.stroke();
|
||||
|
||||
this.ctx.lineWidth = 2;
|
||||
this.ctx.strokeStyle = MousePointer.toColor(style);
|
||||
this.ctx.strokeStyle = L3D.MousePointer.toColor(style);
|
||||
this.ctx.stroke();
|
||||
|
||||
this.style = style;
|
||||
@@ -75,8 +75,8 @@ MousePointer.prototype.render = function(style) {
|
||||
|
||||
};
|
||||
|
||||
MousePointer.prototype.clear = function() {
|
||||
L3D.MousePointer.prototype.clear = function() {
|
||||
|
||||
this.render(MousePointer.NONE);
|
||||
this.render(L3D.MousePointer.NONE);
|
||||
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ Math.clamp = Math.clamp || function(number, min, max) {
|
||||
return Math.max(Math.min(number, max), min);
|
||||
};
|
||||
|
||||
var Previewer = function(renderer, scene) {
|
||||
L3D.Previewer = function(renderer, scene) {
|
||||
this.domElement = document.createElement('canvas');
|
||||
this.ctx = this.domElement.getContext('2d');
|
||||
this.renderer = renderer;
|
||||
@@ -12,7 +12,7 @@ var Previewer = function(renderer, scene) {
|
||||
this.drawnBefore = false;
|
||||
};
|
||||
|
||||
Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||
L3D.Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||
var width, height, left, bottom;
|
||||
|
||||
if (prev.go) {
|
||||
@@ -79,18 +79,18 @@ Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||
|
||||
};
|
||||
|
||||
Previewer.prototype.clear = function() {
|
||||
L3D.Previewer.prototype.clear = function() {
|
||||
if (this.clearNeeded) {
|
||||
this.domElement.width = this.domElement.width;
|
||||
this.clearNeeded = false;
|
||||
}
|
||||
};
|
||||
|
||||
Previewer.prototype.fixedRecommendation = function(bool) {
|
||||
L3D.Previewer.prototype.fixedRecommendation = function(bool) {
|
||||
this.fixed = bool;
|
||||
};
|
||||
|
||||
Previewer.prototype.update = function(arg) {
|
||||
L3D.Previewer.prototype.update = function(arg) {
|
||||
this.drawnBefore = this.drawn;
|
||||
this.drawn = arg;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var StartCanvas = function(camera) {
|
||||
L3D.StartCanvas = function(camera) {
|
||||
|
||||
this.domElement = document.createElement('canvas');
|
||||
this.domElement.style.position = 'absolute';
|
||||
@@ -10,7 +10,7 @@ var StartCanvas = function(camera) {
|
||||
|
||||
};
|
||||
|
||||
StartCanvas.prototype.render = function() {
|
||||
L3D.StartCanvas.prototype.render = function() {
|
||||
|
||||
if (!this.shown) {
|
||||
|
||||
@@ -30,7 +30,7 @@ StartCanvas.prototype.render = function() {
|
||||
|
||||
};
|
||||
|
||||
StartCanvas.prototype.clear = function() {
|
||||
L3D.StartCanvas.prototype.clear = function() {
|
||||
|
||||
if (this.shown) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user