From fbf05115c17163d91e9f649a348e3e6800a22d5e Mon Sep 17 00:00:00 2001 From: Jules Date: Sun, 11 Sep 2016 10:19:07 -0400 Subject: init latest version of harp --- js/lib/snapmx.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 js/lib/snapmx.js (limited to 'js/lib/snapmx.js') 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 -- cgit v1.2.3-70-g09d2