Use jquery offset() to get image position

pull/3125/head
Isaac Connor 2021-02-02 23:19:44 -05:00
parent f868d92269
commit c35869fd30
1 changed files with 8 additions and 9 deletions

View File

@ -683,16 +683,15 @@ function fetchImage( streamImage ) {
function handleClick(event) {
// target should be the img tag
var target = event.target;
var width = $j(target).width();
var height = $j(target).height();
var target = $j(event.target);
var width = target.width();
var height = target.height();
var scaleX = parseInt(monitorWidth / width);
var scaleY = parseInt(monitorHeight / height);
var x = (event.pageX - target.getLeft()) * scaleX;
var y = (event.pageY - target.getTop()) * scaleY;
// image can be scaled... we need the coordinates in original image size units
// So what is event.page.x?
var pos = target.offset();
var x = parseInt((event.pageX - pos.left) * scaleX);
var y = parseInt((event.pageY - pos.top) * scaleY);
if ( showMode == 'events' || !imageControlMode ) {
if ( event.shift ) {