diff options
Diffstat (limited to 'js/lib/canvasmx.js')
| -rw-r--r-- | js/lib/canvasmx.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/js/lib/canvasmx.js b/js/lib/canvasmx.js new file mode 100644 index 0000000..4b53610 --- /dev/null +++ b/js/lib/canvasmx.js @@ -0,0 +1,35 @@ +var CanvasMX = (function(){ + + function CanvasMX (w, h) { + w = w || 100 + h = h || 100 + var canvas = this.canvas = document.createElement("canvas") + canvas.width = w + canvas.height = h + this.ctx = canvas.getContext('2d') + var mx = this.mx = new MX.Object3D () + this.el = mx.el + mx.el.appendChild(canvas) + scene.add(mx) + } + CanvasMX.prototype.resize = function(w, h){ + this.canvas.width = w + this.canvas.height = h + this.mx.width = w + this.mx.height = h + } + CanvasMX.prototype.clear = function(){ + this.snap.clear() + } + CanvasMX.prototype.show = function(){ + this.visible = true + this.mx.style.display = "block" + } + CanvasMX.prototype.hide = function(){ + this.visible = false + this.mx.style.display = "hide" + } + + return CanvasMX + +})()
\ No newline at end of file |
