In doClick()
when it calls doClick(pressTime)
does it send 68 milliseconds? Why did they decide on 68 instead of a more round number? Is it a completely arbitrary number?
From Java AbstractButton:
public void doClick() {
doClick(68);
}
It might have to do with how fast a human can click on average.
If you look at this timer, with a bit of excersise it's possible to reach the 68ms on average.
They might have simply made a setup like below, had a go at it to get on a nice average click duration and then used that for the default value.
var timer = 0;
var results = [];
$('#clicktest').on('mousedown',function() {
timer = window.performance.now();
});
$('#clicktest').on('mouseup',function() {
results.push(window.performance.now()-timer);
var total = 0;
for(c=0;c<results.length;c++) {
total+= results[c];
}
$('#output').text('Average click duration '+ Math.round(total/results.length)+'ms');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="clicktest">Click me</button>
<div id="output">Average click duration N/A</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With