30
30
// Find a JSON element / object with a particular value in the json data
31
31
function findElement ( arr , propName , propValue ) {
32
32
// Loop through array looking for a matching element
33
- for ( var i = 0 ; i < arr . length ; i ++ )
34
- if ( arr [ i ] [ propName ] === propValue )
33
+ for ( var i = 0 ; i < arr . length ; i ++ ) {
34
+ if ( arr [ i ] [ propName ] === propValue ) {
35
35
return arr [ i ] ;
36
+ }
37
+ }
36
38
37
39
}
38
40
@@ -41,9 +43,11 @@ function getTrackContainerHeight() {
41
43
42
44
var track_margin = 0 ;
43
45
var track_object = $ ( ".track" ) ;
44
- if ( track_object . length )
45
- if ( track_object . css ( "margin-bottom" ) )
46
- track_margin = parseInt ( track_object . css ( "margin-bottom" ) . replace ( "px" , "" ) ) ;
46
+ if ( track_object . length ) {
47
+ if ( track_object . css ( "margin-bottom" ) ) {
48
+ track_margin = parseInt ( track_object . css ( "margin-bottom" ) . replace ( "px" , "" ) , 10 ) ;
49
+ }
50
+ }
47
51
48
52
return $ ( "#track-container" ) . height ( ) - track_margin ;
49
53
}
@@ -173,12 +177,13 @@ function findTrackAtLocation(scope, top) {
173
177
var layer = scope . project . layers [ layer_index ] ;
174
178
175
179
// Compare position of track to Y param (of unlocked tracks)
176
- if ( ! layer . lock )
180
+ if ( ! layer . lock ) {
177
181
if ( ( top < layer . y && top > track_position ) || track_position === 0 ) {
178
182
// return first matching layer
179
183
track_position = layer . y ;
180
184
track_number = layer . number ;
181
185
}
186
+ }
182
187
}
183
188
184
189
return track_number ;
@@ -223,16 +228,16 @@ function setBoundingBox(scope, item) {
223
228
bounding_box . width = item . width ( ) ;
224
229
} else {
225
230
//compare and change if item is a better fit for bounding box edges
226
- if ( item_top < bounding_box . top ) bounding_box . top = item_top ;
227
- if ( item_left < bounding_box . left ) bounding_box . left = item_left ;
228
- if ( item_bottom > bounding_box . bottom ) bounding_box . bottom = item_bottom ;
229
- if ( item_right > bounding_box . right ) bounding_box . right = item_right ;
231
+ if ( item_top < bounding_box . top ) { bounding_box . top = item_top } ;
232
+ if ( item_left < bounding_box . left ) { bounding_box . left = item_left } ;
233
+ if ( item_bottom > bounding_box . bottom ) { bounding_box . bottom = item_bottom } ;
234
+ if ( item_right > bounding_box . right ) { bounding_box . right = item_right } ;
230
235
231
236
// compare height and width of bounding box (take the largest number)
232
237
var height = bounding_box . bottom - bounding_box . top ;
233
238
var width = bounding_box . right - bounding_box . left ;
234
- if ( height > bounding_box . height ) bounding_box . height = height ;
235
- if ( width > bounding_box . width ) bounding_box . width = width ;
239
+ if ( height > bounding_box . height ) { bounding_box . height = height } ;
240
+ if ( width > bounding_box . width ) { bounding_box . width = width } ;
236
241
}
237
242
238
243
// Get list of current selected ids (so we can ignore their snapping x coordinates)
0 commit comments