fixed mouse movent, now takes scroll position into account
This commit is contained in:
parent
7a8895df33
commit
4ea99cd4f8
2 changed files with 13 additions and 0 deletions
|
@ -57,6 +57,9 @@ function mousemove($main, $control, $options) : bool
|
|||
$targetPos = $control->getElementRect($element);
|
||||
$targetX = $targetPos['x'] + $targetPos['width'] / 2;
|
||||
$targetY = $targetPos['y'] + $targetPos['height'] / 2;
|
||||
$scroll = $control->getScrollPosition();
|
||||
$targetX -= $scroll[0];
|
||||
$targetY -= $scroll[1];
|
||||
// echo "move $element - $tokens[1] $targetX $targetY\n";
|
||||
$mouseX = $main->getMouseX();
|
||||
$mouseY = $main->getMouseY();
|
||||
|
|
|
@ -174,6 +174,16 @@ class Control
|
|||
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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue