blob: 4b53610147d484e511815b51d14d710301175a59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
})()
|