(parent:ICommentManager, init:Object = {})
| 60 | public dom:HTMLDivElement; |
| 61 | |
| 62 | constructor(parent:ICommentManager, init:Object = {}) { |
| 63 | if (!parent) { |
| 64 | throw new Error('Comment not bound to comment manager.'); |
| 65 | } else { |
| 66 | this.parent = parent; |
| 67 | } |
| 68 | if (init.hasOwnProperty('stime')) { |
| 69 | this.stime = init['stime']; |
| 70 | } |
| 71 | if (init.hasOwnProperty('mode')) { |
| 72 | this.mode = init['mode']; |
| 73 | } else { |
| 74 | this.mode = 1; |
| 75 | } |
| 76 | if (init.hasOwnProperty('dur')) { |
| 77 | this.dur = init['dur']; |
| 78 | this.ttl = this.dur; |
| 79 | } |
| 80 | this.dur *= this.parent.options.global.scale; |
| 81 | this.ttl *= this.parent.options.global.scale; |
| 82 | if (init.hasOwnProperty('text')) { |
| 83 | this.text = init['text']; |
| 84 | } |
| 85 | if (init.hasOwnProperty('motion')) { |
| 86 | this._motionStart = []; |
| 87 | this._motionEnd = []; |
| 88 | this.motion = init['motion']; |
| 89 | var head = 0; |
| 90 | for (var i = 0; i < init['motion'].length; i++) { |
| 91 | this._motionStart.push(head); |
| 92 | var maxDur = 0; |
| 93 | for (var k in init['motion'][i]) { |
| 94 | var m = <IMotion> init['motion'][i][k]; |
| 95 | maxDur = Math.max(m.dur + m.delay, maxDur); |
| 96 | if (m.easing === null || m.easing === undefined) { |
| 97 | init['motion'][i][k]['easing'] = CoreComment.LINEAR; |
| 98 | } |
| 99 | } |
| 100 | head += maxDur; |
| 101 | this._motionEnd.push(head); |
| 102 | } |
| 103 | this._curMotion = 0; |
| 104 | } |
| 105 | if (init.hasOwnProperty('color')) { |
| 106 | this._color = init['color']; |
| 107 | } |
| 108 | if (init.hasOwnProperty('size')) { |
| 109 | this._size = init['size']; |
| 110 | } |
| 111 | if (init.hasOwnProperty('border')) { |
| 112 | this._border = init['border']; |
| 113 | } |
| 114 | if (init.hasOwnProperty('opacity')) { |
| 115 | this._alpha = init['opacity']; |
| 116 | } |
| 117 | if (init.hasOwnProperty('alpha')) { |
| 118 | this._alphaMotion = init['alpha']; |
| 119 | } |
nothing calls this directly
no test coverage detected