1<?php
2
3namespace Facebook\WebDriver\Interactions\Internal;
4
5use Facebook\WebDriver\Internal\WebDriverLocatable;
6use Facebook\WebDriver\WebDriverAction;
7use Facebook\WebDriver\WebDriverMouse;
8
9class WebDriverMoveToOffsetAction extends WebDriverMouseAction implements WebDriverAction
10{
11    /**
12     * @var int|null
13     */
14    private $xOffset;
15    /**
16     * @var int|null
17     */
18    private $yOffset;
19
20    /**
21     * @param WebDriverMouse $mouse
22     * @param WebDriverLocatable|null $location_provider
23     * @param int|null $x_offset
24     * @param int|null $y_offset
25     */
26    public function __construct(
27        WebDriverMouse $mouse,
28        WebDriverLocatable $location_provider = null,
29        $x_offset = null,
30        $y_offset = null
31    ) {
32        parent::__construct($mouse, $location_provider);
33        $this->xOffset = $x_offset;
34        $this->yOffset = $y_offset;
35    }
36
37    public function perform()
38    {
39        $this->mouse->mouseMove(
40            $this->getActionLocation(),
41            $this->xOffset,
42            $this->yOffset
43        );
44    }
45}
46