blob: 8db28d0433510fc30e17703c1e7fef282fdaedd2 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
MX.Text = MX.Object3D.extend({
init: function (ops) {
this.type = "Text"
this.type = "Image"
this.media = ops.media
this.width = 0
this.height = 0
this.x = ops.x || 0
this.y = ops.y || 0
this.z = ops.z || 0
this.scale = ops.scale || 1
this.backface = ops.backface || false
this.scale = ops.scale || 1
this.width = ops.media.width
this.height = ops.media.height
this.x = ops.x || 0
this.y = ops.y || 0
this.z = ops.z || 0
this.rotationX = ops.rotationX || 0
this.rotationY = ops.rotationY || 0
this.rotationZ = ops.rotationZ || 0
ops.className && this.el.classList.add(ops.className)
this.backface && this.el.classList.add("backface-visible")
this.el.classList.add("mx-text")
this.el.classList.add("mx-scenery")
this.inner = document.createElement("div")
this.inner.classList.add("inner")
this.el.appendChild(this.inner)
this.load(ops)
},
load: function(ops){
var media = ops.media
if (media.color) this.el.style.color = media.color;
if (media.font) this.setFont(media.font)
if (media.align) this.setAlign(media.align)
this.setText( media.description )
},
setAlign: function(align) {
this.el.style.textAlign = "align"
},
setFont: function(font){
console.log(font)
this.inner.style.fontFamily = "'" + font.family + "',sans-serif"
this.el.style.fontSize = (2 * font.size) + "pt"
},
setText: function(text){
this.inner.innerHTML = marked( text || "" )
},
})
|