fixed mouse movent, now takes scroll position into account
parent
7a8895df33
commit
4ea99cd4f8
|
@ -57,6 +57,9 @@ function mousemove($main, $control, $options) : bool
|
||||||
$targetPos = $control->getElementRect($element);
|
$targetPos = $control->getElementRect($element);
|
||||||
$targetX = $targetPos['x'] + $targetPos['width'] / 2;
|
$targetX = $targetPos['x'] + $targetPos['width'] / 2;
|
||||||
$targetY = $targetPos['y'] + $targetPos['height'] / 2;
|
$targetY = $targetPos['y'] + $targetPos['height'] / 2;
|
||||||
|
$scroll = $control->getScrollPosition();
|
||||||
|
$targetX -= $scroll[0];
|
||||||
|
$targetY -= $scroll[1];
|
||||||
// echo "move $element - $tokens[1] $targetX $targetY\n";
|
// echo "move $element - $tokens[1] $targetX $targetY\n";
|
||||||
$mouseX = $main->getMouseX();
|
$mouseX = $main->getMouseX();
|
||||||
$mouseY = $main->getMouseY();
|
$mouseY = $main->getMouseY();
|
||||||
|
|
|
@ -174,6 +174,16 @@ class Control
|
||||||
return (!is_array($url)) ? $url : '';
|
return (!is_array($url)) ? $url : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get scroll position
|
||||||
|
*
|
||||||
|
* @return [int,int] current scroll position
|
||||||
|
*/
|
||||||
|
public function getScrollPosition()
|
||||||
|
{
|
||||||
|
return $this->executeScript('return [window.pageXOffset, window.pageYOffset];');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* move mouse to absolute position
|
* move mouse to absolute position
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue