diff options
Diffstat (limited to 'client/assets/javascripts/mx/primitives/mx.text.js')
| -rw-r--r-- | client/assets/javascripts/mx/primitives/mx.text.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/client/assets/javascripts/mx/primitives/mx.text.js b/client/assets/javascripts/mx/primitives/mx.text.js new file mode 100644 index 0000000..0c278a9 --- /dev/null +++ b/client/assets/javascripts/mx/primitives/mx.text.js @@ -0,0 +1,34 @@ +MX.Text = MX.Object3D.extend({ + init: function (ops) { + + this.type = "Text" + + var layer = new MX.Object3D('text') + layer.width = ops.width || 100 + layer.height = ops.height || 50 + layer.x = ops.x || 0 + layer.y = ops.y || 0 + layer.z = ops.z || 0 + layer.scale = ops.scale || 1 + layer.el.innerHTML = ops.value || "" + if (ops.id) layer.el.id = ops.id; + if (ops.background) layer.el.style.background = ops.background; + if (ops.color) layer.el.style.color = ops.color; + if (ops.fontSize) layer.el.style.fontSize = ops.fontSize + "px"; + + this.add(layer) + + this.children.forEach(function (c, i) { + if (ops.classname) { + c.el.classList.add(ops.classname) + } + else { + } + c.el.style.backgroundRepeat = 'no-repeat' + }) + + this.dirty = true + this.updateChildren = true + this.update() + } +}) |
