Skip to content
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

feat: update IndicatorTooltipView to Added feature event ability to return indicatorId #657

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const enum ScrollLimitRole {
export interface TooltipIcon {
paneId: string
indicatorName: string
indicatorId: string
iconId: string
}

Expand Down
6 changes: 3 additions & 3 deletions src/view/CandleTooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ export default class CandleTooltipView extends IndicatorTooltipView {

prevRowHeight = this.drawStandardTooltipIcons(
ctx, leftIcons, coordinate,
'', left, prevRowHeight, maxWidth
'', '', left, prevRowHeight, maxWidth
)

prevRowHeight = this.drawStandardTooltipIcons(
ctx, middleIcons, coordinate,
'', left, prevRowHeight, maxWidth
'', '', left, prevRowHeight, maxWidth
)

if (legends.length > 0) {
Expand All @@ -123,7 +123,7 @@ export default class CandleTooltipView extends IndicatorTooltipView {

prevRowHeight = this.drawStandardTooltipIcons(
ctx, rightIcons, coordinate,
'', left, prevRowHeight, maxWidth
'', '', left, prevRowHeight, maxWidth
)
}
return coordinate.y + prevRowHeight
Expand Down
11 changes: 6 additions & 5 deletions src/view/IndicatorTooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class IndicatorTooltipView extends View<YAxis> {
const [leftIcons, middleIcons, rightIcons] = this.classifyTooltipIcons(icons)
prevRowHeight = this.drawStandardTooltipIcons(
ctx, leftIcons,
coordinate, indicator.name,
coordinate, indicator.name, indicator.id,
left, prevRowHeight, maxWidth
)

Expand All @@ -102,7 +102,7 @@ export default class IndicatorTooltipView extends View<YAxis> {

prevRowHeight = this.drawStandardTooltipIcons(
ctx, middleIcons,
coordinate, indicator.name,
coordinate, indicator.name, indicator.id,
left, prevRowHeight, maxWidth
)

Expand All @@ -116,7 +116,7 @@ export default class IndicatorTooltipView extends View<YAxis> {
// draw right icons
prevRowHeight = this.drawStandardTooltipIcons(
ctx, rightIcons,
coordinate, indicator.name,
coordinate, indicator.name, indicator.id,
left, prevRowHeight, maxWidth
)
top = coordinate.y + prevRowHeight
Expand All @@ -131,6 +131,7 @@ export default class IndicatorTooltipView extends View<YAxis> {
icons: TooltipIconStyle[],
coordinate: Coordinate,
indicatorName: string,
indicatorId: string,
left: number,
prevRowHeight: number,
maxWidth: number
Expand Down Expand Up @@ -181,8 +182,8 @@ export default class IndicatorTooltipView extends View<YAxis> {
backgroundColor: active ? activeBackgroundColor : backgroundColor
}
}, {
mouseClickEvent: this._boundIconClickEvent({ paneId, indicatorName, iconId: icon.id }),
mouseMoveEvent: this._boundIconMouseMoveEvent({ paneId, indicatorName, iconId: icon.id })
mouseClickEvent: this._boundIconClickEvent({ paneId, indicatorName, indicatorId, iconId: icon.id }),
mouseMoveEvent: this._boundIconMouseMoveEvent({ paneId, indicatorName, indicatorId, iconId: icon.id })
})?.draw(ctx)
coordinate.x += (marginLeft + paddingLeft + ctx.measureText(text).width + paddingRight + marginRight)
})
Expand Down