summaryrefslogtreecommitdiff
path: root/js/lib/snapmx.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/snapmx.js')
-rw-r--r--js/lib/snapmx.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/lib/snapmx.js b/js/lib/snapmx.js
new file mode 100644
index 0000000..4deb729
--- /dev/null
+++ b/js/lib/snapmx.js
@@ -0,0 +1,33 @@
+var SnapMX = (function(){
+
+ function SnapMX (w, h) {
+ w = w || 100
+ h = h || 100
+ var snap = this.snap = new Snap (w, h)
+ var el = this.el = snap.node
+ var mx = this.mx = new MX.Object3D (el)
+ scene.add(mx)
+ }
+ SnapMX.prototype.resize = function(w, h){
+ this.snap.attr({
+ width: w,
+ height: h|0,
+ })
+ this.mx.width = w
+ this.mx.height = h
+ }
+ SnapMX.prototype.clear = function(){
+ this.snap.clear()
+ }
+ SnapMX.prototype.show = function(){
+ this.visible = true
+ this.mx.style.display = "block"
+ }
+ SnapMX.prototype.hide = function(){
+ this.visible = false
+ this.mx.style.display = "hide"
+ }
+
+ return SnapMX
+
+})() \ No newline at end of file