@realsee/dnalogel 2.0.0-alpha.32 → 2.0.0-alpha.34
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/components/index.js +1450 -0
- package/dist/ModelChassisCompassPlugin/index.js +5 -3
- package/dist/PanoSpatialTagPlugin/index.js +13 -11
- package/dist/components/PaintBrush/Controller.d.ts +43 -0
- package/dist/components/PaintBrush/Subscribe.d.ts +76 -0
- package/dist/components/PaintBrush/index.d.ts +27 -0
- package/dist/components/PaintBrush/style.d.ts +2 -0
- package/dist/components/PaintBrush/tween.d.ts +62 -0
- package/dist/components/PaintBrush/typings.d.ts +58 -0
- package/dist/components/PaintBrush/utils.d.ts +26 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/floorplan/ModelFloorplanPlugin/index.js +7 -6
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +7 -6
- package/dist/index.es.js +25 -20
- package/dist/index.js +25 -20
- package/dist/index.umd.js +25 -20
- package/dist/shared-utils/uuid.d.ts +1 -0
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +1 -1
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +9 -9
- package/docs/modules.html +20 -20
- package/libs/ModelChassisCompassPlugin/Plugin.js +5 -3
- package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
- package/libs/PanoSpatialTagPlugin/Plugin.js +4 -2
- package/libs/components/PaintBrush/Controller.d.ts +43 -0
- package/libs/components/PaintBrush/Controller.js +575 -0
- package/libs/components/PaintBrush/Subscribe.d.ts +76 -0
- package/libs/components/PaintBrush/Subscribe.js +121 -0
- package/libs/components/PaintBrush/index.d.ts +27 -0
- package/libs/components/PaintBrush/index.js +57 -0
- package/libs/components/PaintBrush/style.d.ts +2 -0
- package/libs/components/PaintBrush/style.js +102 -0
- package/libs/components/PaintBrush/tween.d.ts +62 -0
- package/libs/components/PaintBrush/tween.js +15 -0
- package/libs/components/PaintBrush/typings.d.ts +58 -0
- package/libs/components/PaintBrush/typings.js +6 -0
- package/libs/components/PaintBrush/utils.d.ts +26 -0
- package/libs/components/PaintBrush/utils.js +51 -0
- package/libs/components/index.d.ts +2 -0
- package/libs/components/index.js +3 -0
- package/libs/floorplan/Components/Compass.js +7 -6
- package/libs/shared-utils/uuid.d.ts +1 -0
- package/libs/shared-utils/uuid.js +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// type UniqueSymbol = ReturnType<(a: string) => { readonly 0: unique symbol }[0]>;
|
|
2
|
+
//
|
|
3
|
+
// function createSymbol(description: string): UniqueSymbol {
|
|
4
|
+
// // TODO 解决提示
|
|
5
|
+
// // @ts-ignore
|
|
6
|
+
// return typeof Symbol === "undefined" ? `$Symbol<${description}>$` : Symbol(description);
|
|
7
|
+
// }
|
|
8
|
+
//
|
|
9
|
+
// const EVENT_SYMBOL = createSymbol("$$LIVE_EVENT$$")
|
|
10
|
+
const EVENT_SYMBOL = Symbol("$$PAINT_BRUSH_EVENT$$");
|
|
11
|
+
function __generateEventIfNotExisted(instance) {
|
|
12
|
+
if (!instance[EVENT_SYMBOL]) {
|
|
13
|
+
instance[EVENT_SYMBOL] = {};
|
|
14
|
+
}
|
|
15
|
+
return instance[EVENT_SYMBOL];
|
|
16
|
+
}
|
|
17
|
+
function __removeEventIfNotExisted(instance) {
|
|
18
|
+
if (!instance[EVENT_SYMBOL]) {
|
|
19
|
+
delete instance[EVENT_SYMBOL];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 监听者模式
|
|
24
|
+
* @template T 预设的监听回调类型
|
|
25
|
+
* @example
|
|
26
|
+
* ```
|
|
27
|
+
* new Subscribe<{
|
|
28
|
+
* "foo": [arg1: number, arg2: string],
|
|
29
|
+
* "bar": [arg: boolean],
|
|
30
|
+
* }>()
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
class Subscribe {
|
|
34
|
+
/**
|
|
35
|
+
* 判断是否注册了事件
|
|
36
|
+
* @param name 事件类型
|
|
37
|
+
*/
|
|
38
|
+
hasListener(name) {
|
|
39
|
+
const events = __generateEventIfNotExisted(this);
|
|
40
|
+
return events && events[name] && events[name].length > 0;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 注册事件
|
|
44
|
+
* @param name 事件类型
|
|
45
|
+
* @param callback 事件回调函数
|
|
46
|
+
* @param once 是否只执行一次
|
|
47
|
+
* @returns 解除事件
|
|
48
|
+
* @template K 预设的监听事件名称
|
|
49
|
+
* @template C 回调函数函数上下文
|
|
50
|
+
*/
|
|
51
|
+
on(name, callback, once) {
|
|
52
|
+
const events = __generateEventIfNotExisted(this);
|
|
53
|
+
if (!events[name])
|
|
54
|
+
events[name] = [];
|
|
55
|
+
events[name].push([callback, once || false]);
|
|
56
|
+
return () => this.off(name, callback);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 注册事件(是否只执行一次)
|
|
60
|
+
* @param name 事件类型
|
|
61
|
+
* @param callback 事件回调函数
|
|
62
|
+
* @returns 解除事件
|
|
63
|
+
* @template K 预设的监听事件名称
|
|
64
|
+
* @template C 回调函数函数上下文
|
|
65
|
+
*/
|
|
66
|
+
once(name, callback) {
|
|
67
|
+
return this.on(name, callback, true);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 解除事件
|
|
71
|
+
*
|
|
72
|
+
* 如果 name 不传的话解除对应所有事件
|
|
73
|
+
* 如果 name, callback 不传的话解除所有name的所有事件
|
|
74
|
+
* @param name 事件类型
|
|
75
|
+
* @param callback 事件回调函数
|
|
76
|
+
* @template K 预设的监听事件名称
|
|
77
|
+
*/
|
|
78
|
+
off(name, callback) {
|
|
79
|
+
if (name === undefined) {
|
|
80
|
+
__removeEventIfNotExisted(this);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const events = __generateEventIfNotExisted(this);
|
|
84
|
+
if (!events[name])
|
|
85
|
+
events[name] = [];
|
|
86
|
+
if (callback === undefined) {
|
|
87
|
+
events[name].length = 0;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
let index = 0;
|
|
91
|
+
for (; index < events[name].length; index++) {
|
|
92
|
+
if (events[name][index][0] === callback)
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (index < events[name].length) {
|
|
96
|
+
events[name].splice(index, 1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 触发事件
|
|
101
|
+
* @param name 事件类型
|
|
102
|
+
* @param data 触发事件的数据
|
|
103
|
+
* @returns canceled 是否被触发取消
|
|
104
|
+
* @template K 预设的监听事件名称
|
|
105
|
+
*/
|
|
106
|
+
emit(name, ...data) {
|
|
107
|
+
let canceled = false;
|
|
108
|
+
const events = __generateEventIfNotExisted(this);
|
|
109
|
+
const event = events[name] || [];
|
|
110
|
+
for (let one of event.slice()) {
|
|
111
|
+
const [callback, once = false] = one;
|
|
112
|
+
const result = callback(...data);
|
|
113
|
+
if (once)
|
|
114
|
+
this.off(name, callback);
|
|
115
|
+
if (result === false)
|
|
116
|
+
canceled = true;
|
|
117
|
+
}
|
|
118
|
+
return canceled;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export { Subscribe };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PaintBrushAction, PaintBrushConfigs, PaintBrushEventMap, PaintBrushState } from './typings';
|
|
2
|
+
export declare class PaintBrush {
|
|
3
|
+
private controller;
|
|
4
|
+
constructor(configs?: Partial<PaintBrushConfigs>);
|
|
5
|
+
on<K extends keyof PaintBrushEventMap>(name: K, callback: (...args: Parameters<PaintBrushEventMap[K]>) => ReturnType<PaintBrushEventMap[K]>): void;
|
|
6
|
+
off<K extends keyof PaintBrushEventMap>(name: K, callback: (...args: Parameters<PaintBrushEventMap[K]>) => ReturnType<PaintBrushEventMap[K]>): void;
|
|
7
|
+
once<K extends keyof PaintBrushEventMap>(name: K, callback: (...args: Parameters<PaintBrushEventMap[K]>) => ReturnType<PaintBrushEventMap[K]>): void;
|
|
8
|
+
/**
|
|
9
|
+
* 显示画笔。
|
|
10
|
+
*/
|
|
11
|
+
show(): void;
|
|
12
|
+
action(action: PaintBrushAction): void;
|
|
13
|
+
/**
|
|
14
|
+
* 获取画笔状态。
|
|
15
|
+
*/
|
|
16
|
+
get state(): Record<string, PaintBrushState[]>;
|
|
17
|
+
get configs(): PaintBrushConfigs;
|
|
18
|
+
/**
|
|
19
|
+
* 销毁。
|
|
20
|
+
*
|
|
21
|
+
* @deprecated
|
|
22
|
+
*
|
|
23
|
+
* @description 画笔应该维护一个 **全局单例**,重复利用。
|
|
24
|
+
*/
|
|
25
|
+
dispose(): void;
|
|
26
|
+
setCurrentColor(color: string): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
|
+
export class PaintBrush {
|
|
3
|
+
constructor(configs = {}) {
|
|
4
|
+
Object.defineProperty(this, "controller", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: void 0
|
|
9
|
+
});
|
|
10
|
+
const _configs = Object.assign({
|
|
11
|
+
currentColor: '#f44336',
|
|
12
|
+
onUndoText: '回退',
|
|
13
|
+
onExitText: '关闭'
|
|
14
|
+
}, configs);
|
|
15
|
+
this.controller = new Controller(_configs);
|
|
16
|
+
}
|
|
17
|
+
on(name, callback) {
|
|
18
|
+
this.controller.on(name, callback);
|
|
19
|
+
}
|
|
20
|
+
off(name, callback) {
|
|
21
|
+
this.controller.off(name, callback);
|
|
22
|
+
}
|
|
23
|
+
once(name, callback) {
|
|
24
|
+
this.controller.once(name, callback);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 显示画笔。
|
|
28
|
+
*/
|
|
29
|
+
show() {
|
|
30
|
+
this.controller.openBrush();
|
|
31
|
+
}
|
|
32
|
+
action(action) {
|
|
33
|
+
this.controller.action(action);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 获取画笔状态。
|
|
37
|
+
*/
|
|
38
|
+
get state() {
|
|
39
|
+
return this.controller.state;
|
|
40
|
+
}
|
|
41
|
+
get configs() {
|
|
42
|
+
return this.controller.configs;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 销毁。
|
|
46
|
+
*
|
|
47
|
+
* @deprecated
|
|
48
|
+
*
|
|
49
|
+
* @description 画笔应该维护一个 **全局单例**,重复利用。
|
|
50
|
+
*/
|
|
51
|
+
dispose() {
|
|
52
|
+
return this.controller.destroyBrush();
|
|
53
|
+
}
|
|
54
|
+
setCurrentColor(color) {
|
|
55
|
+
this.controller.updateCurrentColor(color);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const PaintBrushStyle = "\n<style type=\"text/css\">\n\n#_gl_paintBrush {\nposition: fixed;\ntop: 0;\nbottom: 0;\nleft: 0;\nright: 0;\ntransform: translateZ(0);\nz-index: 1997;\npointer-events: none;\nopacity: 0;\ntransition: all 500ms;\n}\n\n#_gl_paintBrush.brushing {\n opacity: 1;\n}\n\n#_gl_paintBrush ._paintBrush-canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n#_gl_paintBrush ._paintBrush-canvas--sync {\n pointer-events: none;\n z-index: 0;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n#_gl_paintBrush ._paintBrush-canvas {\n pointer-events: none;\n z-index: 1;\n}\n\n#_gl_paintBrush.brushing ._paintBrush-canvas {\n pointer-events: auto;\n}\n\n#_gl_paintBrush ._paintBrush-ctrl {\n width: 140px;\n height: 52px;\n position: absolute;\n bottom: 28px;\n right: 50%;\n transform: translateX(50%);\n font-size: 10px;\n color: white;\n z-index: 2;\n}\n\n#_gl_paintBrush.brushing ._paintBrush-ctrl {\n pointer-events: auto;\n}\n\n#_gl_paintBrush ._paintBrush-ctrl ._paintBrush-ctrlinner {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: 100%;\n border-radius: 26px;\n padding: 8px 16px;\n box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);\n background-image: linear-gradient(180deg, hsl(0deg 0% 0% / 57%), hsl(0deg 0% 0% / 70%) 117%);\n}\n\n._paintBrush-ctrlitem {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 38px;\n height: 38px;\n cursor: pointer;\n}\n\n._paintBrush-ctrlitem--undo >.brush-icon{\n background-image: url(\"//vrlab-static.ljcdn.com/release/web/revoke.ab7694ef.svg\");\n background-size: 100%;\n width: 22px;\n height: 22px;\n}\n\n._paintBrush-ctrlitem--close >.brush-icon {\n background-image: url(\"//vrlab-static.ljcdn.com/release/web/exit_paintbrush.02bc1341.svg\");\n background-size: 100%;\n width: 22px;\n height: 22px;\n}\n\n</style>\n";
|
|
2
|
+
export default PaintBrushStyle;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
const PaintBrushStyle = `
|
|
2
|
+
<style type="text/css">
|
|
3
|
+
|
|
4
|
+
#_gl_paintBrush {
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
left: 0;
|
|
9
|
+
right: 0;
|
|
10
|
+
transform: translateZ(0);
|
|
11
|
+
z-index: 1997;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
transition: all 500ms;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#_gl_paintBrush.brushing {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#_gl_paintBrush ._paintBrush-canvas {
|
|
22
|
+
position: absolute;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
left: 0;
|
|
26
|
+
top: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#_gl_paintBrush ._paintBrush-canvas--sync {
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
z-index: 0;
|
|
32
|
+
position: absolute;
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
left: 0;
|
|
36
|
+
top: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#_gl_paintBrush ._paintBrush-canvas {
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
z-index: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#_gl_paintBrush.brushing ._paintBrush-canvas {
|
|
45
|
+
pointer-events: auto;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#_gl_paintBrush ._paintBrush-ctrl {
|
|
49
|
+
width: 140px;
|
|
50
|
+
height: 52px;
|
|
51
|
+
position: absolute;
|
|
52
|
+
bottom: 28px;
|
|
53
|
+
right: 50%;
|
|
54
|
+
transform: translateX(50%);
|
|
55
|
+
font-size: 10px;
|
|
56
|
+
color: white;
|
|
57
|
+
z-index: 2;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#_gl_paintBrush.brushing ._paintBrush-ctrl {
|
|
61
|
+
pointer-events: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#_gl_paintBrush ._paintBrush-ctrl ._paintBrush-ctrlinner {
|
|
65
|
+
display: flex;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
align-items: center;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
border-radius: 26px;
|
|
71
|
+
padding: 8px 16px;
|
|
72
|
+
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
|
|
73
|
+
background-image: linear-gradient(180deg, hsl(0deg 0% 0% / 57%), hsl(0deg 0% 0% / 70%) 117%);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
._paintBrush-ctrlitem {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
width: 38px;
|
|
82
|
+
height: 38px;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
._paintBrush-ctrlitem--undo >.brush-icon{
|
|
87
|
+
background-image: url("//vrlab-static.ljcdn.com/release/web/revoke.ab7694ef.svg");
|
|
88
|
+
background-size: 100%;
|
|
89
|
+
width: 22px;
|
|
90
|
+
height: 22px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
._paintBrush-ctrlitem--close >.brush-icon {
|
|
94
|
+
background-image: url("//vrlab-static.ljcdn.com/release/web/exit_paintbrush.02bc1341.svg");
|
|
95
|
+
background-size: 100%;
|
|
96
|
+
width: 22px;
|
|
97
|
+
height: 22px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
</style>
|
|
101
|
+
`;
|
|
102
|
+
export default PaintBrushStyle;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Tween } from '@tweenjs/tween.js';
|
|
2
|
+
export declare const Easing: {
|
|
3
|
+
Linear: {
|
|
4
|
+
None: (amount: number) => number;
|
|
5
|
+
};
|
|
6
|
+
Quadratic: {
|
|
7
|
+
In: (amount: number) => number;
|
|
8
|
+
Out: (amount: number) => number;
|
|
9
|
+
InOut: (amount: number) => number;
|
|
10
|
+
};
|
|
11
|
+
Cubic: {
|
|
12
|
+
In: (amount: number) => number;
|
|
13
|
+
Out: (amount: number) => number;
|
|
14
|
+
InOut: (amount: number) => number;
|
|
15
|
+
};
|
|
16
|
+
Quartic: {
|
|
17
|
+
In: (amount: number) => number;
|
|
18
|
+
Out: (amount: number) => number;
|
|
19
|
+
InOut: (amount: number) => number;
|
|
20
|
+
};
|
|
21
|
+
Quintic: {
|
|
22
|
+
In: (amount: number) => number;
|
|
23
|
+
Out: (amount: number) => number;
|
|
24
|
+
InOut: (amount: number) => number;
|
|
25
|
+
};
|
|
26
|
+
Sinusoidal: {
|
|
27
|
+
In: (amount: number) => number;
|
|
28
|
+
Out: (amount: number) => number;
|
|
29
|
+
InOut: (amount: number) => number;
|
|
30
|
+
};
|
|
31
|
+
Exponential: {
|
|
32
|
+
In: (amount: number) => number;
|
|
33
|
+
Out: (amount: number) => number;
|
|
34
|
+
InOut: (amount: number) => number;
|
|
35
|
+
};
|
|
36
|
+
Circular: {
|
|
37
|
+
In: (amount: number) => number;
|
|
38
|
+
Out: (amount: number) => number;
|
|
39
|
+
InOut: (amount: number) => number;
|
|
40
|
+
};
|
|
41
|
+
Elastic: {
|
|
42
|
+
In: (amount: number) => number;
|
|
43
|
+
Out: (amount: number) => number;
|
|
44
|
+
InOut: (amount: number) => number;
|
|
45
|
+
};
|
|
46
|
+
Back: {
|
|
47
|
+
In: (amount: number) => number;
|
|
48
|
+
Out: (amount: number) => number;
|
|
49
|
+
InOut: (amount: number) => number;
|
|
50
|
+
};
|
|
51
|
+
Bounce: {
|
|
52
|
+
In: (amount: number) => number;
|
|
53
|
+
Out: (amount: number) => number;
|
|
54
|
+
InOut: (amount: number) => number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export interface TweenRes extends Tween<any> {
|
|
58
|
+
onDestroy: (fn: () => void) => any;
|
|
59
|
+
destroy: () => any;
|
|
60
|
+
}
|
|
61
|
+
export default function tween(from: any, to: any, duration: number, easing?: (amount: number) => number): TweenRes;
|
|
62
|
+
export declare function tweenProgress(duration: number, easing: (amount: number) => number): TweenRes;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import TWEEN from '@tweenjs/tween.js';
|
|
2
|
+
export const Easing = TWEEN.Easing;
|
|
3
|
+
export default function tween(from, to, duration, easing = Easing.Linear.None) {
|
|
4
|
+
const tweenInstance = new TWEEN.Tween(from).to(to, duration).easing(easing).start();
|
|
5
|
+
function animate(time) {
|
|
6
|
+
if (!tweenInstance.update(time))
|
|
7
|
+
return;
|
|
8
|
+
requestAnimationFrame(animate);
|
|
9
|
+
}
|
|
10
|
+
requestAnimationFrame(animate);
|
|
11
|
+
return tweenInstance;
|
|
12
|
+
}
|
|
13
|
+
export function tweenProgress(duration, easing) {
|
|
14
|
+
return tween({ progress: 0 }, { progress: 1 }, duration, easing);
|
|
15
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface PaintBrushConfigs {
|
|
2
|
+
container?: HTMLDivElement;
|
|
3
|
+
currentColor: string;
|
|
4
|
+
DPR?: number;
|
|
5
|
+
onClickClose?: () => void;
|
|
6
|
+
onClickUndo?: () => void;
|
|
7
|
+
onUndoText?: string;
|
|
8
|
+
onExitText?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare type PaintBrushEventMap = {
|
|
11
|
+
readyChange: (ready: boolean) => void;
|
|
12
|
+
stateChange: (state: PaintBrushAction, userAction: boolean) => void;
|
|
13
|
+
};
|
|
14
|
+
export interface PaintBrushState {
|
|
15
|
+
move: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
line: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}[];
|
|
23
|
+
color: string;
|
|
24
|
+
uuid: string;
|
|
25
|
+
duration: number;
|
|
26
|
+
}
|
|
27
|
+
export declare enum PaintBrushTypeEnum {
|
|
28
|
+
Drawline = "Drawline",
|
|
29
|
+
Undo = "Undo",
|
|
30
|
+
Exit = "Exit"
|
|
31
|
+
}
|
|
32
|
+
export interface PaintBrushAction {
|
|
33
|
+
uuid: string;
|
|
34
|
+
/**
|
|
35
|
+
* 类型枚举
|
|
36
|
+
*/
|
|
37
|
+
type: PaintBrushTypeEnum;
|
|
38
|
+
/**
|
|
39
|
+
* 颜色色值
|
|
40
|
+
*/
|
|
41
|
+
color: string;
|
|
42
|
+
/**
|
|
43
|
+
* 是否就绪
|
|
44
|
+
*/
|
|
45
|
+
ready: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 状态值
|
|
48
|
+
*/
|
|
49
|
+
state?: PaintBrushState;
|
|
50
|
+
/**
|
|
51
|
+
* 时间戳:当作 uuid 使用
|
|
52
|
+
*/
|
|
53
|
+
timestamp?: number;
|
|
54
|
+
/**
|
|
55
|
+
* 是否是结尾数据
|
|
56
|
+
*/
|
|
57
|
+
end?: boolean;
|
|
58
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare function noop(): void;
|
|
2
|
+
export interface Coords {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function queue(promiseCallback?: () => Promise<void>): void;
|
|
7
|
+
export declare function transformCoords(coords: Coords, cw: number, ch: number): {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function unTransformCoords(coords: Coords, cw: number, ch: number): {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function getQuadraticCurvePoint(points: Coords[]): {
|
|
16
|
+
control?: undefined;
|
|
17
|
+
end?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
control: Coords;
|
|
20
|
+
end: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function execInterval(i: number, time: number, callback?: typeof noop): void;
|
|
26
|
+
export declare function nextFrame(fn: FrameRequestCallback, delay?: number): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function noop() { }
|
|
2
|
+
const promise = () => Promise.resolve();
|
|
3
|
+
const state = {
|
|
4
|
+
__queue: Promise.resolve()
|
|
5
|
+
};
|
|
6
|
+
export function queue(promiseCallback = promise) {
|
|
7
|
+
state.__queue = state.__queue.then(promiseCallback).catch(promise);
|
|
8
|
+
}
|
|
9
|
+
export function transformCoords(coords, cw, ch) {
|
|
10
|
+
const _x = coords.x;
|
|
11
|
+
const _y = coords.y;
|
|
12
|
+
const x = Math.floor((_x / cw) * 10000) / 10000; // 保留四位小数
|
|
13
|
+
const y = Math.floor((_y / ch) * 10000) / 10000; // 保留四位小数
|
|
14
|
+
return { x, y };
|
|
15
|
+
}
|
|
16
|
+
export function unTransformCoords(coords, cw, ch) {
|
|
17
|
+
const { x: _x, y: _y } = coords;
|
|
18
|
+
const x = _x * cw;
|
|
19
|
+
const y = _y * ch;
|
|
20
|
+
return { x, y };
|
|
21
|
+
}
|
|
22
|
+
export function getQuadraticCurvePoint(points) {
|
|
23
|
+
if (points.length < 2)
|
|
24
|
+
return {};
|
|
25
|
+
const lastTwo = points.slice(-2);
|
|
26
|
+
const control = lastTwo[0];
|
|
27
|
+
const end = {
|
|
28
|
+
x: (lastTwo[0].x + lastTwo[1].x) / 2,
|
|
29
|
+
y: (lastTwo[0].y + lastTwo[1].y) / 2,
|
|
30
|
+
};
|
|
31
|
+
return { control, end };
|
|
32
|
+
}
|
|
33
|
+
export function execInterval(i, time, callback = noop) {
|
|
34
|
+
new Promise((resolve) => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
callback();
|
|
37
|
+
resolve(true);
|
|
38
|
+
}, time * i);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const _window = window;
|
|
42
|
+
const _requestAnimationFrame = window.requestAnimationFrame ||
|
|
43
|
+
_window.webkitRequestAnimationFrame ||
|
|
44
|
+
(fn => setTimeout(fn, 16));
|
|
45
|
+
const _cancelAnimationFrame = window.cancelAnimationFrame || _window.webkitCancelAnimationFrame || clearTimeout;
|
|
46
|
+
export function nextFrame(fn, delay = 0) {
|
|
47
|
+
if (delay <= 0)
|
|
48
|
+
_requestAnimationFrame(fn);
|
|
49
|
+
else
|
|
50
|
+
_requestAnimationFrame(() => nextFrame(fn, delay - 1));
|
|
51
|
+
}
|
|
@@ -23,7 +23,7 @@ function add_css(target) {
|
|
|
23
23
|
append_styles(target, "svelte-5l80pv", ".floorplan-plugin__compass.svelte-5l80pv{position:absolute;left:50%;top:-46px;width:231px;height:41px;will-change:opacity;transform-origin:center 184px}.floorplan-plugin__compass-image.svelte-5l80pv{width:100%;height:100%;position:absolute;left:0;top:0;opacity:0.1;background-repeat:no-repeat;background-size:100% 100%}.floorplan-plugin__compass-text.svelte-5l80pv{position:absolute;left:50%;top:15px;transform:translateX(-50%);opacity:0.2;font-weight:bold;font-size:10px;color:#fff}");
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
// (
|
|
26
|
+
// (14:0) {#if canShowCompass}
|
|
27
27
|
function create_if_block(ctx) {
|
|
28
28
|
let div1;
|
|
29
29
|
let div0;
|
|
@@ -42,7 +42,7 @@ function create_if_block(ctx) {
|
|
|
42
42
|
set_style(div0, "background-image", `url(${COMPASS_IMAGE})`);
|
|
43
43
|
attr(span, "class", "floorplan-plugin__compass-text svelte-5l80pv");
|
|
44
44
|
attr(div1, "class", "floorplan-plugin__compass svelte-5l80pv");
|
|
45
|
-
set_style(div1, "transform", /*compassTransformStyle*/ ctx[
|
|
45
|
+
set_style(div1, "transform", /*compassTransformStyle*/ ctx[1], false);
|
|
46
46
|
},
|
|
47
47
|
m(target, anchor) {
|
|
48
48
|
insert(target, div1, anchor);
|
|
@@ -62,7 +62,7 @@ function create_if_block(ctx) {
|
|
|
62
62
|
|
|
63
63
|
function create_fragment(ctx) {
|
|
64
64
|
let if_block_anchor;
|
|
65
|
-
let if_block = /*
|
|
65
|
+
let if_block = /*canShowCompass*/ ctx[2] && create_if_block(ctx);
|
|
66
66
|
|
|
67
67
|
return {
|
|
68
68
|
c() {
|
|
@@ -74,7 +74,7 @@ function create_fragment(ctx) {
|
|
|
74
74
|
insert(target, if_block_anchor, anchor);
|
|
75
75
|
},
|
|
76
76
|
p(ctx, [dirty]) {
|
|
77
|
-
if (/*
|
|
77
|
+
if (/*canShowCompass*/ ctx[2]) if_block.p(ctx, dirty);
|
|
78
78
|
},
|
|
79
79
|
i: noop,
|
|
80
80
|
o: noop,
|
|
@@ -98,15 +98,16 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
98
98
|
? void 0
|
|
99
99
|
: _a.northRad;
|
|
100
100
|
|
|
101
|
-
const rotate =
|
|
101
|
+
const rotate = typeof northRad !== 'number' ? 0 : rad2Deg(northRad);
|
|
102
102
|
const compassTransformStyle = `translateX(-50%) translateZ(10px) rotate(${-rotate + 90}deg)`;
|
|
103
|
+
const canShowCompass = typeof northRad === 'number';
|
|
103
104
|
|
|
104
105
|
$$self.$$set = $$props => {
|
|
105
106
|
if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
|
|
106
107
|
if ('northDesc' in $$props) $$invalidate(0, northDesc = $$props.northDesc);
|
|
107
108
|
};
|
|
108
109
|
|
|
109
|
-
return [northDesc,
|
|
110
|
+
return [northDesc, compassTransformStyle, canShowCompass, floorplanData];
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
class Component extends SvelteComponent {
|
package/package.json
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
"repository": "https://github.com/realsee-developer/dnalogel.git",
|
|
9
9
|
"description": "如视 VR 看房插件合集",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "2.0.0-alpha.
|
|
11
|
+
"version": "2.0.0-alpha.34",
|
|
12
12
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "yarn run tsb && yarn run build:rollup && yarn build:docs",
|
|
14
|
+
"build": "yarn run tsb && yarn run build:rollup && yarn run build:components && yarn build:docs",
|
|
15
15
|
"build:dev": "yarn build:svelte && tsc --watch",
|
|
16
16
|
"build:rollup": " rollup --config rollup.config.js",
|
|
17
|
+
"build:components": "vite build",
|
|
17
18
|
"tsb": "tsc && yarn build:svelte && ./bin/svelte-compile.js",
|
|
18
19
|
"build:svelte": "svelte-strip strip src/ libs -m=false",
|
|
19
20
|
"build:docs": "typedoc --options ./typedoc.json",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"files": [
|
|
24
25
|
"libs",
|
|
25
26
|
"dist",
|
|
27
|
+
"components",
|
|
26
28
|
"docs",
|
|
27
29
|
"TERMS.txt"
|
|
28
30
|
],
|