tracking.js icon indicating copy to clipboard operation
tracking.js copied to clipboard

Check the size of the rectangle

Open ghost opened this issue 6 years ago • 1 comments

Hi!

Is it possible to check the dimensions of the rectangle? just like the color, width, height etc.

ghost avatar Jan 09 '19 13:01 ghost

@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.

BhavitChhatralia avatar Feb 19 '19 13:02 BhavitChhatralia