@@ -893,7 +893,7 @@ function clamp(x, min, max) {
893893}
894894
895895function wobble ( x1 , y1 , x2 , y2 ) {
896- assert ( _ . all ( [ x1 , x2 , y1 , y2 ] , _ . isFinite ) , 'x1,x2,y1,y2 must be numeric' ) ;
896+ assert ( _ . every ( [ x1 , x2 , y1 , y2 ] , _ . isFinite ) , 'x1,x2,y1,y2 must be numeric' ) ;
897897
898898 // Wobble no more than 1/25 of the line length
899899 var factor = Math . sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) / 25 ;
@@ -925,7 +925,7 @@ function wobble(x1, y1, x2, y2) {
925925 * Draws a wobbly (hand drawn) rect
926926 */
927927function handRect ( x , y , w , h ) {
928- assert ( _ . all ( [ x , y , w , h ] , _ . isFinite ) , 'x, y, w, h must be numeric' ) ;
928+ assert ( _ . every ( [ x , y , w , h ] , _ . isFinite ) , 'x, y, w, h must be numeric' ) ;
929929 return 'M' + x + ',' + y +
930930 wobble ( x , y , x + w , y ) +
931931 wobble ( x + w , y , x + w , y + h ) +
@@ -937,7 +937,7 @@ function handRect(x, y, w, h) {
937937 * Draws a wobbly (hand drawn) line
938938 */
939939function handLine ( x1 , y1 , x2 , y2 ) {
940- assert ( _ . all ( [ x1 , x2 , y1 , y2 ] , _ . isFinite ) , 'x1,x2,y1,y2 must be numeric' ) ;
940+ assert ( _ . every ( [ x1 , x2 , y1 , y2 ] , _ . isFinite ) , 'x1,x2,y1,y2 must be numeric' ) ;
941941 return 'M' + x1 . toFixed ( 1 ) + ',' + y1 . toFixed ( 1 ) + wobble ( x1 , y1 , x2 , y2 ) ;
942942}
943943
@@ -1001,7 +1001,7 @@ _.extend(BaseTheme.prototype, {
10011001 diagram . height += title . height ;
10021002 }
10031003
1004- _ . each ( actors , function ( a ) {
1004+ _ . each ( actors , _ . bind ( function ( a ) {
10051005 var bb = this . textBBox ( a . name , font ) ;
10061006 a . textBB = bb ;
10071007
@@ -1012,7 +1012,7 @@ _.extend(BaseTheme.prototype, {
10121012 a . distances = [ ] ;
10131013 a . paddingRight = 0 ;
10141014 this . actorsHeight_ = Math . max ( a . height , this . actorsHeight_ ) ;
1015- } , this ) ;
1015+ } , this ) ) ;
10161016
10171017 function actorEnsureDistance ( a , b , d ) {
10181018 assert ( a < b , 'a must be less than or equal to b' ) ;
@@ -1031,14 +1031,13 @@ _.extend(BaseTheme.prototype, {
10311031 }
10321032 }
10331033
1034- _ . each ( signals , function ( s ) {
1034+ _ . each ( signals , _ . bind ( function ( s ) {
10351035 // Indexes of the left and right actors involved
10361036 var a ;
10371037 var b ;
10381038
10391039 var bb = this . textBBox ( s . message , font ) ;
10401040
1041- //var bb = t.attr("text", s.message).getBBox();
10421041 s . textBB = bb ;
10431042 s . width = bb . width ;
10441043 s . height = bb . height ;
@@ -1096,7 +1095,7 @@ _.extend(BaseTheme.prototype, {
10961095
10971096 actorEnsureDistance ( a , b , s . width + extraWidth ) ;
10981097 this . signalsHeight_ += s . height ;
1099- } , this ) ;
1098+ } , this ) ) ;
11001099
11011100 // Re-jig the positions
11021101 var actorsX = 0 ;
@@ -1117,7 +1116,7 @@ _.extend(BaseTheme.prototype, {
11171116 } ) ;
11181117
11191118 actorsX = a . x + a . width + a . paddingRight ;
1120- } , this ) ;
1119+ } ) ;
11211120
11221121 diagram . width = Math . max ( actorsX , diagram . width ) ;
11231122
@@ -1141,7 +1140,7 @@ _.extend(BaseTheme.prototype, {
11411140
11421141 drawActors : function ( offsetY ) {
11431142 var y = offsetY ;
1144- _ . each ( this . diagram . actors , function ( a ) {
1143+ _ . each ( this . diagram . actors , _ . bind ( function ( a ) {
11451144 // Top box
11461145 this . drawActor ( a , y , this . actorsHeight_ ) ;
11471146
@@ -1153,7 +1152,7 @@ _.extend(BaseTheme.prototype, {
11531152 this . drawLine (
11541153 aX , y + this . actorsHeight_ - ACTOR_MARGIN ,
11551154 aX , y + this . actorsHeight_ + ACTOR_MARGIN + this . signalsHeight_ ) ;
1156- } , this ) ;
1155+ } , this ) ) ;
11571156 } ,
11581157
11591158 drawActor : function ( actor , offsetY , height ) {
@@ -1164,7 +1163,7 @@ _.extend(BaseTheme.prototype, {
11641163
11651164 drawSignals : function ( offsetY ) {
11661165 var y = offsetY ;
1167- _ . each ( this . diagram . signals , function ( s ) {
1166+ _ . each ( this . diagram . signals , _ . bind ( function ( s ) {
11681167 // TODO Add debug mode, that draws padding/margin box
11691168 if ( s . type == 'Signal' ) {
11701169 if ( s . isSelf ( ) ) {
@@ -1178,7 +1177,7 @@ _.extend(BaseTheme.prototype, {
11781177 }
11791178
11801179 y += s . height ;
1181- } , this ) ;
1180+ } , this ) ) ;
11821181 } ,
11831182
11841183 drawSelfSignal : function ( signal , offsetY ) {
@@ -1433,7 +1432,9 @@ if (typeof Snap != 'undefined') {
14331432 } ,
14341433
14351434 createText : function ( text , font ) {
1436- text = _ . invoke ( text . split ( '\n' ) , 'trim' ) ;
1435+ text = text . split ( '\n' ) . map ( function ( x ) {
1436+ return x . trim ( ) ;
1437+ } ) ;
14371438 var t = this . paper_ . text ( 0 , 0 , text ) ;
14381439 t . attr ( font || { } ) ;
14391440 if ( text . length > 1 ) {
@@ -1581,7 +1582,7 @@ if (typeof Raphael != 'undefined') {
15811582 * Raphaël extras
15821583 ******************/
15831584 Raphael . fn . line = function ( x1 , y1 , x2 , y2 ) {
1584- assert ( _ . all ( [ x1 , x2 , y1 , y2 ] , _ . isFinite ) , 'x1,x2,y1,y2 must be numeric' ) ;
1585+ assert ( _ . every ( [ x1 , x2 , y1 , y2 ] , _ . isFinite ) , 'x1,x2,y1,y2 must be numeric' ) ;
15851586 return this . path ( 'M{0},{1} L{2},{3}' , x1 , y1 , x2 , y2 ) ;
15861587 } ;
15871588
@@ -1640,8 +1641,9 @@ if (typeof Raphael != 'undefined') {
16401641 * Strip whitespace from each newline
16411642 */
16421643 cleanText : function ( text ) {
1643- text = _ . invoke ( text . split ( '\n' ) , 'trim' ) ;
1644- return text . join ( '\n' ) ;
1644+ return text . split ( '\n' ) . map ( function ( x ) {
1645+ return x . trim ( ) ;
1646+ } ) . join ( '\n' ) ;
16451647 } ,
16461648
16471649 /**
0 commit comments