55 * @license MIT License
66 * @description Comment abstraction based on DOM implementation
77 */
8- /// <reference path=" Core.d.ts" />
9- /// <reference path=" CommentUtils.ts" />
8+ /// <reference path=' Core.d.ts' />
9+ /// <reference path=' CommentUtils.ts' />
1010class CoreComment implements IComment {
1111 public static LINEAR :Function = function ( t :number , b :number , c :number , d :number ) :number {
1212 return t * c / d + b ;
1313 } ;
1414
1515 public mode :number = 1 ;
1616 public stime :number = 0 ;
17- public text :string = "" ;
17+ public text :string = '' ;
1818 public ttl :number = 4000 ;
1919 public dur :number = 4000 ;
2020 public cindex :number = - 1 ;
@@ -53,46 +53,46 @@ class CoreComment implements IComment {
5353 private _color :number = 0xffffff ;
5454 private _border :boolean = false ;
5555 private _shadow :boolean = true ;
56- private _font :string = "" ;
56+ private _font :string = '' ;
5757 private _transform :CommentUtils . Matrix3D = null ;
5858
5959 public parent :ICommentManager ;
6060 public dom :HTMLDivElement ;
6161
6262 constructor ( parent :ICommentManager , init :Object = { } ) {
6363 if ( ! parent ) {
64- throw new Error ( " Comment not bound to comment manager." ) ;
64+ throw new Error ( ' Comment not bound to comment manager.' ) ;
6565 } else {
6666 this . parent = parent ;
6767 }
68- if ( init . hasOwnProperty ( " stime" ) ) {
69- this . stime = init [ " stime" ] ;
68+ if ( init . hasOwnProperty ( ' stime' ) ) {
69+ this . stime = init [ ' stime' ] ;
7070 }
71- if ( init . hasOwnProperty ( " mode" ) ) {
72- this . mode = init [ " mode" ] ;
71+ if ( init . hasOwnProperty ( ' mode' ) ) {
72+ this . mode = init [ ' mode' ] ;
7373 } else {
7474 this . mode = 1 ;
7575 }
76- if ( init . hasOwnProperty ( " dur" ) ) {
77- this . dur = init [ " dur" ] ;
76+ if ( init . hasOwnProperty ( ' dur' ) ) {
77+ this . dur = init [ ' dur' ] ;
7878 this . ttl = this . dur ;
7979 }
8080 this . dur *= this . parent . options . global . scale ;
8181 this . ttl *= this . parent . options . global . scale ;
82- if ( init . hasOwnProperty ( " text" ) ) {
83- this . text = init [ " text" ] ;
82+ if ( init . hasOwnProperty ( ' text' ) ) {
83+ this . text = init [ ' text' ] ;
8484 }
85- if ( init . hasOwnProperty ( " motion" ) ) {
85+ if ( init . hasOwnProperty ( ' motion' ) ) {
8686 this . _motionStart = [ ] ;
8787 this . _motionEnd = [ ] ;
88- this . motion = init [ " motion" ] ;
88+ this . motion = init [ ' motion' ] ;
8989 var head = 0 ;
9090 for ( var i = 0 ; i < init [ 'motion' ] . length ; i ++ ) {
9191 this . _motionStart . push ( head ) ;
9292 var maxDur = 0 ;
9393 for ( var k in init [ 'motion' ] [ i ] ) {
9494 var m = < IMotion > init [ 'motion' ] [ i ] [ k ] ;
95- maxDur = Math . max ( m . dur , maxDur ) ;
95+ maxDur = Math . max ( m . dur + m . delay , maxDur ) ;
9696 if ( m . easing === null || m . easing === undefined ) {
9797 init [ 'motion' ] [ i ] [ k ] [ 'easing' ] = CoreComment . LINEAR ;
9898 }
@@ -108,29 +108,29 @@ class CoreComment implements IComment {
108108 if ( init . hasOwnProperty ( 'size' ) ) {
109109 this . _size = init [ 'size' ] ;
110110 }
111- if ( init . hasOwnProperty ( " border" ) ) {
112- this . _border = init [ " border" ] ;
111+ if ( init . hasOwnProperty ( ' border' ) ) {
112+ this . _border = init [ ' border' ] ;
113113 }
114- if ( init . hasOwnProperty ( " opacity" ) ) {
115- this . _alpha = init [ " opacity" ] ;
114+ if ( init . hasOwnProperty ( ' opacity' ) ) {
115+ this . _alpha = init [ ' opacity' ] ;
116116 }
117- if ( init . hasOwnProperty ( " alpha" ) ) {
118- this . _alphaMotion = init [ " alpha" ] ;
117+ if ( init . hasOwnProperty ( ' alpha' ) ) {
118+ this . _alphaMotion = init [ ' alpha' ] ;
119119 }
120- if ( init . hasOwnProperty ( " font" ) ) {
121- this . _font = init [ " font" ] ;
120+ if ( init . hasOwnProperty ( ' font' ) ) {
121+ this . _font = init [ ' font' ] ;
122122 }
123- if ( init . hasOwnProperty ( "x" ) ) {
124- this . _x = init [ "x" ] ;
123+ if ( init . hasOwnProperty ( 'x' ) ) {
124+ this . _x = init [ 'x' ] ;
125125 }
126- if ( init . hasOwnProperty ( "y" ) ) {
127- this . _y = init [ "y" ] ;
126+ if ( init . hasOwnProperty ( 'y' ) ) {
127+ this . _y = init [ 'y' ] ;
128128 }
129- if ( init . hasOwnProperty ( " shadow" ) ) {
130- this . _shadow = init [ " shadow" ] ;
129+ if ( init . hasOwnProperty ( ' shadow' ) ) {
130+ this . _shadow = init [ ' shadow' ] ;
131131 }
132- if ( init . hasOwnProperty ( " align" ) ) {
133- this . align = init [ " align" ] ;
132+ if ( init . hasOwnProperty ( ' align' ) ) {
133+ this . align = init [ ' align' ] ;
134134 }
135135 if ( init . hasOwnProperty ( 'axis' ) ) {
136136 this . axis = init [ 'axis' ] ;
@@ -353,7 +353,7 @@ class CoreComment implements IComment {
353353 set shadow ( s :boolean ) {
354354 this . _shadow = s ;
355355 if ( ! this . _shadow ) {
356- this . dom . className = this . parent . options . global . className + " noshadow" ;
356+ this . dom . className = this . parent . options . global . className + ' noshadow' ;
357357 }
358358 }
359359
0 commit comments