@@ -34,26 +34,28 @@ function get_domrect(METRIC) {
34
34
} else {
35
35
value = zLIE
36
36
// analyse noise
37
- let aDiffs = [ ] , aProps = [ ]
37
+ let oDiffs = { } , aProps = [ ] , max = 0
38
38
let test = oDomRect [ k ] [ 'data' ]
39
39
for ( const p of Object . keys ( test ) ) {
40
40
let diff = control [ p ] - test [ p ]
41
+ if ( Math . abs ( diff ) > max ) { max = Math . abs ( diff ) }
41
42
if ( 0 !== diff ) {
42
43
aProps . push ( p )
43
- aDiffs . push ( diff )
44
+ if ( undefined == oDiffs [ diff ] ) { oDiffs [ diff ] = [ p ] } else { oDiffs [ diff ] . push ( p ) }
44
45
}
45
46
}
46
- // dedupe
47
- //console.log(METRIC, "all", aDiffs)
48
- // x + left | top + right = the same in CB
49
- // so even though we have 3 unique values, it returns 6 unique values
50
- // ToDo: squeeze more entropy out: what pairs up? etc
51
- // also how much things move: e.g. abs(0.005) is about the most for CB
52
- aDiffs = aDiffs . filter ( function ( item , position ) { return aDiffs . indexOf ( item ) === position } )
53
- //console.log("deduped", aDiffs)
54
-
55
- let propsChanged = aProps . length == 8 ? 'all' : aProps . join ( ', ' )
56
- value = zLIE + ' | ' + propsChanged + ' | ' + aDiffs . length
47
+ let multiples = [ ]
48
+ for ( const m of Object . keys ( oDiffs ) ) {
49
+ if ( oDiffs [ m ] . length > 1 ) { multiples . push ( oDiffs [ m ] . join ( ' + ' ) ) }
50
+ }
51
+ console . log ( k , oDiffs , multiples , max )
52
+ max = ( max > 0.01 ? '>' : '<' ) + ' 0.01'
53
+ value = {
54
+ 'properties' : aProps . length == 8 ? 'all' : aProps . join ( ', ' ) ,
55
+ 'range' : '± ' + max ,
56
+ 'same' : ( multiples . length ? multiples : 'none' ) ,
57
+ 'total' : Object . keys ( oDiffs ) . length
58
+ }
57
59
}
58
60
oDomRect [ k ] . methods . forEach ( function ( method ) { tmpdata [ method ] = value } )
59
61
}
0 commit comments