diff options
Diffstat (limited to 'public/assets/javascripts/mx/primitives/mx.embed.js')
| -rw-r--r-- | public/assets/javascripts/mx/primitives/mx.embed.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.embed.js b/public/assets/javascripts/mx/primitives/mx.embed.js new file mode 100644 index 0000000..f15ec98 --- /dev/null +++ b/public/assets/javascripts/mx/primitives/mx.embed.js @@ -0,0 +1,66 @@ +MX.Embed = MX.Object3D.extend({ + + init: function (ops) { + + this.type = "Embed" + + var layer = this + layer.media = ops.media + layer.width = ops.media.width + layer.height = ops.media.height + layer.x = ops.x || 0 + layer.y = ops.y || 0 + layer.z = ops.z || 0 + layer.scale = ops.scale || 1 + layer.backface = ops.backface || false + + if (layer.backface) { + layer.el.classList.add("backface-visible") + } + + if (ops.src) { + this.loadEmbed(ops) + } + + if (ops.className) { + layer.el.classList.add(ops.className) + } + layer.el.style.backgroundRepeat = 'no-repeat' + + }, + + loadEmbed: function(ops){ + var layer = this + layer.ops = defaults(ops, layer.ops) + +// layer.scale = layer.ops.scale || 1 +// layer.width = layer.ops.width || image.naturalWidth +// layer.height = layer.ops.height || image.naturalHeight +// layer.x = layer.ops.x || 0 +// layer.y = layer.ops.y || 0 +// layer.z = layer.ops.z || 0 +// layer.rotationX = layer.ops.rotationX || 0 +// layer.rotationY = layer.ops.rotationY || 0 +// layer.rotationZ = layer.ops.rotationZ || 0 +// layer.el.style.backgroundImage = "url(" + image.src + ")" +// layer.el.classList.add('image') +// layer.dirty = true +// layer.update() + }, + + move: function(ops){ + var layer = this + layer.ops = defaults(ops, layer.ops) + for (var i in ops) { + layer[i] = ops[i] + } + layer.dirty = true + layer.update() + }, + + toString: function(){ + var params = "id src width height depth x y z rotationX rotationY rotationZ scale".split(" ") + return this.__toString(params) + }, + +}) |
