@aibee/crc-bmap 0.0.9 → 0.0.10
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/example/index.html +3 -0
- package/example/src/main.ts +74 -7
- package/lib/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +4 -4
- package/lib/bmap.esm.js +1027 -690
- package/lib/bmap.esm.js.map +4 -4
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +4 -4
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +4 -4
- package/lib/src/bmap.d.ts +6 -0
- package/lib/src/config.d.ts +7 -0
- package/lib/src/context.d.ts +16 -0
- package/lib/src/elements/base-svg.d.ts +1 -1
- package/lib/src/elements/graphic.d.ts +2 -1
- package/lib/src/elements/index.d.ts +1 -0
- package/lib/src/elements/poi.d.ts +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/operations/hover/hover-helper.d.ts +25 -0
- package/lib/src/operations/hover/index.d.ts +1 -0
- package/lib/src/operations/index.d.ts +2 -0
- package/lib/src/operations/selection/box-selection.d.ts +39 -0
- package/lib/src/operations/selection/index.d.ts +1 -0
- package/lib/src/operations/selection/selection.d.ts +27 -0
- package/lib/src/utils/coordinate.d.ts +6 -0
- package/lib/src/utils/init-helper.d.ts +1 -1
- package/lib/src/utils/svg.d.ts +7 -0
- package/package.json +2 -2
package/lib/src/bmap.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare class BMap extends EventDispatcher {
|
|
|
19
19
|
private azimuthalKeys;
|
|
20
20
|
private svgLine?;
|
|
21
21
|
private svgPolygon?;
|
|
22
|
+
basicZoom: number;
|
|
22
23
|
floorDataMap: Map<string, GraphicInfo[]>;
|
|
23
24
|
constructor(container: HTMLElement, config?: Partial<Config>);
|
|
24
25
|
private loadGraphics;
|
|
@@ -28,6 +29,11 @@ export declare class BMap extends EventDispatcher {
|
|
|
28
29
|
switchFloor(floor: string): void;
|
|
29
30
|
addHeatmap(data: HeatmapDataParam): import("./elements").HeatmapElement | undefined;
|
|
30
31
|
getLegacyToGraphicMap(): any;
|
|
32
|
+
/**
|
|
33
|
+
* 获取当前楼层全部的graphic
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
getFloorAllGraphics(): Graphic[];
|
|
31
37
|
createGraphicPoi(graphic: Graphic, options: PoiOptionsParam): null;
|
|
32
38
|
removeHeatMap(): void;
|
|
33
39
|
/**
|
package/lib/src/config.d.ts
CHANGED
|
@@ -20,6 +20,13 @@ export interface Config {
|
|
|
20
20
|
stroke: string;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
selectBox: {
|
|
24
|
+
stroke: string;
|
|
25
|
+
fill: string;
|
|
26
|
+
};
|
|
27
|
+
hover: {
|
|
28
|
+
time: number;
|
|
29
|
+
};
|
|
23
30
|
}
|
|
24
31
|
export declare const defaultConfig: Config;
|
|
25
32
|
export declare function getConfig(config: Partial<Config>): Config;
|
package/lib/src/context.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { EventDispatcher, OrthographicCamera, Vector3, Object3D } from "three";
|
|
|
4
4
|
import { Graphic, Poi, Floor } from "./elements";
|
|
5
5
|
import { Group as TweenGroup } from "@tweenjs/tween.js";
|
|
6
6
|
import { Config } from "./config";
|
|
7
|
+
import { Selection } from "./operations/selection/selection";
|
|
8
|
+
import { HoverHelper } from "./operations";
|
|
7
9
|
export interface ContextEventMap {
|
|
8
10
|
update: {};
|
|
9
11
|
"graphic-click": {
|
|
@@ -27,6 +29,12 @@ export interface ContextEventMap {
|
|
|
27
29
|
'change-ratio': {
|
|
28
30
|
px: number;
|
|
29
31
|
};
|
|
32
|
+
"select-graphic": {
|
|
33
|
+
graphics: Graphic[];
|
|
34
|
+
};
|
|
35
|
+
"hover": {
|
|
36
|
+
graphics: Graphic[];
|
|
37
|
+
};
|
|
30
38
|
}
|
|
31
39
|
export declare class Context extends EventDispatcher<ContextEventMap> {
|
|
32
40
|
container: HTMLElement;
|
|
@@ -39,6 +47,8 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
|
|
|
39
47
|
timer: Timer;
|
|
40
48
|
tweenGroup: TweenGroup;
|
|
41
49
|
currentFloor?: Floor;
|
|
50
|
+
selection: Selection;
|
|
51
|
+
hoverHelper: HoverHelper;
|
|
42
52
|
private basicRatio?;
|
|
43
53
|
constructor(container: HTMLElement, config: Config);
|
|
44
54
|
init(): void;
|
|
@@ -70,6 +80,12 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
|
|
|
70
80
|
onPointerover: (e: PointerEvent) => void;
|
|
71
81
|
onPointermove: (e: PointerEvent) => void;
|
|
72
82
|
onPointerleave: () => void;
|
|
83
|
+
onSelectionSelect: ({ graphics }: {
|
|
84
|
+
graphics: Graphic[];
|
|
85
|
+
}) => void;
|
|
86
|
+
onHoverChange: ({ graphics }: {
|
|
87
|
+
graphics: Graphic[];
|
|
88
|
+
}) => void;
|
|
73
89
|
registryEvent(): void;
|
|
74
90
|
unRegistryEvent(): void;
|
|
75
91
|
/**
|
|
@@ -7,7 +7,7 @@ export declare class BaseSvg<T extends {} = {}> extends EventDispatcher<T> {
|
|
|
7
7
|
protected enable: boolean;
|
|
8
8
|
constructor(context: Context);
|
|
9
9
|
setEnable(enable: boolean): void;
|
|
10
|
-
getIntersectByPointerEvent(e: PointerEvent):
|
|
10
|
+
getIntersectByPointerEvent(e: PointerEvent): Vector3;
|
|
11
11
|
getSvgCoordinate(vector: Vector3): {
|
|
12
12
|
x: number;
|
|
13
13
|
y: number;
|
|
@@ -29,12 +29,13 @@ export declare class Graphic extends Object3D<GraphicEventMap> {
|
|
|
29
29
|
private context;
|
|
30
30
|
private geometry;
|
|
31
31
|
private material;
|
|
32
|
-
|
|
32
|
+
mesh: Mesh;
|
|
33
33
|
private line;
|
|
34
34
|
options: GraphicOptions;
|
|
35
35
|
constructor(context: Context, options: GraphicOptionsParam);
|
|
36
36
|
getCenter(): Vector3;
|
|
37
37
|
getSize(): Vector3;
|
|
38
|
+
getPosition(): Vector3;
|
|
38
39
|
init(): void;
|
|
39
40
|
initGeometry(): ExtrudeGeometry;
|
|
40
41
|
initMaterial(): MeshStandardMaterial;
|
|
@@ -21,6 +21,7 @@ export declare class Poi extends Object3D<PoiEventMap> {
|
|
|
21
21
|
options: PoiOptions;
|
|
22
22
|
constructor(context: Context, options: PoiOptionsParam);
|
|
23
23
|
initDiv(): HTMLDivElement;
|
|
24
|
+
getPosition(): import("three").Vector3;
|
|
24
25
|
initText(): HTMLSpanElement;
|
|
25
26
|
initIcon(): HTMLImageElement;
|
|
26
27
|
private _changePosition;
|
package/lib/src/index.d.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Graphic } from "../../elements";
|
|
2
|
+
import { Context } from "../../context";
|
|
3
|
+
import { EventDispatcher } from "three";
|
|
4
|
+
import { Timer } from "../../utils";
|
|
5
|
+
interface HoverHelperEventMap {
|
|
6
|
+
"hover-change": {
|
|
7
|
+
graphics: Graphic[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare class HoverHelper extends EventDispatcher<HoverHelperEventMap> {
|
|
11
|
+
private context;
|
|
12
|
+
curGraphics: Set<Graphic>;
|
|
13
|
+
timer: Timer;
|
|
14
|
+
graphicTimerMap: Map<Graphic, number>;
|
|
15
|
+
constructor(context: Context);
|
|
16
|
+
onPointerMove: ({ graphics }: {
|
|
17
|
+
graphics: Graphic[];
|
|
18
|
+
}) => void;
|
|
19
|
+
onPointerLevel: () => void;
|
|
20
|
+
handleHoverGraphicsChange(graphics?: Set<Graphic>): void;
|
|
21
|
+
registryEvent(): void;
|
|
22
|
+
unRegistryEvent(): void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hover-helper';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Context } from "../../context";
|
|
2
|
+
import { BaseSvg, Graphic } from "../../elements";
|
|
3
|
+
import { Frustum } from "three";
|
|
4
|
+
interface BoxSelectionEventMap {
|
|
5
|
+
"selected": {
|
|
6
|
+
list: Graphic[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare class BoxSelection extends BaseSvg<BoxSelectionEventMap> {
|
|
10
|
+
private startPoint?;
|
|
11
|
+
private endPoint?;
|
|
12
|
+
rect: SVGElement;
|
|
13
|
+
frustum: Frustum;
|
|
14
|
+
constructor(context: Context);
|
|
15
|
+
setEnable(enable: boolean): void;
|
|
16
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
17
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
18
|
+
onPointerUp: (e: PointerEvent) => void;
|
|
19
|
+
onUpdate: () => void;
|
|
20
|
+
registryEvent(): void;
|
|
21
|
+
unRegistryEvent(): void;
|
|
22
|
+
doSelect(): void;
|
|
23
|
+
searchMapInFrustum(leftTop: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}, rightBottom: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}): Graphic[];
|
|
30
|
+
searchChildInFrustum(object: Graphic, leftTop: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}, rightBottom: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}): boolean;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './selection';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EventDispatcher } from "three";
|
|
2
|
+
import { Context } from "../../context";
|
|
3
|
+
import { Graphic } from "../../elements";
|
|
4
|
+
interface SelectionEventMap {
|
|
5
|
+
"select": {
|
|
6
|
+
graphics: Graphic[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare class Selection extends EventDispatcher<SelectionEventMap> {
|
|
10
|
+
private context;
|
|
11
|
+
private _list;
|
|
12
|
+
private boxSelection;
|
|
13
|
+
private prevPanStatus?;
|
|
14
|
+
constructor(context: Context);
|
|
15
|
+
get list(): Set<Graphic>;
|
|
16
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
17
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
18
|
+
onKeyUp: (e: KeyboardEvent) => void;
|
|
19
|
+
onBoxSelected: ({ list }: {
|
|
20
|
+
list: Graphic[];
|
|
21
|
+
}) => void;
|
|
22
|
+
selectEnd(): void;
|
|
23
|
+
registryEvent(): void;
|
|
24
|
+
unRegistryEvent(): void;
|
|
25
|
+
dispose(): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -17,3 +17,9 @@ export declare function vector3ToDevice(vector: Vector3, camera: Camera, w: numb
|
|
|
17
17
|
* @param coordinates
|
|
18
18
|
*/
|
|
19
19
|
export declare function getCenter(coordinates: Coordinate[]): import("@turf/turf").Position;
|
|
20
|
+
type Position = {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
export declare function isContain(point: Position, start: Position, end: Position): boolean;
|
|
25
|
+
export {};
|
|
@@ -6,5 +6,5 @@ export declare function initRenderer(): WebGLRenderer;
|
|
|
6
6
|
export declare function initCamera(width: number, height: number): OrthographicCamera;
|
|
7
7
|
export declare function initLight(): Group<import("three").Object3DEventMap>;
|
|
8
8
|
export declare function initControl(camera: OrthographicCamera, domElement: HTMLCanvasElement): MapControls;
|
|
9
|
-
export declare function initShape(path: Coordinate[]): Shape;
|
|
9
|
+
export declare function initShape(path: Coordinate[], holePath?: Coordinate[][]): Shape;
|
|
10
10
|
export declare function initDirectionalLight(color?: number, intensity?: number): DirectionalLight;
|
package/lib/src/utils/svg.d.ts
CHANGED
|
@@ -13,10 +13,17 @@ export declare function createCircle(radius: string | undefined, fill: string):
|
|
|
13
13
|
* @param stroke
|
|
14
14
|
*/
|
|
15
15
|
export declare function createLine(stroke: string): SVGElement;
|
|
16
|
+
/**
|
|
17
|
+
* 创建矩形
|
|
18
|
+
* @param stroke
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function createRect(stroke: string, fill: string): SVGElement;
|
|
16
22
|
export declare function setCirclePosition(circle: SVGElement, x: number, y: number): void;
|
|
17
23
|
type Position = {
|
|
18
24
|
x: number;
|
|
19
25
|
y: number;
|
|
20
26
|
};
|
|
21
27
|
export declare function setLineStartEnd(line: SVGElement, start?: Position, end?: Position): void;
|
|
28
|
+
export declare function setRectPosition(rect: SVGElement, x: number, y: number, w: number, h: number): void;
|
|
22
29
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aibee/crc-bmap",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/bmap.min.js",
|
|
6
6
|
"module": "lib/bmap.esm.min.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"clean": "rm -rf lib",
|
|
17
17
|
"lint": "eslint src/**/*.ts",
|
|
18
18
|
"start": "cd example && vite",
|
|
19
|
-
"publish:all": "npm version patch && npm publish --access public --registry https://registry.npmjs.org && npm publish --registry https://npm.aibee.cn"
|
|
19
|
+
"publish:all": "npm run build && npm version patch && npm publish --access public --registry https://registry.npmjs.org && npm publish --registry https://npm.aibee.cn"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [],
|
|
22
22
|
"author": "",
|