File tree Expand file tree Collapse file tree
pages/photo-challenge-automation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 const title = 'Regions'
1010 const story = [ ]
1111 report ( group ( images , scale ) )
12+ const lat = item => item . text . split ( "," ) [ 0 ] * 1
13+ story . sort ( ( a , b ) => lat ( b ) - lat ( a ) )
1214 window . result . innerHTML = `<button>preview</button> regions`
1315 const preview = event => frame . open ( { title, story} , event . shiftKey )
1416 window . result . querySelector ( 'button' ) . addEventListener ( 'click' , preview )
15- console . log ( story )
17+ console . log ( story . map ( item => item . text . split ( "\n" ) [ 0 ] ) )
1618
1719 function group ( images , scale ) {
18- const square = loc => Math . round ( ( loc . latitude * 69 * scale ) - ( loc . longitude * 49 * scale ) )
20+ const square = loc =>
21+ Math . round ( loc . latitude * 69 * scale ) * 10000 -
22+ Math . round ( loc . longitude * 49 * scale )
1923 const regions = Object . values ( Object . groupBy ( images , image => square ( image . location ) ) )
20- regions . sort ( ( a , b ) => b [ 0 ] . location . latitude - a [ 0 ] . location . latitude )
21- // console.log(scale, regions)
2224 for ( let i = 0 ; i < regions . length ; i ++ )
23- if ( regions [ i ] . length > 14 )
24- regions [ i ] = group ( regions [ i ] , scale * 20 )
25+ if ( regions [ i ] . length > 20 )
26+ regions [ i ] = group ( regions [ i ] , scale * 2 )
2527 return regions
2628 }
2729
You can’t perform that action at this time.
0 commit comments