Skip to content

Commit

Permalink
revert useless change
Browse files Browse the repository at this point in the history
  • Loading branch information
illetid committed Oct 28, 2024
1 parent 96ab973 commit 63b7b6c
Show file tree
Hide file tree
Showing 23 changed files with 85 additions and 91 deletions.
2 changes: 1 addition & 1 deletion src/api/options/crosshair-options-defaults.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/api/options/grid-options-defaults.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/api/options/price-line-options-defaults.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/api/options/series-options-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/model/crosshair.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/model/grid.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/model/price-line-options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LineStyle, LineWidth } from '../renderers/line-types';
import { LineStyle, LineWidth } from '../renderers/draw-line';

/**
* Represents a price line options.
Expand Down
2 changes: 1 addition & 1 deletion src/model/series-options.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/model/series/area-series.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/model/series/baseline-series.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/model/series/line-series.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/area-renderer-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/crosshair-renderer.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
65 changes: 64 additions & 1 deletion src/renderers/draw-line.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/draw-series-point-markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TItem extends LinePoint, TStyle extends CanvasRenderingContext2D['fillStyle']>(
renderingScope: BitmapCoordinatesRenderingScope,
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/grid-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/horizontal-line-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/iprice-axis-view-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/line-renderer-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
64 changes: 0 additions & 64 deletions src/renderers/line-types.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/renderers/walk-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TItem extends LinePoint, TStyle extends CanvasRenderingContext2D['fillStyle' | 'strokeStyle']>(
Expand Down
2 changes: 1 addition & 1 deletion src/views/pane/series-horizontal-line-pane-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit 63b7b6c

Please sign in to comment.