From 63b7b6c17e9a43194a97ed6af279436bd444aed6 Mon Sep 17 00:00:00 2001 From: Andrii Ovcharenko Date: Mon, 28 Oct 2024 10:44:31 +0100 Subject: [PATCH] revert useless change --- src/api/options/crosshair-options-defaults.ts | 2 +- src/api/options/grid-options-defaults.ts | 2 +- .../options/price-line-options-defaults.ts | 2 +- src/api/options/series-options-defaults.ts | 2 +- src/index.ts | 2 +- src/model/crosshair.ts | 2 +- src/model/grid.ts | 2 +- src/model/price-line-options.ts | 2 +- src/model/series-options.ts | 2 +- src/model/series/area-series.ts | 2 +- src/model/series/baseline-series.ts | 2 +- src/model/series/line-series.ts | 2 +- src/renderers/area-renderer-base.ts | 3 +- src/renderers/crosshair-renderer.ts | 3 +- src/renderers/draw-line.ts | 65 ++++++++++++++++++- src/renderers/draw-series-point-markers.ts | 2 +- src/renderers/grid-renderer.ts | 3 +- src/renderers/horizontal-line-renderer.ts | 3 +- src/renderers/iprice-axis-view-renderer.ts | 2 +- src/renderers/line-renderer-base.ts | 3 +- src/renderers/line-types.ts | 64 ------------------ src/renderers/walk-line.ts | 2 +- .../pane/series-horizontal-line-pane-view.ts | 2 +- 23 files changed, 85 insertions(+), 91 deletions(-) delete mode 100644 src/renderers/line-types.ts diff --git a/src/api/options/crosshair-options-defaults.ts b/src/api/options/crosshair-options-defaults.ts index 83dd27ff20..e6c1348ae5 100644 --- a/src/api/options/crosshair-options-defaults.ts +++ b/src/api/options/crosshair-options-defaults.ts @@ -1,4 +1,4 @@ -import { CrosshairMode, CrosshairOptions } from '../../model/crosshair'; import { LineStyle } from '../../renderers/line-types'; +import { CrosshairMode, CrosshairOptions } from '../../model/crosshair'; import { LineStyle } from '../../renderers/draw-line'; export const crosshairOptionsDefaults: CrosshairOptions = { vertLine: { diff --git a/src/api/options/grid-options-defaults.ts b/src/api/options/grid-options-defaults.ts index 96bd543902..5f5b2ce53d 100644 --- a/src/api/options/grid-options-defaults.ts +++ b/src/api/options/grid-options-defaults.ts @@ -1,5 +1,5 @@ import { GridOptions } from '../../model/grid'; -import { LineStyle } from '../../renderers/line-types'; +import { LineStyle } from '../../renderers/draw-line'; export const gridOptionsDefaults: GridOptions = { vertLines: { diff --git a/src/api/options/price-line-options-defaults.ts b/src/api/options/price-line-options-defaults.ts index b517a0e96c..7258260d3e 100644 --- a/src/api/options/price-line-options-defaults.ts +++ b/src/api/options/price-line-options-defaults.ts @@ -1,5 +1,5 @@ import { PriceLineOptions } from '../../model/price-line-options'; -import { LineStyle } from '../../renderers/line-types'; +import { LineStyle } from '../../renderers/draw-line'; export const priceLineOptionsDefaults: PriceLineOptions = { color: '#FF0000', diff --git a/src/api/options/series-options-defaults.ts b/src/api/options/series-options-defaults.ts index ce0a62acbf..2cb8971020 100644 --- a/src/api/options/series-options-defaults.ts +++ b/src/api/options/series-options-defaults.ts @@ -3,7 +3,7 @@ import { PriceLineSource, SeriesOptionsCommon, } from '../../model/series-options'; -import { LineStyle } from '../../renderers/line-types'; +import { LineStyle } from '../../renderers/draw-line'; export const customStyleDefaults: CustomStyleOptions = { color: '#2196f3', diff --git a/src/index.ts b/src/index.ts index 1749bb93a1..2f21aa47c1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { customStyleDefaults, seriesOptionsDefaults } from './api/options/series-options-defaults'; import { CustomSeriesOptions } from './model/series-options'; -export { LineStyle, LineType } from './renderers/line-types'; +export { LineStyle, LineType } from './renderers/draw-line'; export { TrackingModeExitMode } from './model/chart-model'; export { CrosshairMode } from './model/crosshair'; diff --git a/src/model/crosshair.ts b/src/model/crosshair.ts index cefdc2e298..32d0551a2b 100644 --- a/src/model/crosshair.ts +++ b/src/model/crosshair.ts @@ -1,7 +1,7 @@ import { ensureNotNull } from '../helpers/assertions'; import { notNull } from '../helpers/strict-type-checks'; -import { LineStyle, LineWidth } from '../renderers/line-types'; +import { LineStyle, LineWidth } from '../renderers/draw-line'; import { CrosshairMarksPaneView } from '../views/pane/crosshair-marks-pane-view'; import { CrosshairPaneView } from '../views/pane/crosshair-pane-view'; import { IPaneView } from '../views/pane/ipane-view'; diff --git a/src/model/grid.ts b/src/model/grid.ts index 1a8752d5b8..92b5a3a367 100644 --- a/src/model/grid.ts +++ b/src/model/grid.ts @@ -1,4 +1,4 @@ -import { LineStyle } from '../renderers/line-types'; +import { LineStyle } from '../renderers/draw-line'; import { GridPaneView } from '../views/pane/grid-pane-view'; import { IUpdatablePaneView } from '../views/pane/iupdatable-pane-view'; diff --git a/src/model/price-line-options.ts b/src/model/price-line-options.ts index 7078fb2692..0aa1ec8ab6 100644 --- a/src/model/price-line-options.ts +++ b/src/model/price-line-options.ts @@ -1,4 +1,4 @@ -import { LineStyle, LineWidth } from '../renderers/line-types'; +import { LineStyle, LineWidth } from '../renderers/draw-line'; /** * Represents a price line options. diff --git a/src/model/series-options.ts b/src/model/series-options.ts index 504d94ca28..ea3fa9c211 100644 --- a/src/model/series-options.ts +++ b/src/model/series-options.ts @@ -1,6 +1,6 @@ import { DeepPartial } from '../helpers/strict-type-checks'; -import { LineStyle, LineType, LineWidth } from '../renderers/line-types'; +import { LineStyle, LineType, LineWidth } from '../renderers/draw-line'; import { AutoScaleMargins } from './autoscale-info-impl'; import { PriceFormatterFn } from './price-formatter-fn'; diff --git a/src/model/series/area-series.ts b/src/model/series/area-series.ts index b19ad63d33..3231c2914a 100644 --- a/src/model/series/area-series.ts +++ b/src/model/series/area-series.ts @@ -1,4 +1,4 @@ -import { LineStyle, LineType } from '../../renderers/line-types'; +import { LineStyle, LineType } from '../../renderers/draw-line'; import { IUpdatablePaneView } from '../../views/pane/iupdatable-pane-view'; import { IChartModelBase } from '../chart-model'; diff --git a/src/model/series/baseline-series.ts b/src/model/series/baseline-series.ts index d15bf6c902..89ddfdcdd9 100644 --- a/src/model/series/baseline-series.ts +++ b/src/model/series/baseline-series.ts @@ -1,4 +1,4 @@ -import { LineStyle, LineType } from '../../renderers/line-types'; +import { LineStyle, LineType } from '../../renderers/draw-line'; import { IUpdatablePaneView } from '../../views/pane/iupdatable-pane-view'; import { IChartModelBase } from '../chart-model'; diff --git a/src/model/series/line-series.ts b/src/model/series/line-series.ts index 571a5ce00d..ee965ffd65 100644 --- a/src/model/series/line-series.ts +++ b/src/model/series/line-series.ts @@ -1,4 +1,4 @@ -import { LineStyle, LineType } from '../../renderers/line-types'; +import { LineStyle, LineType } from '../../renderers/draw-line'; import { IUpdatablePaneView } from '../../views/pane/iupdatable-pane-view'; import { IChartModelBase } from '../chart-model'; diff --git a/src/renderers/area-renderer-base.ts b/src/renderers/area-renderer-base.ts index cd75d7ddac..149a8156f4 100644 --- a/src/renderers/area-renderer-base.ts +++ b/src/renderers/area-renderer-base.ts @@ -5,8 +5,7 @@ import { PricedValue } from '../model/price-scale'; import { SeriesItemsIndexesRange, TimedValue } from '../model/time-data'; import { BitmapCoordinatesPaneRenderer } from './bitmap-coordinates-pane-renderer'; -import { setLineStyle } from './draw-line'; -import { LinePoint, LineStyle, LineType, LineWidth } from './line-types'; +import { LinePoint, LineStyle, LineType, LineWidth, setLineStyle } from './draw-line'; import { walkLine } from './walk-line'; export type AreaFillItemBase = TimedValue & PricedValue & LinePoint; diff --git a/src/renderers/crosshair-renderer.ts b/src/renderers/crosshair-renderer.ts index 2ac3f72ede..5a656f9877 100644 --- a/src/renderers/crosshair-renderer.ts +++ b/src/renderers/crosshair-renderer.ts @@ -1,8 +1,7 @@ import { BitmapCoordinatesRenderingScope } from 'fancy-canvas'; import { BitmapCoordinatesPaneRenderer } from './bitmap-coordinates-pane-renderer'; -import { drawHorizontalLine, drawVerticalLine, setLineStyle } from './draw-line'; -import { LineStyle, LineWidth } from './line-types'; +import { drawHorizontalLine, drawVerticalLine, LineStyle, LineWidth, setLineStyle } from './draw-line'; export interface CrosshairLineStyle { lineStyle: LineStyle; diff --git a/src/renderers/draw-line.ts b/src/renderers/draw-line.ts index 74392809b8..655d887ac9 100644 --- a/src/renderers/draw-line.ts +++ b/src/renderers/draw-line.ts @@ -1,4 +1,67 @@ -import { LineStyle } from './line-types'; +import { Coordinate } from '../model/coordinate'; + +/** + * Represents the width of a line. + */ +export type LineWidth = 1 | 2 | 3 | 4; + +/** + * Represents the possible line types. + */ +export const enum LineType { + /** + * A line. + */ + Simple, + /** + * A stepped line. + */ + WithSteps, + /** + * A curved line. + */ + Curved, +} + +/** + * A point on a line. + */ +export interface LinePoint { + /** + * The point's x coordinate. + */ + x: Coordinate; + /** + * The point's y coordinate. + */ + y: Coordinate; +} + +/** + * Represents the possible line styles. + */ +export const enum LineStyle { + /** + * A solid line. + */ + Solid = 0, + /** + * A dotted line. + */ + Dotted = 1, + /** + * A dashed line. + */ + Dashed = 2, + /** + * A dashed line with bigger dashes. + */ + LargeDashed = 3, + /** + * A dotted line with more space between dots. + */ + SparseDotted = 4, +} export function setLineStyle(ctx: CanvasRenderingContext2D, style: LineStyle): void { const dashPatterns = { diff --git a/src/renderers/draw-series-point-markers.ts b/src/renderers/draw-series-point-markers.ts index ac15ab0a81..5afc10da87 100644 --- a/src/renderers/draw-series-point-markers.ts +++ b/src/renderers/draw-series-point-markers.ts @@ -2,7 +2,7 @@ import { BitmapCoordinatesRenderingScope } from 'fancy-canvas'; import { SeriesItemsIndexesRange } from '../model/time-data'; -import { LinePoint } from './line-types'; +import { LinePoint } from './draw-line'; export function drawSeriesPointMarkers( renderingScope: BitmapCoordinatesRenderingScope, diff --git a/src/renderers/grid-renderer.ts b/src/renderers/grid-renderer.ts index 0fe93fce84..10ffbccee1 100644 --- a/src/renderers/grid-renderer.ts +++ b/src/renderers/grid-renderer.ts @@ -5,8 +5,7 @@ import { ensureNotNull } from '../helpers/assertions'; import { PriceMark } from '../model/price-scale'; import { BitmapCoordinatesPaneRenderer } from './bitmap-coordinates-pane-renderer'; -import { setLineStyle, strokeInPixel } from './draw-line'; -import { LineStyle } from './line-types'; +import { LineStyle, setLineStyle, strokeInPixel } from './draw-line'; export interface GridMarks { coord: number; diff --git a/src/renderers/horizontal-line-renderer.ts b/src/renderers/horizontal-line-renderer.ts index 558d42d03e..3d0cc3d71d 100644 --- a/src/renderers/horizontal-line-renderer.ts +++ b/src/renderers/horizontal-line-renderer.ts @@ -4,8 +4,7 @@ import { HoveredObject } from '../model/chart-model'; import { Coordinate } from '../model/coordinate'; import { BitmapCoordinatesPaneRenderer } from './bitmap-coordinates-pane-renderer'; -import { drawHorizontalLine, setLineStyle } from './draw-line'; -import { LineStyle, LineWidth } from './line-types'; +import { drawHorizontalLine, LineStyle, LineWidth, setLineStyle } from './draw-line'; export interface HorizontalLineRendererData { color: string; diff --git a/src/renderers/iprice-axis-view-renderer.ts b/src/renderers/iprice-axis-view-renderer.ts index 7c7eaa3b13..e331e006ac 100644 --- a/src/renderers/iprice-axis-view-renderer.ts +++ b/src/renderers/iprice-axis-view-renderer.ts @@ -2,7 +2,7 @@ import { CanvasRenderingTarget2D } from 'fancy-canvas'; import { TextWidthCache } from '../model/text-width-cache'; -import { LineWidth } from './line-types'; +import { LineWidth } from './draw-line'; export interface PriceAxisViewRendererCommonData { activeBackground?: string; diff --git a/src/renderers/line-renderer-base.ts b/src/renderers/line-renderer-base.ts index f327131f10..26f248057c 100644 --- a/src/renderers/line-renderer-base.ts +++ b/src/renderers/line-renderer-base.ts @@ -4,9 +4,8 @@ import { PricedValue } from '../model/price-scale'; import { SeriesItemsIndexesRange, TimedValue } from '../model/time-data'; import { BitmapCoordinatesPaneRenderer } from './bitmap-coordinates-pane-renderer'; -import { setLineStyle } from './draw-line'; +import { LinePoint, LineStyle, LineType, LineWidth, setLineStyle } from './draw-line'; import { drawSeriesPointMarkers } from './draw-series-point-markers'; -import { LinePoint, LineStyle, LineType, LineWidth } from './line-types'; import { walkLine } from './walk-line'; export type LineItemBase = TimedValue & PricedValue & LinePoint; diff --git a/src/renderers/line-types.ts b/src/renderers/line-types.ts deleted file mode 100644 index 0b4a444514..0000000000 --- a/src/renderers/line-types.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Coordinate } from '../model/coordinate'; - -/** - * Represents the width of a line. - */ -export type LineWidth = 1 | 2 | 3 | 4; - -/** - * Represents the possible line types. - */ -export const enum LineType { - /** - * A line. - */ - Simple, - /** - * A stepped line. - */ - WithSteps, - /** - * A curved line. - */ - Curved, -} - -/** - * A point on a line. - */ -export interface LinePoint { - /** - * The point's x coordinate. - */ - x: Coordinate; - /** - * The point's y coordinate. - */ - y: Coordinate; -} - -/** - * Represents the possible line styles. - */ -export const enum LineStyle { - /** - * A solid line. - */ - Solid = 0, - /** - * A dotted line. - */ - Dotted = 1, - /** - * A dashed line. - */ - Dashed = 2, - /** - * A dashed line with bigger dashes. - */ - LargeDashed = 3, - /** - * A dotted line with more space between dots. - */ - SparseDotted = 4, -} diff --git a/src/renderers/walk-line.ts b/src/renderers/walk-line.ts index 41fabebbcf..0990507964 100644 --- a/src/renderers/walk-line.ts +++ b/src/renderers/walk-line.ts @@ -3,7 +3,7 @@ import { BitmapCoordinatesRenderingScope } from 'fancy-canvas'; import { Coordinate } from '../model/coordinate'; import { SeriesItemsIndexesRange } from '../model/time-data'; -import { LinePoint, LineType } from './line-types'; +import { LinePoint, LineType } from './draw-line'; // eslint-disable-next-line max-params, complexity export function walkLine( diff --git a/src/views/pane/series-horizontal-line-pane-view.ts b/src/views/pane/series-horizontal-line-pane-view.ts index 221e4d2727..8fe2e24564 100644 --- a/src/views/pane/series-horizontal-line-pane-view.ts +++ b/src/views/pane/series-horizontal-line-pane-view.ts @@ -2,9 +2,9 @@ import { IChartModelBase } from '../../model/chart-model'; import { Coordinate } from '../../model/coordinate'; import { ISeries } from '../../model/series'; import { SeriesType } from '../../model/series-options'; +import { LineStyle } from '../../renderers/draw-line'; import { HorizontalLineRenderer, HorizontalLineRendererData } from '../../renderers/horizontal-line-renderer'; import { IPaneRenderer } from '../../renderers/ipane-renderer'; -import { LineStyle } from '../../renderers/line-types'; import { IPaneView } from './ipane-view';