From d7ee304f48fb40ce21fd48a7188b54ae61b859f0 Mon Sep 17 00:00:00 2001 From: ethan Date: Sat, 23 Mar 2024 20:30:27 +0800 Subject: [PATCH] Modify the default material. --- src/arrow/curved-arrow.ts | 8 ++++---- src/arrow/straight-arrow.ts | 4 ++-- src/base.ts | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/arrow/curved-arrow.ts b/src/arrow/curved-arrow.ts index 2dd6182..f8e4fa4 100644 --- a/src/arrow/curved-arrow.ts +++ b/src/arrow/curved-arrow.ts @@ -49,8 +49,8 @@ export default class CurvedArrow extends Base { const distance = Utils.MathDistance(pnt1, pnt2); let len = distance / this.arrowLengthScale; len = len > this.maxArrowLength ? this.maxArrowLength : len; - const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, false); - const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, true); + const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, false); + const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, true); const points = [...pnt1, ...pnt2, ...leftPnt, ...pnt2, ...rightPnt]; const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points); return cartesianPoints; @@ -86,8 +86,8 @@ export default class CurvedArrow extends Base { const distance = Utils.wholeDistance(lnglatPoints); let len = distance / this.arrowLengthScale; len = len > this.maxArrowLength ? this.maxArrowLength : len; - const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, false); - const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, true); + const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, false); + const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, true); const temp = [].concat(...curvePoints); const points = [...temp, ...leftPnt, ...pnt2, ...rightPnt]; const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points); diff --git a/src/arrow/straight-arrow.ts b/src/arrow/straight-arrow.ts index d014b49..3c3bce4 100644 --- a/src/arrow/straight-arrow.ts +++ b/src/arrow/straight-arrow.ts @@ -65,8 +65,8 @@ export default class StraightArrow extends Base { const distance = Utils.MathDistance(pnt1, pnt2); let len = distance / this.arrowLengthScale; len = len > this.maxArrowLength ? this.maxArrowLength : len; - const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, false); - const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 3, true); + const leftPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, false); + const rightPnt = Utils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len / 2, true); const points = [...pnt1, ...pnt2, ...leftPnt, ...pnt2, ...rightPnt]; const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(points); return cartesianPoints; diff --git a/src/base.ts b/src/base.ts index 6e4e905..9f107db 100644 --- a/src/base.ts +++ b/src/base.ts @@ -57,8 +57,8 @@ export default class Base { if (this.type === 'polygon') { this.style = Object.assign( { - material: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 0.2)'), - outlineMaterial: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'), + material: new this.cesium.Color(), + outlineMaterial: new this.cesium.Color(), outlineWidth: 2, }, style, @@ -66,7 +66,7 @@ export default class Base { } else if (this.type === 'line') { this.style = Object.assign( { - material: this.cesium.Color.fromCssColorString('rgba(59, 178, 208, 1.0)'), + material: new this.cesium.Color(), lineWidth: 2, }, style, @@ -702,7 +702,7 @@ export default class Base { } let endPoint = points[movingPointIndex]; // To dynamically add points between the startPoint and endPoint, consistent with the initial drawing logic, - // update the point at index movingPointIndex in the points array with the newPosition, + // update the point at index movingPointIndex in the points array with the newPosition, // generate the arrow, and execute the animation. const t = (elapsedTime - currentSegment * segmentDuration) / segmentDuration; const newPosition = this.cesium.Cartesian3.lerp(startPoint, endPoint, t, new this.cesium.Cartesian3());