@@ -26,8 +26,6 @@ public class SceneWindowImpl implements SceneWindow, PageInfoUpdator {
26
26
27
27
private final String selector ;
28
28
29
- private final FocusHelper focusHelper ;
30
-
31
29
private final MoveHelper moveHelper ;
32
30
33
31
private int stepVert = 40 ;
@@ -38,7 +36,6 @@ public class SceneWindowImpl implements SceneWindow, PageInfoUpdator {
38
36
private SceneWindowImpl (final Scene scene , final WebDriver driver , String selector ) {
39
37
this .driver = driver ;
40
38
this .selector = selector ;
41
- focusHelper = FocusHelper .getFocusHelper (this );
42
39
moveHelper = MoveHelper .getMoveHelper (scene , driver );
43
40
updateSteps ();
44
41
}
@@ -78,9 +75,28 @@ public void move(final Block element, final Coordinate dist) throws ElementNotOn
78
75
79
76
@ Override
80
77
public void focus (final Coordinate coordinate ) {
78
+ int sizeHor = Double .valueOf ($ (By .id ("SceneWindowHorSize" )).innerHtml ()).intValue ();
79
+ int sizeVer = Double .valueOf ($ (By .id ("SceneWindowVerSize" )).innerHtml ()).intValue ();
80
+
81
81
logger .info ("Focus to " + coordinate .getXAbsolute () + " " + coordinate .getYAbsolute ());
82
+ if (driver instanceof JavascriptExecutor ) {
83
+ ((JavascriptExecutor ) driver ).executeScript ("var canvas = " +
84
+ "document.getElementsByClassName(\" scene-wrapper\" )[0]; " +
85
+ "var BB=canvas.getBoundingClientRect();" +
86
+ "canvas.scrollLeft = " + Math .max (0 , (coordinate .getXAbsolute () - sizeHor / 2 )) + "; " +
87
+ "canvas.scrollTop = " + Math .max (0 , (coordinate .getYAbsolute () - sizeVer / 2 )) + ";"
88
+ );
89
+ }
90
+ try {
91
+ Thread .sleep (1000 );
92
+ } catch (InterruptedException e ) {
93
+ logger .error (e .getMessage ());
94
+ }
95
+
96
+ /*
82
97
focusHelper.horizontalWindowMovement(coordinate.getXAbsolute());
83
98
focusHelper.verticalWindowMovement(coordinate.getYAbsolute());
99
+ */
84
100
}
85
101
86
102
@ Contract ("_, _, _ -> !null" )
0 commit comments