@anov/3d-ability 0.0.140 → 0.0.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/business/Animation/motion/index.js +35 -56
- package/dist/business/Animation/motion/index.js.map +1 -1
- package/dist/business/Animation/type.js +2 -2
- package/dist/business/Area/Fence/FenceBase.js +146 -187
- package/dist/business/Area/Fence/FenceBase.js.map +1 -1
- package/dist/business/Area/Fence/fence_base_01.js +120 -112
- package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_feeting_01.js +218 -130
- package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_roll_01.js +140 -130
- package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
- package/dist/business/Area/FillArea/FillAreaBase.js +87 -126
- package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_face_01.js +72 -98
- package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_line_01.js +66 -94
- package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
- package/dist/business/Area/index.js +267 -483
- package/dist/business/Area/index.js.map +1 -1
- package/dist/business/Area/tool.js +14 -26
- package/dist/business/Area/tool.js.map +1 -1
- package/dist/business/Base/ObjectLayer.js +21 -46
- package/dist/business/Base/ObjectLayer.js.map +1 -1
- package/dist/business/Batch/index.js +189 -234
- package/dist/business/Batch/index.js.map +1 -1
- package/dist/business/Box/index.js +52 -81
- package/dist/business/Box/index.js.map +1 -1
- package/dist/business/Cylinder/index.js +51 -79
- package/dist/business/Cylinder/index.js.map +1 -1
- package/dist/business/Flyline/bubble/CircleBubble.js +1 -9
- package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
- package/dist/business/Flyline/bubble/index.js +7 -21
- package/dist/business/Flyline/bubble/index.js.map +1 -1
- package/dist/business/Flyline/index.js +96 -162
- package/dist/business/Flyline/index.js.map +1 -1
- package/dist/business/Flyline/line/ArcLine.js +208 -291
- package/dist/business/Flyline/line/ArcLine.js.map +1 -1
- package/dist/business/Flyline/line/index.js +8 -22
- package/dist/business/Flyline/line/index.js.map +1 -1
- package/dist/business/HeatMap/HeatMap.js +380 -467
- package/dist/business/HeatMap/HeatMap.js.map +1 -1
- package/dist/business/HeatMap/core.js +405 -525
- package/dist/business/HeatMap/core.js.map +1 -1
- package/dist/business/HeatMap/shader.js +69 -3
- package/dist/business/HeatMap/shader.js.map +1 -1
- package/dist/business/InfoPanel/index.js +201 -242
- package/dist/business/InfoPanel/index.js.map +1 -1
- package/dist/business/Line/index.js +55 -88
- package/dist/business/Line/index.js.map +1 -1
- package/dist/business/Mark/KeyframeAnimation.js +145 -176
- package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
- package/dist/business/Mark/index.js +196 -294
- package/dist/business/Mark/index.js.map +1 -1
- package/dist/business/Mark/shader/tanhao.js +36 -3
- package/dist/business/Mark/shader/tanhao.js.map +1 -1
- package/dist/business/Mark/type.js +1 -1
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +377 -551
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
- package/dist/business/MaterialSwitch/inject.js +92 -58
- package/dist/business/MaterialSwitch/inject.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/finalFade.js +74 -2
- package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/ground.js +95 -16
- package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/groundBase64.js +9 -3
- package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/realFade.js +48 -9
- package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
- package/dist/business/Plane/index.js +51 -78
- package/dist/business/Plane/index.js.map +1 -1
- package/dist/business/Poi/index.d.ts +5 -0
- package/dist/business/Poi/index.js +256 -295
- package/dist/business/Poi/index.js.map +1 -1
- package/dist/business/Poi/link/Cylinder.js +56 -89
- package/dist/business/Poi/link/Cylinder.js.map +1 -1
- package/dist/business/Poi/link/Pyramid.js +104 -165
- package/dist/business/Poi/link/Pyramid.js.map +1 -1
- package/dist/business/Poi/link/index.d.ts +1 -1
- package/dist/business/Poi/link/index.js +54 -114
- package/dist/business/Poi/link/index.js.map +1 -1
- package/dist/business/Poi/panel/index.d.ts +124 -0
- package/dist/business/Poi/panel/index.js +474 -0
- package/dist/business/Poi/panel/index.js.map +1 -0
- package/dist/business/Poi/panel/interfaces.d.ts +67 -0
- package/dist/business/Poi/panel/interfaces.js +2 -0
- package/dist/business/Poi/panel/interfaces.js.map +1 -0
- package/dist/business/Poi/panel/utils.d.ts +72 -0
- package/dist/business/Poi/panel/utils.js +126 -0
- package/dist/business/Poi/panel/utils.js.map +1 -0
- package/dist/business/Poi/particle/DoubleCircle.js +71 -107
- package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
- package/dist/business/Poi/particle/DynamicCircle.js +75 -111
- package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
- package/dist/business/Poi/particle/SingleCircle.js +62 -98
- package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
- package/dist/business/Poi/particle/index.js +49 -117
- package/dist/business/Poi/particle/index.js.map +1 -1
- package/dist/business/Poi/shader/circle.js +31 -3
- package/dist/business/Poi/shader/circle.js.map +1 -1
- package/dist/business/Poi/shader/cylinder.js +37 -3
- package/dist/business/Poi/shader/cylinder.js.map +1 -1
- package/dist/business/Poi/shader/doubleCircle.js +55 -3
- package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
- package/dist/business/Poi/shader/dynamicCircle.js +67 -3
- package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
- package/dist/business/Poi/title/Border.js +7 -27
- package/dist/business/Poi/title/Border.js.map +1 -1
- package/dist/business/Poi/title/Ellipse.js +7 -27
- package/dist/business/Poi/title/Ellipse.js.map +1 -1
- package/dist/business/Poi/title/index.js +208 -292
- package/dist/business/Poi/title/index.js.map +1 -1
- package/dist/business/Poi/tools.js +22 -19
- package/dist/business/Poi/tools.js.map +1 -1
- package/dist/business/Poi/types.d.ts +3 -0
- package/dist/business/Poi/types.js.map +1 -1
- package/dist/business/Sphere/index.js +47 -72
- package/dist/business/Sphere/index.js.map +1 -1
- package/dist/business/Spline/index.js +190 -245
- package/dist/business/Spline/index.js.map +1 -1
- package/dist/business/SplitBuilding/index.js +327 -536
- package/dist/business/SplitBuilding/index.js.map +1 -1
- package/dist/business/SplitBuilding/type.js +2 -2
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +218 -275
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +132 -177
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +51 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +6 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
- package/dist/business/TrafficComponents/base.js +32 -55
- package/dist/business/TrafficComponents/base.js.map +1 -1
- package/dist/business/TrafficComponents/utils.js +25 -24
- package/dist/business/TrafficComponents/utils.js.map +1 -1
- package/dist/business/Utils/Curve.js +40 -56
- package/dist/business/Utils/Curve.js.map +1 -1
- package/dist/business/Utils/constant.js +1 -1
- package/dist/business/Utils/constant.js.map +1 -1
- package/dist/business/Utils/defineProps.js +13 -14
- package/dist/business/Utils/defineProps.js.map +1 -1
- package/dist/business/Utils/round-curve.js +127 -153
- package/dist/business/Utils/round-curve.js.map +1 -1
- package/dist/business/VideoPanel/index.js +258 -319
- package/dist/business/VideoPanel/index.js.map +1 -1
- package/dist/business/Water/index.js +78 -108
- package/dist/business/Water/index.js.map +1 -1
- package/dist/business/Water/types.js +1 -1
- package/dist/business/Water/types.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +383 -449
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +107 -142
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
- package/dist/core/Controls/FirstViewControl/index.js +84 -96
- package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/action/input.js +77 -98
- package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/index.js +19 -28
- package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/animation.js +126 -155
- package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/camera.js +47 -63
- package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/control.js +39 -49
- package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player.js +66 -91
- package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
- package/dist/core/Controls/base.js +14 -30
- package/dist/core/Controls/base.js.map +1 -1
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +92 -131
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
- package/dist/core/Debug/PerformanceInfo/Performance.js +22 -47
- package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
- package/dist/core/Light/PointLight/PointLightExt.js +4 -21
- package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
- package/dist/core/Material/FinirMaterial/FinirMaterial.js +37 -57
- package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +116 -153
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js +95 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js +26 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
- package/dist/core/Material/SurfaceMaterial/index.js +76 -172
- package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
- package/dist/core/Material/decorators.js +6 -11
- package/dist/core/Material/decorators.js.map +1 -1
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +16 -12
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
- package/dist/core/PostEffects/addBrightnessContrastPass.js +17 -13
- package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
- package/dist/core/PostEffects/bloomPass.js +17 -10
- package/dist/core/PostEffects/bloomPass.js.map +1 -1
- package/dist/core/PostEffects/bloomSelect.js +60 -43
- package/dist/core/PostEffects/bloomSelect.js.map +1 -1
- package/dist/core/PostEffects/colorifyPass.js +17 -13
- package/dist/core/PostEffects/colorifyPass.js.map +1 -1
- package/dist/core/PostEffects/index.js +28 -22
- package/dist/core/PostEffects/index.js.map +1 -1
- package/dist/core/PostEffects/outlinePass.js +37 -50
- package/dist/core/PostEffects/outlinePass.js.map +1 -1
- package/dist/core/PostEffects/postprocessing.js +14 -12
- package/dist/core/PostEffects/postprocessing.js.map +1 -1
- package/dist/core/PostEffects/saoPass.js +15 -10
- package/dist/core/PostEffects/saoPass.js.map +1 -1
- package/dist/core/PostEffects/shader/colorify.js +22 -3
- package/dist/core/PostEffects/shader/colorify.js.map +1 -1
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js +27 -3
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
- package/dist/core/PostEffects/shader/mapping.js +66 -3
- package/dist/core/PostEffects/shader/mapping.js.map +1 -1
- package/dist/core/PostEffects/shader/thermalMaging.js +28 -3
- package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
- package/dist/core/SceneEffect/grow/grow.js +85 -101
- package/dist/core/SceneEffect/grow/grow.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_down.js +60 -77
- package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_up.js +64 -81
- package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
- package/dist/core/SceneEffect/grow/type.js +2 -2
- package/dist/core/SceneEffect/grow/type.js.map +1 -1
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js +51 -76
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
- package/dist/core/WeatherSystem/hdr/index.js +69 -105
- package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
- package/dist/core/WeatherSystem/index.js +77 -124
- package/dist/core/WeatherSystem/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/fog/index.js +52 -80
- package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/index.js +72 -84
- package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/lineRain.js +88 -118
- package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/plane.js +116 -146
- package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/point.js +100 -148
- package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/cloud.js +71 -104
- package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/index.js +66 -84
- package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/outline.js +25 -45
- package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/cloud.js +74 -3
- package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/fog.js +103 -3
- package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/rain.js +206 -7
- package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/sky.js +87 -3
- package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
- package/dist/core/WeatherSystem/sky/index.js +104 -135
- package/dist/core/WeatherSystem/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/utils/constant.js +44 -38
- package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
- package/dist/core/WeatherSystem/utils/math.js +18 -25
- package/dist/core/WeatherSystem/utils/math.js.map +1 -1
- package/dist/core/WeatherSystem/utils/type.js +1 -1
- package/dist/core/WeatherSystem/utils/type.js.map +1 -1
- package/dist/core/WeatherSystem/weather/index.js +96 -141
- package/dist/core/WeatherSystem/weather/index.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { CanvasTexture, Vector3 } from '@anov/3d-core';
|
|
2
2
|
// 获取文字的canvas
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
text
|
|
6
|
-
fontSize
|
|
7
|
-
color
|
|
8
|
-
fontWeight
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ctx
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
export const createTextCanvas = option => {
|
|
4
|
+
const {
|
|
5
|
+
value: text,
|
|
6
|
+
fontSize,
|
|
7
|
+
color,
|
|
8
|
+
fontWeight
|
|
9
|
+
} = option || {};
|
|
10
|
+
const pixelRatio = 1; // window.devicePixelRatio || 1
|
|
11
|
+
const tempCanvas = document.createElement('canvas');
|
|
12
|
+
const ctx = tempCanvas.getContext('2d');
|
|
13
|
+
ctx.font = `${fontWeight} ${fontSize * pixelRatio}px Arial`;
|
|
14
|
+
const textWidth = Math.ceil(ctx.measureText(text).width);
|
|
15
|
+
const textHeight = Math.ceil(fontSize * pixelRatio * 1.1);
|
|
16
|
+
const canvas = document.createElement('canvas');
|
|
16
17
|
canvas.width = textWidth;
|
|
17
18
|
canvas.height = textHeight;
|
|
18
|
-
|
|
19
|
+
const context = canvas.getContext('2d');
|
|
19
20
|
context.fillStyle = color;
|
|
20
21
|
context.font = ctx.font;
|
|
21
22
|
context.textAlign = 'center';
|
|
@@ -27,12 +28,14 @@ export var createTextCanvas = function createTextCanvas(option) {
|
|
|
27
28
|
texture: new CanvasTexture(canvas)
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
|
-
export
|
|
31
|
-
|
|
31
|
+
export const lookAtOnYAxis = (mesh, targetPosition) => {
|
|
32
|
+
if (!mesh || !targetPosition || !mesh.position || !mesh.rotation) return;
|
|
33
|
+
const direction = new Vector3().subVectors(targetPosition, mesh.position);
|
|
32
34
|
direction.y = 0;
|
|
33
35
|
direction.normalize();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
// 修正水平朝向计算:绕 Y 轴朝向相机
|
|
37
|
+
// 标准做法:yaw = atan2(dx, dz)
|
|
38
|
+
const yaw = Math.atan2(direction.x, direction.z);
|
|
39
|
+
mesh.rotation.y = yaw;
|
|
37
40
|
};
|
|
38
41
|
//# sourceMappingURL=tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CanvasTexture","Vector3","createTextCanvas","option","
|
|
1
|
+
{"version":3,"names":["CanvasTexture","Vector3","createTextCanvas","option","value","text","fontSize","color","fontWeight","pixelRatio","tempCanvas","document","createElement","ctx","getContext","font","textWidth","Math","ceil","measureText","width","textHeight","canvas","height","context","fillStyle","textAlign","textBaseline","fillText","texture","lookAtOnYAxis","mesh","targetPosition","position","rotation","direction","subVectors","y","normalize","yaw","atan2","x","z"],"sources":["../../../src/business/Poi/tools.ts"],"sourcesContent":["import { CanvasTexture, Vector3 } from '@anov/3d-core'\n\nexport interface TextOption {\n value?: string\n fontSize?: number\n color?: string\n fontWeight?: string\n}\n// 获取文字的canvas\nexport const createTextCanvas = (option: TextOption) => {\n const { value: text, fontSize, color, fontWeight } = option || {}\n\n const pixelRatio = 1// window.devicePixelRatio || 1\n const tempCanvas = document.createElement('canvas')\n const ctx = tempCanvas.getContext('2d')!\n ctx.font = `${fontWeight} ${fontSize * pixelRatio}px Arial`\n\n const textWidth = Math.ceil(ctx.measureText(text).width)\n const textHeight = Math.ceil(fontSize * pixelRatio * 1.1)\n\n const canvas = document.createElement('canvas')\n canvas.width = textWidth\n canvas.height = textHeight\n const context = canvas.getContext('2d')!\n context.fillStyle = color\n context.font = ctx.font\n context.textAlign = 'center'\n context.textBaseline = 'middle'\n context.fillText(text, textWidth / 2, textHeight / 2)\n\n return { width: textWidth, height: textHeight, texture: new CanvasTexture(canvas) }\n}\n\nexport const lookAtOnYAxis = (mesh, targetPosition) => {\n if (!mesh || !targetPosition || !mesh.position || !mesh.rotation)\n return\n const direction = new Vector3().subVectors(targetPosition, mesh.position)\n direction.y = 0\n direction.normalize()\n // 修正水平朝向计算:绕 Y 轴朝向相机\n // 标准做法:yaw = atan2(dx, dz)\n const yaw = Math.atan2(direction.x, direction.z)\n mesh.rotation.y = yaw\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,OAAO,QAAQ,eAAe;AAQtD;AACA,OAAO,MAAMC,gBAAgB,GAAIC,MAAkB,IAAK;EACtD,MAAM;IAAEC,KAAK,EAAEC,IAAI;IAAEC,QAAQ;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGL,MAAM,IAAI,CAAC,CAAC;EAEjE,MAAMM,UAAU,GAAG,CAAC;EACpB,MAAMC,UAAU,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EACnD,MAA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,SAAS,CAACE,CAAC,GAAG,CAAC;EACfF,SAAS,CAACG,SAAS,CAAC,CAAC;EACrB;EACA;EACA,MAAMC,GAAG,GAAGtB,IAAI,CAACuB,KAAK,CAACL,SAAS,CAACM,CAAC,EAAEN,SAAS,CAACO,CAAC,CAAC;EAChDX,IAAI,CAACG,QAAQ,CAACG,CAAC,GAAGE,GAAG;AACvB,CAAC"}
|
|
@@ -7,6 +7,8 @@ export type TextOption = Partial<{
|
|
|
7
7
|
fontWeight: string;
|
|
8
8
|
offset: [number, number];
|
|
9
9
|
bgUrl: string;
|
|
10
|
+
slice: [number, number, number, number];
|
|
11
|
+
hueRotate: number;
|
|
10
12
|
uri: string;
|
|
11
13
|
}>;
|
|
12
14
|
export type ModelOption = Partial<{
|
|
@@ -27,6 +29,7 @@ export type Option = Partial<{
|
|
|
27
29
|
text: TextOption;
|
|
28
30
|
model: ModelOption;
|
|
29
31
|
particle: ParticleOption;
|
|
32
|
+
content: TextOption;
|
|
30
33
|
}>;
|
|
31
34
|
export interface IPoi {
|
|
32
35
|
mesh: Group;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/business/Poi/types.ts"],"sourcesContent":["import type { Group } from '@anov/3d-core'\n\nexport type TextOption = Partial<{\n visible: boolean\n value: string\n fontSize: number\n color: string\n fontWeight: string\n offset: [number, number]\n bgUrl: string\n uri: string\n}>\n\nexport type ModelOption = Partial<{\n visible: boolean\n uri: string\n color: string\n}>\n\nexport type ParticleOption = Partial<{\n visible: boolean\n uri: string\n radius: number\n color: string\n}>\n\nexport type Option = Partial<{\n facingCamera: boolean\n autoScale: boolean\n style: string\n text: TextOption\n model: ModelOption\n particle: ParticleOption\n}>\n\nexport interface IPoi {\n\n mesh: Group\n facingCamera: boolean\n autoScale: boolean\n\n destroy()\n\n}"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/business/Poi/types.ts"],"sourcesContent":["import type { Group } from '@anov/3d-core'\n\nexport type TextOption = Partial<{\n visible: boolean\n value: string\n fontSize: number\n color: string\n fontWeight: string\n offset: [number, number]\n bgUrl: string\n slice: [number, number, number, number]\n hueRotate: number\n uri: string\n}>\n\nexport type ModelOption = Partial<{\n visible: boolean\n uri: string\n color: string\n}>\n\nexport type ParticleOption = Partial<{\n visible: boolean\n uri: string\n radius: number\n color: string\n}>\n\nexport type Option = Partial<{\n facingCamera: boolean\n autoScale: boolean\n style: string\n text: TextOption\n model: ModelOption\n particle: ParticleOption\n content: TextOption\n}>\n\nexport interface IPoi {\n\n mesh: Group\n facingCamera: boolean\n autoScale: boolean\n\n destroy()\n\n}"],"mappings":""}
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
16
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
6
|
/*
|
|
18
7
|
* @Descripttion: Box 封装
|
|
19
8
|
* @version:
|
|
@@ -28,64 +17,50 @@ import ObjectLayer from "../Base/ObjectLayer";
|
|
|
28
17
|
import { SphereGeometry, MeshBasicMaterial, Mesh } from '@anov/3d-core';
|
|
29
18
|
import _ from 'lodash';
|
|
30
19
|
import { defineProps } from "../Utils/defineProps";
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_this.currentOptions = options;
|
|
41
|
-
_this.mesh = _this.createSphere(options);
|
|
42
|
-
_this.add(_this.mesh);
|
|
43
|
-
defineProps(_assertThisInitialized(_this), ['radius', 'sphereSegments'], ['wireframe', 'color'], 'updateSphere');
|
|
44
|
-
return _this;
|
|
20
|
+
export class Sphere extends ObjectLayer {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
super();
|
|
23
|
+
_defineProperty(this, "mesh", void 0);
|
|
24
|
+
_defineProperty(this, "currentOptions", void 0);
|
|
25
|
+
this.currentOptions = options;
|
|
26
|
+
this.mesh = this.createSphere(options);
|
|
27
|
+
this.add(this.mesh);
|
|
28
|
+
defineProps(this, ['radius', 'sphereSegments'], ['wireframe', 'color'], 'updateSphere');
|
|
45
29
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
this.remove(this.mesh);
|
|
83
|
-
this.mesh.geometry.dispose();
|
|
84
|
-
this.mesh.material.dispose();
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
this.mesh = null;
|
|
87
|
-
}
|
|
88
|
-
}]);
|
|
89
|
-
return Sphere;
|
|
90
|
-
}(ObjectLayer);
|
|
30
|
+
createSphere(options) {
|
|
31
|
+
const {
|
|
32
|
+
radius = 1,
|
|
33
|
+
sphereSegments = 16,
|
|
34
|
+
material = {}
|
|
35
|
+
} = options;
|
|
36
|
+
const defaultMat = {
|
|
37
|
+
color: 0xffffff,
|
|
38
|
+
opacity: 1,
|
|
39
|
+
transparent: false,
|
|
40
|
+
wireframe: false,
|
|
41
|
+
visible: true
|
|
42
|
+
};
|
|
43
|
+
const geometry = new SphereGeometry(radius, sphereSegments, sphereSegments);
|
|
44
|
+
const mat = new MeshBasicMaterial(_objectSpread(_objectSpread({}, defaultMat), material));
|
|
45
|
+
return new Mesh(geometry, mat);
|
|
46
|
+
}
|
|
47
|
+
updateSphere(options) {
|
|
48
|
+
if (!this.mesh) return;
|
|
49
|
+
_.mergeWith(this.currentOptions, options);
|
|
50
|
+
this.remove(this.mesh);
|
|
51
|
+
this.mesh.geometry.dispose();
|
|
52
|
+
this.mesh.material.dispose();
|
|
53
|
+
this.mesh = this.createSphere(this.currentOptions);
|
|
54
|
+
this.add(this.mesh);
|
|
55
|
+
}
|
|
56
|
+
/** 销毁释放资源 */
|
|
57
|
+
destroy() {
|
|
58
|
+
if (!this.mesh) return;
|
|
59
|
+
this.remove(this.mesh);
|
|
60
|
+
this.mesh.geometry.dispose();
|
|
61
|
+
this.mesh.material.dispose();
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
this.mesh = null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
91
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ObjectLayer","SphereGeometry","MeshBasicMaterial","Mesh","_","defineProps","Sphere","
|
|
1
|
+
{"version":3,"names":["ObjectLayer","SphereGeometry","MeshBasicMaterial","Mesh","_","defineProps","Sphere","constructor","options","_defineProperty","currentOptions","mesh","createSphere","add","radius","sphereSegments","material","defaultMat","color","opacity","transparent","wireframe","visible","geometry","mat","_objectSpread","updateSphere","mergeWith","remove","dispose","destroy"],"sources":["../../../src/business/Sphere/index.ts"],"sourcesContent":["\n/*\n * @Descripttion: Box 封装\n * @version: \n * @Author: 周志国\n * @Date: 2025-09-08\n * @LastEditors: 周志国\n * @LastEditTime: 2025-09-15 10:48:13\n * @changeLog: 实现立方体对象,支持默认参数、更新与销毁\n * @FilePath: /anov-3d-webgl/packages/anov-3d-ability/src/business/Sphere/index.ts\n */\nimport ObjectLayer from '../Base/ObjectLayer'\nimport type { options } from './types'\nimport {\n SphereGeometry,\n MeshBasicMaterial,\n MeshBasicMaterialParameters,\n Mesh,\n} from '@anov/3d-core'\nimport { ISphere } from './interface'\nimport _ from 'lodash'\nimport { defineProps } from '../Utils/defineProps'\nexport class Sphere extends ObjectLayer implements ISphere {\n private mesh!: Mesh\n private currentOptions!: options\n constructor(options: options) {\n super()\n this.currentOptions = options\n this.mesh = this.createSphere(options)\n this.add(this.mesh)\n defineProps(\n this,\n ['radius', 'sphereSegments'],\n ['wireframe', 'color'],\n 'updateSphere'\n )\n }\n createSphere(options: options): Mesh {\n const {\n radius = 1,\n sphereSegments = 16,\n material = {},\n } = options\n\n const defaultMat: MeshBasicMaterialParameters = {\n color: 0xffffff,\n opacity: 1,\n transparent: false,\n wireframe: false,\n visible: true,\n }\n const geometry = new SphereGeometry(radius, sphereSegments, sphereSegments)\n const mat = new MeshBasicMaterial({ ...defaultMat, ...material })\n return new Mesh(geometry, mat)\n }\n updateSphere(options: options): void {\n if (!this.mesh) return\n _.mergeWith(this.currentOptions, options)\n this.remove(this.mesh)\n this.mesh.geometry.dispose();\n (this.mesh.material as any).dispose()\n this.mesh = this.createSphere(this.currentOptions)\n this.add(this.mesh)\n }\n /** 销毁释放资源 */\n public destroy() {\n if (!this.mesh) return\n this.remove(this.mesh)\n this.mesh.geometry.dispose()\n ; (this.mesh.material as any).dispose()\n // @ts-ignore\n this.mesh = null\n }\n}\n"],"mappings":";;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,WAAW;AAElB,SACEC,cAAc,EACdC,iBAAiB,EAEjBC,IAAI,QACC,eAAe;AAEtB,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,WAAW;AACpB,OAAO,MAAMC,MAAM,SAASN,WAAW,CAAoB;EAGzDO,WAAWA,CAACC,OAAgB,EAAE;IAC5B,KAAK,CAAC,CAAC;IAAAC,eAAA;IAAAA,eAAA;IACP,IAAI,CAACC,cAAc,GAAGF,OAAO;IAC7B,IAAI,CAACG,IAAI,GAAG,IAAI,CAACC,YAAY,CAACJ,OAAO,CAAC;IACtC,IAAI,CAACK,GAAG,CAAC,IAAI,CAACF,IAAI,CAAC;IACnBN,WAAW,CACT,IAAI,EACJ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,EAC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