tracking.js
tracking.js copied to clipboard
Check the size of the rectangle
Hi!
Is it possible to check the dimensions of the rectangle? just like the color, width, height etc.
@tanerolcxy Believe you want something like this: `event.data.forEach(function(rect) { //Replace code here to do something else once working correctly
//draw basic rectangle around face colour black
context.strokeStyle = '#fff';
context.strokeRect(rect.x, rect.y, rect.width, rect.height);
// select size of font
context.font = '11px Helvetica';
//font colour
context.fillStyle = "#fff";
//text to be displayed around face rectangle(will be displayed on the right)
context.fillText('x: ' + rect.x + 'px', rect.x + rect.width + 5, rect.y + 11); // to show xpx
context.fillText('y: ' + rect.y + 'px', rect.x + rect.width + 5, rect.y + 22); // to show ypx
});
});`
This is taken from the example page so nothing here apart from comments are mine.