Skip to content

Commit 9c4f403

Browse files
author
mige
committed
clean up
1 parent d8dc6fb commit 9c4f403

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

src/entity/Billboard/Billboard.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as React from "react";
22
import {useEffect, useRef} from "react";
3-
import {Billboard as GlobusBillboard, Vec2, Vec3} from "@openglobus/og";
4-
import {IBillboardParams} from "@openglobus/og/lib/entity/Billboard";
5-
import {RADIANS} from "@openglobus/og/lib/math";
3+
import {Billboard as GlobusBillboard, Vec2, Vec3, IBillboardParams} from "@openglobus/og";
64

75
export interface BillboardParams extends IBillboardParams {
86
name?: string;
@@ -37,7 +35,7 @@ const Billboard: React.FC<BillboardParams> = ({
3735

3836
useEffect(() => {
3937
if (typeof rotation === 'number' && billboardRef.current) {
40-
billboardRef.current?.setRotation(rotation * RADIANS)
38+
billboardRef.current?.setRotation(rotation * Math.PI / 180)
4139
}
4240
}, [rotation]);
4341

@@ -74,7 +72,7 @@ const Billboard: React.FC<BillboardParams> = ({
7472
src,
7573
offset,
7674
visibility,
77-
rotation: rotation ? rotation * RADIANS : 0
75+
rotation: rotation ? rotation * Math.PI / 180 : 0
7876
});
7977
if (billboardRef.current && _addBillboard) {
8078
_addBillboard(billboardRef.current);

src/entity/GeoObject/GeoObject.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as React from "react";
22
import {useEffect, useRef} from "react";
33
import {GeoObject as GlobusGeoObject, Vec4} from "@openglobus/og";
44
import {IGeoObjectParams} from "@openglobus/og/lib/entity/GeoObject";
5-
import {RADIANS} from "@openglobus/og/lib/math";
65

76
export interface GeoObjectParams extends IGeoObjectParams {
87
readonly _addGeoObject?: (geoObject: GlobusGeoObject) => void,

src/entity/Geometry/Geometry.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {useEffect, useRef} from "react";
2-
import {Geometry as GlobusGeometry, Vec4} from "@openglobus/og";
3-
import {GeometryTypeEnum, GeometryTypeToCoordinates, IGeometryParams} from "@openglobus/og/lib/entity/Geometry";
4-
import {htmlColorToRgba} from "@openglobus/og/lib/utils/shared";
2+
import {Geometry as GlobusGeometry, Vec4, GeometryTypeEnum, GeometryTypeToCoordinates, IGeometryParams} from "@openglobus/og";
3+
import {utils} from "@openglobus/og";
54

65

76
export interface GeometryParamsExtended<T extends keyof typeof GeometryTypeEnum = keyof typeof GeometryTypeEnum> extends Omit<IGeometryParams, 'style'> {
@@ -64,7 +63,7 @@ const Geometry = <T extends keyof typeof GeometryTypeEnum>(params: GeometryParam
6463
} else if (Array.isArray(fillColor)) {
6564
geometryRef.current.setFillColor(...fillColor);
6665
} else if (typeof fillColor === 'string' && geometryRef.current) {
67-
const fillColorVec = htmlColorToRgba(fillColor);
66+
const fillColorVec = utils.htmlColorToRgba(fillColor);
6867
geometryRef.current.setFillColor4v(fillColorVec);
6968
}
7069
}
@@ -77,7 +76,7 @@ const Geometry = <T extends keyof typeof GeometryTypeEnum>(params: GeometryParam
7776
} else if (Array.isArray(lineColor)) {
7877
geometryRef.current.setLineColor(...lineColor);
7978
} else if (typeof lineColor === 'string' && geometryRef.current) {
80-
const lineColorVec = htmlColorToRgba(lineColor);
79+
const lineColorVec = utils.htmlColorToRgba(lineColor);
8180
geometryRef.current.setLineColor4v(lineColorVec);
8281
}
8382
}
@@ -90,7 +89,7 @@ const Geometry = <T extends keyof typeof GeometryTypeEnum>(params: GeometryParam
9089
} else if (Array.isArray(strokeColor)) {
9190
geometryRef.current.setStrokeColor(...strokeColor);
9291
} else if (typeof strokeColor === 'string' && geometryRef.current) {
93-
const strokeColorVec = htmlColorToRgba(strokeColor);
92+
const strokeColorVec = utils.htmlColorToRgba(strokeColor);
9493
geometryRef.current.setStrokeColor4v(strokeColorVec);
9594
}
9695
}

src/entity/Label/Label.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as React from "react";
22
import {useEffect, useRef} from "react";
3-
import {Label as GlobusLabel, Vec2, Vec3} from "@openglobus/og";
4-
import {ILabelParams} from "@openglobus/og/lib/entity/Label";
5-
import {RADIANS} from "@openglobus/og/lib/math";
3+
import {Label as GlobusLabel, Vec2, Vec3, ILabelParams} from "@openglobus/og";
64

75
export interface LabelParams extends ILabelParams {
86
name?: string;
@@ -38,7 +36,7 @@ const Label: React.FC<LabelParams> = ({
3836

3937
useEffect(() => {
4038
if (typeof rotation === 'number' && labelRef.current) {
41-
labelRef.current?.setRotation(rotation * RADIANS)
39+
labelRef.current?.setRotation(rotation * Math.PI / 180)
4240
}
4341
}, [rotation]);
4442

@@ -122,7 +120,7 @@ const Label: React.FC<LabelParams> = ({
122120
opacity,
123121
offset,
124122
visibility,
125-
rotation: rotation ? rotation * RADIANS : 0
123+
rotation: rotation ? rotation * Math.PI / 180 : 0
126124
});
127125
if (labelRef.current && _addLabel) {
128126
_addLabel(labelRef.current);

src/entity/Polyline/Polyline.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from "react";
22
import {useEffect, useRef} from "react";
33
import {LonLat, Polyline as GlobusPolyline, Vec3} from "@openglobus/og";
44
import {IPolylineParams} from "@openglobus/og/lib/entity/Polyline";
5-
import {htmlColorToRgba} from "@openglobus/og/lib/utils/shared";
5+
import {utils} from "@openglobus/og";
66

77
type CSSColor =
88
| 'aliceblue' | 'antiquewhite' | 'aqua' | 'aquamarine' | 'azure'
@@ -70,7 +70,7 @@ const isSegmentPathColorArray = (arr: any): arr is IPolylineParams['pathColors'
7070
const convertPathColors = (pathColors: CSSColor[][] | IPolylineParams['pathColors']): IPolylineParams['pathColors'] => {
7171
if (isCSSColorArray(pathColors)) {
7272
return pathColors.map(path => path.map((c) => {
73-
const vec4Color = htmlColorToRgba(c as CSSColor); // необходимо приведение типа
73+
const vec4Color = utils.htmlColorToRgba(c as CSSColor); // необходимо приведение типа
7474
return [vec4Color.x, vec4Color.y, vec4Color.z, vec4Color.w];
7575
}));
7676
}

0 commit comments

Comments
 (0)