Skip to content

Commit

Permalink
chore: reconfig delta value to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
skie1997 committed May 28, 2024
1 parent 3fe7949 commit a499550
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/vrender-components/src/marker/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { TextAlignType, TextBaselineType } from '@visactor/vrender-core';
import { IMarkAreaLabelPosition, IMarkLineLabelPosition, IMarkCommonArcLabelPosition } from './type';

export const FUZZY_EQUAL_DELTA = 0.001;
export const DEFAULT_MARK_LINE_THEME = {
interactive: true,
startSymbol: {
Expand Down
6 changes: 3 additions & 3 deletions packages/vrender-components/src/marker/line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { ArcSegment } from '../segment';
// eslint-disable-next-line no-duplicate-imports
import { Segment } from '../segment';
import { DEFAULT_STATES } from '../constant';
import { DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP, DEFAULT_MARK_LINE_THEME } from './config';
import { DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP, DEFAULT_MARK_LINE_THEME, FUZZY_EQUAL_DELTA } from './config';
import type { ILineGraphicAttribute } from '@visactor/vrender-core';
import { markCommonLineAnimate } from './animate/animate';
import { fuzzyEqualNumber, getTextAlignAttrOfVerticalDir, isPostiveXAxis } from '../util';
Expand Down Expand Up @@ -82,8 +82,8 @@ export class MarkLine extends MarkCommonLine<ILineGraphicAttribute, IMarkLineLab
protected getTextStyle(position: IMarkLineLabelPosition, labelAngle: number, autoRotate: boolean) {
// 垂直方向例外
if (
fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, 0.0001) ||
fuzzyEqualNumber(Math.abs(labelAngle), (Math.PI * 3) / 2, 0.0001)
fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, FUZZY_EQUAL_DELTA) ||
fuzzyEqualNumber(Math.abs(labelAngle), (Math.PI * 3) / 2, FUZZY_EQUAL_DELTA)
) {
return getTextAlignAttrOfVerticalDir(autoRotate, labelAngle, position);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/vrender-components/src/marker/point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { TagAttributes } from '../tag';
// eslint-disable-next-line no-duplicate-imports
import { Tag } from '../tag';
import { Marker } from './base';
import { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME } from './config';
import { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME, FUZZY_EQUAL_DELTA } from './config';
import type { IItemContent, IItemLine, MarkPointAnimationType, MarkPointAttrs, MarkerAnimationState } from './type';
// eslint-disable-next-line no-duplicate-imports
import { IMarkPointItemPosition } from './type';
Expand All @@ -43,7 +43,6 @@ export function registerMarkPointAnimate() {
MarkPoint._animate = markPointAnimate;
}

const FUZZY_EQUAL_DELTA = 0.001;
export class MarkPoint extends Marker<MarkPointAttrs, MarkPointAnimationType> {
name = 'markPoint';
static defaultAttributes = DEFAULT_MARK_POINT_THEME;
Expand Down

0 comments on commit a499550

Please sign in to comment.