code-review-fix task 9.8: replace any types with proper interfaces
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1b637dc45e
commit
ba20d9e5ab
3 changed files with 25 additions and 20 deletions
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, useState, useRef, useCallback } from 'react';
|
||||
import { IChartApi, ISeriesApi, Time } from 'lightweight-charts';
|
||||
import { IChartApi, ISeriesApi, Time, MouseEventParams } from 'lightweight-charts';
|
||||
import { SpanRectanglePrimitive, SpanData } from './SpanRectanglePrimitive';
|
||||
import SpanPopover from './SpanPopover';
|
||||
import type { Candle, SpanAnnotation, SpanLabelType } from '@/types';
|
||||
|
|
@ -176,11 +176,12 @@ export default function SpanAnnotationManager({
|
|||
setEndCandle(null);
|
||||
}
|
||||
|
||||
const handleClick = (param: any) => {
|
||||
const handleClick = (param: MouseEventParams) => {
|
||||
if (!param.point) return;
|
||||
const point = param.point;
|
||||
|
||||
const time = chart.timeScale().coordinateToTime(param.point.x);
|
||||
const price = series.coordinateToPrice(param.point.y);
|
||||
const time = chart.timeScale().coordinateToTime(point.x);
|
||||
const price = series.coordinateToPrice(point.y);
|
||||
if (!time || !price) return;
|
||||
|
||||
// Handle span tool two-click interaction
|
||||
|
|
@ -194,7 +195,7 @@ export default function SpanAnnotationManager({
|
|||
// Check if clicking on existing span for selection
|
||||
let clickedSpanId: number | null = null;
|
||||
primitivesRef.current.forEach((primitive, spanId) => {
|
||||
if (primitive.hitTest(param.point.x, param.point.y)) {
|
||||
if (primitive.hitTest(point.x, point.y)) {
|
||||
clickedSpanId = spanId;
|
||||
}
|
||||
});
|
||||
|
|
@ -228,7 +229,7 @@ export default function SpanAnnotationManager({
|
|||
// Delete span on click with delete tool
|
||||
let clickedSpanId: number | null = null;
|
||||
primitivesRef.current.forEach((primitive, spanId) => {
|
||||
if (primitive.hitTest(param.point.x, param.point.y)) {
|
||||
if (primitive.hitTest(point.x, point.y)) {
|
||||
clickedSpanId = spanId;
|
||||
}
|
||||
});
|
||||
|
|
@ -240,7 +241,7 @@ export default function SpanAnnotationManager({
|
|||
// Click to select span when no tool is active
|
||||
let clickedSpanId: number | null = null;
|
||||
primitivesRef.current.forEach((primitive, spanId) => {
|
||||
if (primitive.hitTest(param.point.x, param.point.y)) {
|
||||
if (primitive.hitTest(point.x, point.y)) {
|
||||
clickedSpanId = spanId;
|
||||
}
|
||||
});
|
||||
|
|
@ -271,7 +272,7 @@ export default function SpanAnnotationManager({
|
|||
return;
|
||||
}
|
||||
|
||||
const handleMouseMove = (param: any) => {
|
||||
const handleMouseMove = (param: MouseEventParams) => {
|
||||
if (!param.point) return;
|
||||
|
||||
const time = chart.timeScale().coordinateToTime(param.point.x);
|
||||
|
|
@ -542,12 +543,13 @@ export default function SpanAnnotationManager({
|
|||
useEffect(() => {
|
||||
if (!chart) return;
|
||||
|
||||
const handleDblClick = (param: any) => {
|
||||
const handleDblClick = (param: MouseEventParams) => {
|
||||
if (!param.point) return;
|
||||
const point = param.point;
|
||||
|
||||
let clickedSpanId: number | null = null;
|
||||
primitivesRef.current.forEach((primitive, spanId) => {
|
||||
if (primitive.hitTest(param.point.x, param.point.y)) {
|
||||
if (primitive.hitTest(point.x, point.y)) {
|
||||
clickedSpanId = spanId;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue