onCreateTap method
void
onCreateTap(
- TapUpDetails details,
- EpochFromX epochFromX,
- QuoteFromY quoteFromY,
- EpochToX epochToX,
- QuoteToY quoteToY,
override
Handles tap events during the drawing creation process.
This method is called when the user taps on the chart while in the drawing addition state. It allows the drawing preview to:
- Capture coordinates needed to define the drawing's shape and position
- Update the underlying interactableDrawing with these coordinates
- Determine when the drawing creation is complete.
Different drawing tools require different numbers of taps to complete:
- A horizontal line may require just one tap to define its position
- A trend line requires two taps to define start and end points
- A rectangle or triangle may require multiple taps to define vertices
When the drawing has received all necessary inputs, it should call the
onDone callback to signal that creation is complete.
Parameters:
details: Information about the tap eventepochFromX: Function to convert X coordinate to epoch (timestamp)quoteFromY: Function to convert Y coordinate to price/quote valueepochToX: Function to convert epoch (timestamp) to X coordinatequoteToY: Function to convert price/quote value to Y coordinateonDone: Callback to invoke when drawing creation is complete
Implementation
@override
void onCreateTap(
TapUpDetails details,
EpochFromX epochFromX,
QuoteFromY quoteFromY,
EpochToX epochToX,
QuoteToY quoteToY,
) {
final isFirstPoint = interactableDrawing.startPoint == null;
createPoint(details, epochFromX, quoteFromY);
if (isFirstPoint) {
_animationController?.startAnimation();
}
}