|
10 | 10 | */ |
11 | 11 | public interface ReactiveComponent extends ScreenComponent { |
12 | 12 |
|
| 13 | + // Formerly, the screenY was inverted to the rendering y position. For some arbitrary reason this is no longer the case. |
| 14 | + |
| 15 | + /** |
| 16 | + * Called when the user clicks on the component. |
| 17 | + * The documentation of screenX, screenY, componentX and componentY is done as intended. The future me should not come to the idea |
| 18 | + * that the documentation was wrong. However the variable names might be misleading... |
| 19 | + * |
| 20 | + * @param screenX The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getWidth()} and {@code 0} |
| 21 | + * @param screenY The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getHeight()} and {@code 0} |
| 22 | + * @param componentX The X-position of the component relative to the screen. Use for drawing operations only. |
| 23 | + * @param componentY The Y-position of the component relative to the screen. Use for drawing operations only. |
| 24 | + * @param camera The camera supplied for drawing operations. |
| 25 | + */ |
| 26 | + public void onClick(int screenX, int screenY, int componentX, int componentY, @NotNull Camera camera); |
| 27 | + |
13 | 28 | /** |
14 | 29 | * Called when the mouse moves over the component. |
15 | 30 | * |
16 | | - * @param screenX The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getWidth()} and {@code 0} |
17 | | - * @param screenY The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getHeight()} and {@code 0} |
| 31 | + * @param screenX The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getWidth()} and {@code 0} |
| 32 | + * @param screenY The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getHeight()} and {@code 0} |
18 | 33 | * @param componentX The X-position of the component relative to the screen. Use for drawing operations only. |
19 | 34 | * @param componentY The Y-position of the component relative to the screen. Use for drawing operations only. |
20 | | - * @param camera The camera supplied for drawing operations. |
| 35 | + * @param camera The camera supplied for drawing operations. |
21 | 36 | * @deprecated Not yet implemented |
22 | 37 | */ |
23 | 38 | @Deprecated(forRemoval = false, since = "1.5.0") |
24 | 39 | public void onHover(int screenX, int screenY, int componentX, int componentY, @NotNull Camera camera); |
25 | 40 |
|
26 | 41 | /** |
27 | | - * Called when the user clicks on the component. |
28 | | - * The documentation of screenX, screenY, componentX and componentY is done as intended. The future me should not come to the idea |
29 | | - * that the documentation was wrong. However the variable names might be misleading ... |
30 | | - * |
31 | | - * <p>screenY will be inverted compared to the rendering y's. You might want to do component.getHeight() - screenY to obtain a more usable height. |
| 42 | + * Unknown use but could be helpful to have. Mirrors the behaviour of {@link GestureListener#longPress(float, float)}. |
32 | 43 | * |
33 | | - * @param screenX The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getWidth()} and {@code 0} |
34 | | - * @param screenY The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getHeight()} and {@code 0} |
| 44 | + * @param screenX The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getWidth()} and {@code 0} |
| 45 | + * @param screenY The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getHeight()} and {@code 0} |
35 | 46 | * @param componentX The X-position of the component relative to the screen. Use for drawing operations only. |
36 | 47 | * @param componentY The Y-position of the component relative to the screen. Use for drawing operations only. |
37 | | - * @param camera The camera supplied for drawing operations. |
| 48 | + * @param camera The camera supplied for drawing operations. |
38 | 49 | */ |
39 | | - public void onClick(int screenX, int screenY, int componentX, int componentY, @NotNull Camera camera); |
| 50 | + public void onLongClick(int screenX, int screenY, int componentX, int componentY, @NotNull Camera camera); |
40 | 51 |
|
41 | 52 | /** |
42 | | - * Unknown use but could be helpful to have. Mirrors the behaviour of {@link GestureListener#longPress(float, float)}. |
| 53 | + * Called when the user scrolls while being on this component. |
| 54 | + * The documentation of screenX, screenY, componentX and componentY is done as intended. The future me should not come to the idea |
| 55 | + * that the documentation was wrong. However the variable names might be misleading... |
43 | 56 | * |
44 | | - * @param screenX The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getWidth()} and {@code 0} |
45 | | - * @param screenY The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getHeight()} and {@code 0} |
| 57 | + * @param screenX The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getWidth()} and {@code 0} |
| 58 | + * @param screenY The Y-position of the mouse relative to this component. Bound between {@link ScreenComponent#getHeight()} and {@code 0} |
46 | 59 | * @param componentX The X-position of the component relative to the screen. Use for drawing operations only. |
47 | 60 | * @param componentY The Y-position of the component relative to the screen. Use for drawing operations only. |
48 | | - * @param camera The camera supplied for drawing operations. |
| 61 | + * @param camera The camera supplied for drawing operations. |
| 62 | + * @param amount The amount that was scrolled. Either {@code -1} or {@code 1}. |
49 | 63 | */ |
50 | | - public void onLongClick(int screenX, int screenY, int componentX, int componentY, @NotNull Camera camera); |
| 64 | + public void onScroll(int screenX, int screenY, int componentX, int componentY, @NotNull Camera camera, int amount); |
51 | 65 | } |
0 commit comments