CanvasMouseEvent
Package: velox.api.layer1.layers.strategies.interfaces
Type: Class
Inheritance: java.lang.Object รขโ โ CanvasMouseEvent
Descriptionโ
Describes a ScreenSpaceCanvas related mouse event. Use getX(velox.api.layer1.layers.strategies.interfaces.ScreenSpaceCanvas.HorizontalCoordinate, velox.api.layer1.layers.strategies.interfaces.CanvasMouseEvent.CoordinateRequestType) and getY(velox.api.layer1.layers.strategies.interfaces.ScreenSpaceCanvas.VerticalCoordinate, velox.api.layer1.layers.strategies.interfaces.CanvasMouseEvent.CoordinateRequestType) coordinates to analyze where exactly on a chart the event occurred.
Nested Classesโ
CanvasMouseEvent.CoordinateRequestTypeโ
Use it in getX(velox.api.layer1.layers.strategies.interfaces.ScreenSpaceCanvas.HorizontalCoordinate, velox.api.layer1.layers.strategies.interfaces.CanvasMouseEvent.CoordinateRequestType) and getY(velox.api.layer1.layers.strategies.interfaces.ScreenSpaceCanvas.VerticalCoordinate, velox.api.layer1.layers.strategies.interfaces.CanvasMouseEvent.CoordinateRequestType) to get the result in pixels or data (time in nanos for X, price in pips for Y coordinates).
Fieldsโ
sourceEventโ
public final MouseEvent sourceEvent
A mouse event that produced this CanvasMouseEvent. Use it to analyze additional event-related data e.g. key modifiers or MouseWheelEvent.getScrollAmount() for mouse wheel event.
Constructorsโ
CanvasMouseEventโ
public CanvasMouseEvent(CanvasPixelToDataBiMapper mapper, MouseEvent sourceEvent)
Methodsโ
getXโ
public ScreenSpaceCanvas.CompositeHorizontalCoordinate getX(ScreenSpaceCanvas.HorizontalCoordinate relativeTo, CanvasMouseEvent.CoordinateRequestType requestType)
Get x coordinate in canvas dimensions.
Note that if you use requestType with type CanvasMouseEvent.CoordinateRequestType.PIXELS, and the relativeTo has the base of type ScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZERO it is possible to get an integer overflow during calculation, in this case you will get Integer.MAX_VALUE in the resulting ScreenSpaceCanvas.CompositeHorizontalCoordinate.pixelsX.
Parameters:
relativeTo- A base for the resulting coordinate. Usually you want to useScreenSpaceCanvas.RelativeHorizontalCoordinate.HORIZONTAL_DATA_ZEROorScreenSpaceCanvas.RelativeHorizontalCoordinate.HORIZONTAL_PIXEL_ZEROto get the result based onScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZEROorScreenSpaceCanvas.CompositeCoordinateBase.PIXEL_ZEROrespectively. Note that therelativeTocoordinate cannot have a base ofScreenSpaceCanvas.CompositeCoordinateBase.RELATIVErequestType- A horizontal coordinate can be represented in pixels or time. For that the resulting coordinate has 2 fields -ScreenSpaceCanvas.CompositeHorizontalCoordinate.pixelsXandScreenSpaceCanvas.CompositeHorizontalCoordinate.timeX. Depending on the providedrequestTypeone of the fields will have a value, another will be 0.
Returns: x coordinate, calculated relative to relativeTo coordinate, with representation specified by requestType
Throws:
IllegalArgumentException- If the providedrelativeTohas a base of typeScreenSpaceCanvas.CompositeCoordinateBase.RELATIVE
getYโ
public ScreenSpaceCanvas.CompositeVerticalCoordinate getY(ScreenSpaceCanvas.VerticalCoordinate relativeTo, CanvasMouseEvent.CoordinateRequestType requestType)
Get y coordinate in canvas dimensions.
Note that if you use requestType with type CanvasMouseEvent.CoordinateRequestType.PIXELS, and the relativeTo has the base of type ScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZERO it is possible to get an integer overflow during calculation, in this case you will get Integer.MAX_VALUE in the resulting ScreenSpaceCanvas.CompositeVerticalCoordinate.pixelsY.
Parameters:
relativeTo- A base for the resulting coordinate. Usually you want to useScreenSpaceCanvas.RelativeVerticalCoordinate.VERTICAL_DATA_ZEROorScreenSpaceCanvas.RelativeVerticalCoordinate.VERTICAL_PIXEL_ZEROto get the result based onScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZEROorScreenSpaceCanvas.CompositeCoordinateBase.PIXEL_ZEROrespectively. Note that therelativeTocoordinate cannot have a base ofScreenSpaceCanvas.CompositeCoordinateBase.RELATIVErequestType- A vertical coordinate can be represented in pixels or number of price pips. For that the resulting coordinate has 2 fields -ScreenSpaceCanvas.CompositeVerticalCoordinate.pixelsYandScreenSpaceCanvas.CompositeVerticalCoordinate.dataY. Depending on the providedrequestTypeone of the fields will have a value, another will be 0.
Returns: y coordinate, calculated relative to relativeTo coordinate, with representation specified by requestType
Throws:
IllegalArgumentException- If the providedrelativeTohas a base of typeScreenSpaceCanvas.CompositeCoordinateBase.RELATIVE
toStringโ
public String toString()
Overrides: toString in class Object