blob: 957c41aaf26c96061cea522dcc280c06df8d7402 [file] [log] [blame]
function addToLog(s)
{
let logging = document.getElementById('logging');
logging.textContent += s + "\n";
logging.scrollTop = 400000;
}
function clearLog()
{
let logging = document.getElementById('logging');
logging.textContent = '';
}
function stringFromRect(rect)
{
return `${rect.x}, ${rect.y} ${rect.width} x ${rect.height}`;
}
function intersectedCallback(entries)
{
addToLog('');
for (var entry of entries) {
addToLog('time: ' + entry.time.toFixed(2));
addToLog('intersection: ' + stringFromRect(entry.intersectionRect));
addToLog('intersection ratio: ' + entry.intersectionRatio.toFixed(3));
}
}