Skip to content

Commit

Permalink
chore: normalize angle with vutil
Browse files Browse the repository at this point in the history
  • Loading branch information
skie1997 committed May 28, 2024
1 parent a499550 commit fcfa849
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/vrender-components/src/segment/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { ILineGraphicWithCornerRadius, SegmentAttributes, SymbolAttributes
import type { Point } from '../core/type';
import type { ComponentOptions } from '../interface';
import { loadSegmentComponent } from './register';
import { normalizeAngle } from '@visactor/vutils';

loadSegmentComponent();
export class Segment extends AbstractComponent<Required<SegmentAttributes>> {
Expand All @@ -25,23 +26,15 @@ export class Segment extends AbstractComponent<Required<SegmentAttributes>> {
* 外部获取segment起点正方向
*/
getStartAngle() {
return this._startAngle < 0
? this._startAngle + Math.PI * 2
: this._startAngle > Math.PI * 2
? this._startAngle - Math.PI * 2
: this._startAngle;
return normalizeAngle(this._startAngle);
}

protected _endAngle!: number;
/**
* 外部获取segment终点正方向
*/
getEndAngle() {
return this._endAngle < 0
? this._endAngle + Math.PI * 2
: this._endAngle > Math.PI * 2
? this._endAngle - Math.PI * 2
: this._endAngle;
return normalizeAngle(this._endAngle);
}

protected _mainSegmentPoints: Point[]; // 组成主线段的点
Expand Down

0 comments on commit fcfa849

Please sign in to comment.