Skip to content

Commit f3f74b9

Browse files
more tweaking
1 parent 4d69e0b commit f3f74b9

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

js/elements.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,28 @@ function get_domrect(METRIC) {
3434
} else {
3535
value = zLIE
3636
// analyse noise
37-
let aDiffs = [], aProps = []
37+
let oDiffs = {}, aProps = [], max = 0
3838
let test = oDomRect[k]['data']
3939
for (const p of Object.keys(test)) {
4040
let diff = control[p] - test[p]
41+
if (Math.abs(diff) > max) {max = Math.abs(diff)}
4142
if (0 !== diff) {
4243
aProps.push(p)
43-
aDiffs.push(diff)
44+
if (undefined == oDiffs[diff]) {oDiffs[diff] = [p]} else {oDiffs[diff].push(p)}
4445
}
4546
}
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+
}
5759
}
5860
oDomRect[k].methods.forEach(function(method){tmpdata[method] = value})
5961
}

0 commit comments

Comments
 (0)