@soonspacejs/plugin-heat-map 2.11.38 → 2.11.40
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/README.md +4 -4
- package/dist/CreateDrawing.d.ts +39 -0
- package/dist/index.d.ts +109 -0
- package/dist/tools.d.ts +35 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# @soonspacejs/plugin-heat-map
|
|
2
|
-
|
|
3
|
-
> Haet-map plugin for SoonSpace.js
|
|
4
|
-
|
|
1
|
+
# @soonspacejs/plugin-heat-map
|
|
2
|
+
|
|
3
|
+
> Haet-map plugin for SoonSpace.js
|
|
4
|
+
|
|
5
5
|
Document: [http://www.xwbuilders.com:8800/plugin/heat-map.html](http://www.xwbuilders.com:8800/plugin/heat-map.html)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import SoonSpace from 'soonspacejs';
|
|
3
|
+
import type { PluginObject } from 'soonspacejs/types/Library';
|
|
4
|
+
import HeatMapPlugin, { DrawingParam, ScenePolygonDataPoint, StoreValue, StoreValuePolygon } from '.';
|
|
5
|
+
declare class CreateDrawing {
|
|
6
|
+
readonly heatMapPlugin: HeatMapPlugin;
|
|
7
|
+
readonly store: Map<string | number, StoreValue | StoreValuePolygon>;
|
|
8
|
+
ssp: SoonSpace;
|
|
9
|
+
intervalId: NodeJS.Timeout | null;
|
|
10
|
+
currentMouseEvent: MouseEvent | null;
|
|
11
|
+
lastTime: Date | undefined;
|
|
12
|
+
events: {
|
|
13
|
+
[key in string]: ((event: KeyboardEvent) => void) | ((event: PointerEvent) => void);
|
|
14
|
+
};
|
|
15
|
+
isDragging: boolean;
|
|
16
|
+
isStarting: boolean;
|
|
17
|
+
createDrawingParam: DrawingParam;
|
|
18
|
+
dataPoints: DrawingParam['data'];
|
|
19
|
+
object: PluginObject;
|
|
20
|
+
startResolve: ((value: ScenePolygonDataPoint[] | PromiseLike<ScenePolygonDataPoint[]>) => void) | undefined;
|
|
21
|
+
startReject: ((value: ScenePolygonDataPoint[] | PromiseLike<ScenePolygonDataPoint[]>) => void) | undefined;
|
|
22
|
+
constructor(heatMapPlugin: HeatMapPlugin, param: DrawingParam);
|
|
23
|
+
start: () => Promise<ScenePolygonDataPoint[]>;
|
|
24
|
+
cancel: () => void;
|
|
25
|
+
dispose: () => void;
|
|
26
|
+
done: () => void;
|
|
27
|
+
remove: () => void;
|
|
28
|
+
private pushPoint;
|
|
29
|
+
private popPoint;
|
|
30
|
+
private handleAddPoint;
|
|
31
|
+
private setMouseEvent;
|
|
32
|
+
private handleEventListeners;
|
|
33
|
+
private keyEvents;
|
|
34
|
+
private getPoint;
|
|
35
|
+
private onPointerdown;
|
|
36
|
+
private onPointerMove;
|
|
37
|
+
private onPointerUp;
|
|
38
|
+
}
|
|
39
|
+
export default CreateDrawing;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Box2, Matrix4, Vector3 } from 'three';
|
|
2
|
+
import SoonSpace, { IVector3, PlaneIVector2, SignalsState } from 'soonspacejs';
|
|
3
|
+
import type { PluginObject } from 'soonspacejs/types/Library';
|
|
4
|
+
import HeatMap, { DataPoint } from 'heatmap-ts';
|
|
5
|
+
import CreateDrawing from './CreateDrawing';
|
|
6
|
+
export interface SceneDataPoint extends Omit<DataPoint, 'y'> {
|
|
7
|
+
z: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ScenePolygonDataPoint extends DataPoint {
|
|
10
|
+
z: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CanvasSize {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateParam {
|
|
17
|
+
id: string;
|
|
18
|
+
name?: PluginObject['name'];
|
|
19
|
+
data: SceneDataPoint[];
|
|
20
|
+
yAxisHeight: number;
|
|
21
|
+
minPosition: PlaneIVector2;
|
|
22
|
+
maxPosition: PlaneIVector2;
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
radius?: number;
|
|
26
|
+
canvasScalar?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface CreatePolygonParam {
|
|
29
|
+
id: string;
|
|
30
|
+
name?: PluginObject['name'];
|
|
31
|
+
data?: ScenePolygonDataPoint[];
|
|
32
|
+
points: IVector3[];
|
|
33
|
+
min?: number;
|
|
34
|
+
max?: number;
|
|
35
|
+
radius?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface StartParam {
|
|
38
|
+
id: string;
|
|
39
|
+
name?: PluginObject['name'];
|
|
40
|
+
data: ScenePolygonDataPoint[];
|
|
41
|
+
points: IVector3[];
|
|
42
|
+
min?: number;
|
|
43
|
+
max?: number;
|
|
44
|
+
radius?: number;
|
|
45
|
+
value?: number | number[];
|
|
46
|
+
}
|
|
47
|
+
type DrawingModeKeyType = {
|
|
48
|
+
[keyType in 'keyDown' | 'keyUp']?: string[];
|
|
49
|
+
};
|
|
50
|
+
export type DrawingModeType = (keyof SignalsState | DrawingModeKeyType | 'time')[];
|
|
51
|
+
export interface DrawingParam {
|
|
52
|
+
id: string;
|
|
53
|
+
name?: PluginObject['name'];
|
|
54
|
+
data: ScenePolygonDataPoint[];
|
|
55
|
+
points: IVector3[];
|
|
56
|
+
min?: number;
|
|
57
|
+
max?: number;
|
|
58
|
+
radius?: number;
|
|
59
|
+
value?: number | number[];
|
|
60
|
+
timeInterval?: number;
|
|
61
|
+
distanceInterval?: number;
|
|
62
|
+
addTriggerType?: DrawingModeType;
|
|
63
|
+
doneTriggerType?: DrawingModeType;
|
|
64
|
+
undoTriggerType?: DrawingModeType;
|
|
65
|
+
onAdd?: (point: ScenePolygonDataPoint, data: ScenePolygonDataPoint[]) => void;
|
|
66
|
+
onUndo?: (point: ScenePolygonDataPoint, data: ScenePolygonDataPoint[]) => void;
|
|
67
|
+
beforePointUpdate?: (type: StartEventType, point: ScenePolygonDataPoint, data: ScenePolygonDataPoint[]) => boolean | ScenePolygonDataPoint;
|
|
68
|
+
}
|
|
69
|
+
export declare const enum StartEventType {
|
|
70
|
+
'add' = "add",
|
|
71
|
+
'undo' = "undo"
|
|
72
|
+
}
|
|
73
|
+
export interface StoreValue {
|
|
74
|
+
object: PluginObject;
|
|
75
|
+
canvas: HTMLCanvasElement;
|
|
76
|
+
param: CreateParam;
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
projectionMatrix?: Matrix4;
|
|
80
|
+
polygonBox?: Box2;
|
|
81
|
+
}
|
|
82
|
+
export interface StoreValuePolygon {
|
|
83
|
+
object: PluginObject;
|
|
84
|
+
canvas: HTMLCanvasElement;
|
|
85
|
+
param: CreatePolygonParam;
|
|
86
|
+
projectionMatrix: Matrix4;
|
|
87
|
+
polygonBox: Box2;
|
|
88
|
+
position: Vector3;
|
|
89
|
+
}
|
|
90
|
+
export default class HeatMapPlugin {
|
|
91
|
+
readonly ssp: SoonSpace;
|
|
92
|
+
hmInstance: HeatMap | null;
|
|
93
|
+
readonly store: Map<string | number, StoreValue | StoreValuePolygon>;
|
|
94
|
+
constructor(ssp: SoonSpace);
|
|
95
|
+
maxCanvasSize: number;
|
|
96
|
+
create(param: CreateParam): PluginObject;
|
|
97
|
+
createPolygon(param: CreatePolygonParam): PluginObject;
|
|
98
|
+
createDrawing(param: DrawingParam): CreateDrawing;
|
|
99
|
+
setData(id: CreateParam['id'], data: CreateParam['data']): PluginObject | void;
|
|
100
|
+
setDataPolygon(id: CreateParam['id'], data: Exclude<CreatePolygonParam['data'], undefined>): PluginObject | void;
|
|
101
|
+
getById(id: PluginObject['id']): PluginObject | null;
|
|
102
|
+
getByName(name: string): PluginObject[];
|
|
103
|
+
removeById(id: PluginObject['id'] | string): boolean;
|
|
104
|
+
private createInitData;
|
|
105
|
+
private _formatCanvasSize;
|
|
106
|
+
private _formatData;
|
|
107
|
+
private _formatData_Polygon;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import SoonSpace from 'soonspacejs/types/index';
|
|
2
|
+
import { Matrix3, Vector3, Box2, Matrix4, ShapeGeometry } from 'three';
|
|
3
|
+
import { DrawingParam, ScenePolygonDataPoint, StartEventType, StoreValuePolygon } from '.';
|
|
4
|
+
export declare function getPolygonGeometryInfo(points: Vector3[]): {
|
|
5
|
+
geometry: ShapeGeometry;
|
|
6
|
+
polygonBox: Box2;
|
|
7
|
+
modelMatrix: Matrix4;
|
|
8
|
+
planeMatrix: Matrix4;
|
|
9
|
+
projectionMatrix: Matrix4;
|
|
10
|
+
position: Vector3;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* 创建平面投影矩阵
|
|
14
|
+
* @param points
|
|
15
|
+
*/
|
|
16
|
+
export declare function createPlaneMatrix(points: Vector3[]): Matrix3;
|
|
17
|
+
/**
|
|
18
|
+
* 创建 uv 变换矩阵
|
|
19
|
+
* @remarks
|
|
20
|
+
* 需要对热力图数据进行y值翻转
|
|
21
|
+
* @param points
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export declare function createUVMatrix(box: Box2): Matrix3;
|
|
25
|
+
/**
|
|
26
|
+
* 不需要对热力图数据进行y值翻转
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 生成区间内随机数
|
|
30
|
+
* @param min
|
|
31
|
+
* @param max
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateRandomNumber(min: number, max: number): number;
|
|
35
|
+
export declare function getHeatPoint(event: MouseEvent, type: StartEventType, param: DrawingParam, dataPoints: DrawingParam['data'], store: StoreValuePolygon, ssp: SoonSpace): ScenePolygonDataPoint | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-heat-map",
|
|
3
3
|
"pluginName": "HeatMapPlugin",
|
|
4
|
-
"version": "2.11.
|
|
4
|
+
"version": "2.11.40",
|
|
5
5
|
"description": "Haet-map plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"heatmap-ts": "^0.0.4"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "fb93438e409cbbd6930d3f8218c7c95db92e94d0",
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"soonspacejs": "2.11.
|
|
21
|
+
"soonspacejs": "2.11.40"
|
|
22
22
|
}
|
|
23
23
|
}
|