-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Jim/GRWT-6012/implement trend line drawing tool in interactive layer #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: Jim/GRWT-6012/implement trend line drawing tool in interactive layer #392
Conversation
…deriv/flutter-chart-public into jim/grwt-6012/implement-trend-line-drawing-tool-in-interactive-layer
Reviewer's GuideThis PR refactors the interactive layer to embrace a new DrawingV2 API (with injected DrawingContext and state callbacks), overhauls drawing tool configs to support toolbar menus, ChartConfig/ChartTheme and label rendering, upgrades state management via a dedicated controller and floating menu widget, and adds UI/gesture enhancements like value/epoch labels, color picker and tap‐cancellation logic. Sequence diagram for Adding a Trend LinesequenceDiagram
actor User
participant ILB as InteractiveLayerBehaviour
participant IATS as InteractiveAddingToolState
participant TLAPD as TrendLineAddingPreviewDesktop
participant IL as InteractiveLayer (_GestureHandlerState)
participant ILS as _InteractiveLayerState
participant Repo as DrawingToolsRepo
User->>+ILB: Selects Trend Line Tool
ILB->>+IATS: startAddingTool(trendLineConfig)
IATS->>ILB: getAddingDrawingPreview(drawing)
ILB-->>IATS: tlAddingPreviewDesktop
IATS->>TLAPD: (created with TrendLineInteractableDrawing)
User->>TLAPD: Hovers mouse on chart
TLAPD->>TLAPD: onHover(event)
TLAPD->>PaintHelpers: drawValueLabel()
TLAPD->>PaintHelpers: drawEpochLabel()
Note right of TLAPD: Preview with labels shown
User->>TLAPD: Clicks first point
TLAPD->>TLAPD: onCreateTap() (sets startPoint)
User->>TLAPD: Clicks second point
TLAPD->>TLAPD: onCreateTap() (sets endPoint)
TLAPD->>IL: addDrawing(updatedConfig)
IL->>ILS: _addDrawingToRepo(updatedConfig)
ILS->>Repo: add(configWithId)
Repo-->>ILS: configWithId
ILS-->>IL: configWithId
IL-->>TLAPD: configWithId
TLAPD->>ILB: (callback via onCreateTap)
ILB->>IL: clearAddingDrawing()
ILB->>ILB: aNewToolsIsAdded(drawingFromConfig)
ILB->>InteractiveSelectedToolState: updateStateTo(selectedState)
deactivate IATS
deactivate ILB
Class diagram for State Management CoreclassDiagram
class InteractiveLayerController {
+InteractiveState currentState
+InteractableDrawing? selectedDrawing
+Offset floatingMenuPosition
+InteractiveLayerController(Offset floatingMenuInitialPosition)
+notifyListeners()
}
InteractiveLayerController --|> ChangeNotifier
class InteractiveLayerBehaviour {
<<Abstract>>
+InteractiveLayerController controller
+AnimationController stateChangeController
+InteractiveLayerBase interactiveLayer
+VoidCallback onUpdate
+init(InteractiveLayerBase, VoidCallback, AnimationController)
+updateStateTo(InteractiveState, StateChangeAnimationDirection, bool waitForAnimation, bool animate) Future~void~
+startAddingTool(DrawingToolConfig)
+aNewToolsIsAdded(InteractableDrawing)
+getToolState(DrawingV2) Set~DrawingToolState~
+List~DrawingV2~ previewDrawings
+List~Widget~ previewWidgets
}
InteractiveLayerBehaviour ..> InteractiveLayerController : uses
InteractiveLayerBehaviour ..> InteractiveState : manages
class InteractiveState {
<<Abstract>>
+InteractiveLayerBehaviour interactiveLayerBehaviour
+InteractiveState(InteractiveLayerBehaviour)
+getToolState(DrawingV2) Set~DrawingToolState~
+List~DrawingV2~ previewDrawings
+List~Widget~ previewWidgets
+onTap(TapUpDetails)
+onPanUpdate(DragUpdateDetails)
+onPanEnd(DragEndDetails)
+onPanStart(DragStartDetails)
+onHover(PointerHoverEvent)
}
InteractiveState ..> InteractiveLayerBehaviour : uses
Class diagram for Helper Classes (DrawingContext and PaintHelpers)classDiagram
class DrawingContext {
+Size fullSize
+Size contentSize
+DrawingContext(Size fullSize, Size contentSize)
}
class PaintHelpers {
<<Utility>>
+drawPointAlignmentGuides(Canvas, Size, Offset, Color) void
+drawValueLabel(Canvas, QuoteToY, double, int, Size, TextStyle, double, Color, Color, bool, double, double, double) void
+drawEpochLabel(Canvas, EpochToX, int, Size, TextStyle, double, Color, Color) void
}
TrendLineInteractableDrawing ..> PaintHelpers : uses
HorizontalLineInteractableDrawing ..> PaintHelpers : uses
TrendLineAddingPreviewDesktop ..> PaintHelpers : uses
HorizontalLineAddingPreviewDesktop ..> PaintHelpers : uses
Class diagram for AddOnsRepository ChangesclassDiagram
class Repository~T~ {
<<Abstract>>
+List~T~ items
+void add(T config)
+void updateAt(int index, T config)
+void removeAt(int index)
+void remove(T config)
+void clear()
}
Repository --|> ChangeNotifier
class AddOnsRepository~T extends AddOnConfig~ {
+void remove(T config)
}
AddOnsRepository --|> Repository~T~
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Clickup link:
Fixes issue: #
This PR contains the following changes:
Developers Note (Optional)
Pre-launch Checklist (For PR creator)
As a creator of this PR:
Reviewers
Pre-launch Checklist (For Reviewers)
As a reviewer I ensure that:
Pre-launch Checklist (For QA)
Pre-launch Checklist (For Maintainer)
Summary by Sourcery
Implement a trend line drawing tool in the interactive chart layer and refactor the drawing architecture to support a new v2 pipeline with overlay painting, customizable toolbars, and streamlined state management
New Features:
Enhancements: