代码调整

This commit is contained in:
dong 2023-08-08 11:07:40 +08:00
parent da6a739981
commit dfb98794de
3 changed files with 7 additions and 31 deletions

View File

@ -83,14 +83,6 @@ export class Curvature extends JlGraphic {
centerPos.y + distanceY - 15
);
}
get linePoints(): IPointData[] {
return this.datas.points;
}
set linePoints(points: IPointData[]) {
const old = this.datas.clone();
old.points = points;
this.updateData(old);
}
loadRelations() {
if (this.datas.refDeviceId.length) {
this.datas.refDeviceId.forEach((id) => {

View File

@ -5,15 +5,10 @@ import {
GraphicInteractionPlugin,
JlDrawApp,
JlGraphic,
linePoint,
pointBox,
} from 'src/jl-graphic';
import {
ICurvatureData,
Curvature,
CurvatureTemplate,
CurvatureConsts,
} from './Curvature';
import { ICurvatureData, Curvature, CurvatureTemplate } from './Curvature';
import { CurvatureKiloMarker } from '../curvatureKiloMarker/CurvatureKiloMarker';
export interface ICurvatureDrawOptions {
@ -121,14 +116,11 @@ class CurvatureGraphicHitArea implements IHitArea {
this.curvature = curvature;
}
contains(x: number, y: number): boolean {
for (let i = 1; i < this.curvature.datas.points.length; i++) {
const p1 = this.curvature.datas.points[i - 1];
const p2 = this.curvature.datas.points[i];
if (linePoint(p1, p2, { x, y }, CurvatureConsts.lineWidth)) {
return true;
}
}
return false;
let contains = false;
const p = new Point(x, y);
const r = this.curvature.getLocalBounds();
contains = pointBox(p, r);
return contains;
}
}

View File

@ -115,14 +115,6 @@ export class Slope extends JlGraphic {
this.slopeLong.position.set(centerPos.x, centerPos.y + 15);
}
}
get linePoints(): IPointData[] {
return this.datas.points;
}
set linePoints(points: IPointData[]) {
const old = this.datas.clone();
old.points = points;
this.updateData(old);
}
loadRelations() {
if (this.datas.refDeviceId.length) {
this.datas.refDeviceId.forEach((id) => {