Class CanvasMouseEvent
java.lang.Object
velox.api.layer1.layers.strategies.interfaces.CanvasMouseEvent
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 Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumUse it ingetX(velox.api.layer1.layers.strategies.interfaces.ScreenSpaceCanvas.HorizontalCoordinate, velox.api.layer1.layers.strategies.interfaces.CanvasMouseEvent.CoordinateRequestType)andgetY(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). -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal MouseEventA mouse event that produced thisCanvasMouseEvent. -
Constructor Summary
ConstructorsConstructorDescriptionCanvasMouseEvent(velox.api.layer1.layers.strategies.interfaces.CanvasPixelToDataBiMapper mapper, MouseEvent sourceEvent) -
Method Summary
Modifier and TypeMethodDescriptiongetX(ScreenSpaceCanvas.HorizontalCoordinate relativeTo, CanvasMouseEvent.CoordinateRequestType requestType) Getxcoordinate in canvas dimensions.
Note that if you userequestTypewith typeCanvasMouseEvent.CoordinateRequestType.PIXELS, and therelativeTohas the base of typeScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZEROit is possible to get an integer overflow during calculation, in this case you will getInteger.MAX_VALUEin the resultingScreenSpaceCanvas.CompositeHorizontalCoordinate.pixelsX.getY(ScreenSpaceCanvas.VerticalCoordinate relativeTo, CanvasMouseEvent.CoordinateRequestType requestType) Getycoordinate in canvas dimensions.
Note that if you userequestTypewith typeCanvasMouseEvent.CoordinateRequestType.PIXELS, and therelativeTohas the base of typeScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZEROit is possible to get an integer overflow during calculation, in this case you will getInteger.MAX_VALUEin the resultingScreenSpaceCanvas.CompositeVerticalCoordinate.pixelsY.toString()
-
Field Details
-
sourceEvent
A mouse event that produced thisCanvasMouseEvent. Use it to analyze additional event-related data e.g. key modifiers orMouseWheelEvent.getScrollAmount()for mouse wheel event.
-
-
Constructor Details
-
CanvasMouseEvent
public CanvasMouseEvent(velox.api.layer1.layers.strategies.interfaces.CanvasPixelToDataBiMapper mapper, MouseEvent sourceEvent)
-
-
Method Details
-
getX
public ScreenSpaceCanvas.CompositeHorizontalCoordinate getX(ScreenSpaceCanvas.HorizontalCoordinate relativeTo, CanvasMouseEvent.CoordinateRequestType requestType) Getxcoordinate in canvas dimensions.
Note that if you userequestTypewith typeCanvasMouseEvent.CoordinateRequestType.PIXELS, and therelativeTohas the base of typeScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZEROit is possible to get an integer overflow during calculation, in this case you will getInteger.MAX_VALUEin the resultingScreenSpaceCanvas.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
relativeTocoordinate, with representation specified byrequestType - Throws:
IllegalArgumentException- if the providedrelativeTohas a base of typeScreenSpaceCanvas.CompositeCoordinateBase.RELATIVE
-
getY
public ScreenSpaceCanvas.CompositeVerticalCoordinate getY(ScreenSpaceCanvas.VerticalCoordinate relativeTo, CanvasMouseEvent.CoordinateRequestType requestType) Getycoordinate in canvas dimensions.
Note that if you userequestTypewith typeCanvasMouseEvent.CoordinateRequestType.PIXELS, and therelativeTohas the base of typeScreenSpaceCanvas.CompositeCoordinateBase.DATA_ZEROit is possible to get an integer overflow during calculation, in this case you will getInteger.MAX_VALUEin the resultingScreenSpaceCanvas.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
relativeTocoordinate, with representation specified byrequestType - Throws:
IllegalArgumentException- if the providedrelativeTohas a base of typeScreenSpaceCanvas.CompositeCoordinateBase.RELATIVE
-
toString
-