@realsee/five 6.0.0-alpha.73 → 6.0.0-alpha.75
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/docs/assets/search.js +1 -1
- package/docs/classes/five.Model.html +2 -2
- package/docs/classes/five.Work.html +13 -13
- package/docs/functions/five.parseWork.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +3 -4
- package/docs/types/five.ModelMaterialValues.html +1 -1
- package/docs/types/five.Models.html +4 -4
- package/docs/types/five.ParseWorkOptions.html +2 -2
- package/docs/types/five.Works.html +1 -1
- package/docs/variables/five.defaultPbmParameters.html +1 -1
- package/five/index.d.ts +6 -1
- package/five/index.js +71 -71
- package/five/index.mjs +1377 -1394
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +3 -9
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/scripts/five-staticify.js +183 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-react.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +7 -7
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/exporters/staticify.js +0 -210
- package/scripts/five-plugin-init.js +0 -83
- package/scripts/five-quick-start-init.js +0 -80
- package/scripts/five-react-component-init.js +0 -83
- package/templates/plugin/README.md +0 -38
- package/templates/plugin/devtools/external-five.js +0 -5
- package/templates/plugin/devtools/external-three.js +0 -5
- package/templates/plugin/devtools/tsconfig.build.json +0 -18
- package/templates/plugin/devtools/webpack.bundle.js +0 -44
- package/templates/plugin/devtools/webpack.example.js +0 -39
- package/templates/plugin/docs/.gitkeep +0 -0
- package/templates/plugin/examples/data.json +0 -507
- package/templates/plugin/examples/index.html +0 -28
- package/templates/plugin/examples/index.ts +0 -12
- package/templates/plugin/lib/index.ts +0 -30
- package/templates/plugin/package.json +0 -32
- package/templates/plugin/tsconfig.json +0 -26
- package/templates/quick-start/README.md +0 -47
- package/templates/quick-start/assets/work.json +0 -507
- package/templates/quick-start/index.html +0 -54
- package/templates/quick-start/index.tsx +0 -123
- package/templates/quick-start/package.json +0 -25
- package/templates/quick-start/tsconfig.json +0 -27
- package/templates/quick-start/webpack.config.js +0 -45
- package/templates/quick-start/webpack.production.js +0 -42
- package/templates/react-component/README.md +0 -32
- package/templates/react-component/devtools/external-five.js +0 -5
- package/templates/react-component/devtools/external-react.js +0 -5
- package/templates/react-component/devtools/external-three.js +0 -5
- package/templates/react-component/devtools/tsconfig.build.json +0 -19
- package/templates/react-component/devtools/webpack.bundle.js +0 -44
- package/templates/react-component/devtools/webpack.example.js +0 -39
- package/templates/react-component/docs/.gitkeep +0 -0
- package/templates/react-component/examples/data.json +0 -507
- package/templates/react-component/examples/index.html +0 -17
- package/templates/react-component/examples/index.tsx +0 -62
- package/templates/react-component/lib/index.tsx +0 -157
- package/templates/react-component/package.json +0 -38
- package/templates/react-component/tsconfig.json +0 -27
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
|
|
3
|
-
import * as THREE from "three";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import { Five } from "@realsee/five";
|
|
6
|
-
import { useFiveState, useFiveEventCallback, useFiveProject2d } from "@realsee/five/react";
|
|
7
|
-
|
|
8
|
-
const TAG_DEFAULT_LABEL = "未命名";
|
|
9
|
-
|
|
10
|
-
const styles: Record<string, React.CSSProperties> = {
|
|
11
|
-
"tag-container": {
|
|
12
|
-
position: "relative",
|
|
13
|
-
pointerEvents: "none",
|
|
14
|
-
overflow: "hidden",
|
|
15
|
-
},
|
|
16
|
-
"tag": {
|
|
17
|
-
pointerEvents: "auto",
|
|
18
|
-
position: "absolute",
|
|
19
|
-
width: 0,
|
|
20
|
-
height: 0,
|
|
21
|
-
transform: "translateZ(0)",
|
|
22
|
-
},
|
|
23
|
-
"tag-pannel": {
|
|
24
|
-
position: "absolute",
|
|
25
|
-
width: 100,
|
|
26
|
-
minHeight: 20,
|
|
27
|
-
transform: "translate(-50%, 0)",
|
|
28
|
-
left: "50%",
|
|
29
|
-
bottom: 10,
|
|
30
|
-
background: "#333",
|
|
31
|
-
color: "#fff",
|
|
32
|
-
borderRadius: 2,
|
|
33
|
-
textAlign: "center",
|
|
34
|
-
lineHeight: "20px",
|
|
35
|
-
padding: 8,
|
|
36
|
-
fontSize: 14,
|
|
37
|
-
},
|
|
38
|
-
"tag-tools": {
|
|
39
|
-
position: "absolute",
|
|
40
|
-
height: 16,
|
|
41
|
-
top: -10,
|
|
42
|
-
right: -7,
|
|
43
|
-
background: "#07a",
|
|
44
|
-
color: "#fff",
|
|
45
|
-
borderRadius: 7,
|
|
46
|
-
textAlign: "center",
|
|
47
|
-
lineHeight: "16px",
|
|
48
|
-
whiteSpace: "nowrap",
|
|
49
|
-
padding: "0 3px"
|
|
50
|
-
},
|
|
51
|
-
"tag-tool-button": {
|
|
52
|
-
border: "none",
|
|
53
|
-
cursor: "pointer",
|
|
54
|
-
background: "transparent",
|
|
55
|
-
color: "inherit",
|
|
56
|
-
fontSize: 12,
|
|
57
|
-
height: 16,
|
|
58
|
-
verticalAlign: "top",
|
|
59
|
-
},
|
|
60
|
-
"tag-arrow": {
|
|
61
|
-
position: "absolute",
|
|
62
|
-
width: 10,
|
|
63
|
-
height: 10,
|
|
64
|
-
left: "50%",
|
|
65
|
-
bottom: -5,
|
|
66
|
-
transform: "translate(-50%, 0) rotate(45deg)",
|
|
67
|
-
background: "#333",
|
|
68
|
-
pointerEvents: "none",
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
type Tag = {
|
|
73
|
-
position: THREE.Vector3,
|
|
74
|
-
label: string,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
type PropTyps = {
|
|
78
|
-
width: number,
|
|
79
|
-
height: number,
|
|
80
|
-
initialTags: Tag[],
|
|
81
|
-
onChange(tags: Tag[]): void
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const FiveTagComponent: React.FC<PropTyps> = (props) => {
|
|
85
|
-
const project2d = useFiveProject2d();
|
|
86
|
-
const [{ mode }] = useFiveState();
|
|
87
|
-
const testModel = mode === Five.Mode.Panorama || mode === Five.Mode.Model;
|
|
88
|
-
|
|
89
|
-
const [newTag, setNewTag] = React.useState<Tag | null>(null);
|
|
90
|
-
const [tags, setTags] = React.useState<Tag[]>(() => props.initialTags);
|
|
91
|
-
|
|
92
|
-
const removeTag = React.useCallback((index: number) => {
|
|
93
|
-
const newTags = tags.filter((_tag, index_) => index !== index_);
|
|
94
|
-
setTags(newTags);
|
|
95
|
-
props.onChange(newTags);
|
|
96
|
-
}, [tags]);
|
|
97
|
-
|
|
98
|
-
const editTag = React.useCallback((index: number) => {
|
|
99
|
-
const newLabel = window.prompt("修改标签名称", tags[index].label) || TAG_DEFAULT_LABEL;
|
|
100
|
-
const newTags = tags.map((tag, index_) => {
|
|
101
|
-
if (index_ === index) return { ...tag, label: newLabel };
|
|
102
|
-
return tag;
|
|
103
|
-
});
|
|
104
|
-
setTags(newTags);
|
|
105
|
-
props.onChange(newTags);
|
|
106
|
-
}, [tags]);
|
|
107
|
-
|
|
108
|
-
const addTag = React.useCallback(() => {
|
|
109
|
-
setNewTag({ position: new THREE.Vector3(), label: TAG_DEFAULT_LABEL });
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
112
|
-
useFiveEventCallback("intersectionOnModelUpdate", (intersect) => {
|
|
113
|
-
if (newTag === null) return;
|
|
114
|
-
setNewTag({ ...newTag, position: intersect.point });
|
|
115
|
-
}, [newTag]);
|
|
116
|
-
|
|
117
|
-
useFiveEventCallback("wantsTapGesture", () => {
|
|
118
|
-
if (newTag !== null) {
|
|
119
|
-
const newTags = tags.concat(newTag)
|
|
120
|
-
setTags(newTags);
|
|
121
|
-
props.onChange(newTags);
|
|
122
|
-
setNewTag(null);
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
}, [tags, newTag]);
|
|
126
|
-
|
|
127
|
-
return <div style={{ ...styles["tag-container"], width: props.width, height: props.height }}>
|
|
128
|
-
<button style={{ position: "absolute", right: 0, bottom: 0, pointerEvents: "auto" }} onClick={() => addTag()}>添加标签</button>
|
|
129
|
-
{newTag && (() => {
|
|
130
|
-
const position = project2d(newTag.position, false);
|
|
131
|
-
if (position === null) return;
|
|
132
|
-
return <div style={{ ...styles["tag"], pointerEvents: "none", left: position.x, top: position.y }}>
|
|
133
|
-
<div style={{ ...styles["tag-pannel"] }}>
|
|
134
|
-
<span style={{ ...styles["tag-content"] }}>{newTag.label}</span>
|
|
135
|
-
<div style={{ ...styles["tag-arrow"] }}/>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
})()}
|
|
139
|
-
{tags.map((tag, index) => {
|
|
140
|
-
const position = project2d(tag.position, testModel);
|
|
141
|
-
if (position === null) return;
|
|
142
|
-
return <div key={index} style={{ ...styles["tag"], left: position.x, top: position.y }}>
|
|
143
|
-
<div style={{ ...styles["tag-pannel"] }}>
|
|
144
|
-
<span style={{ ...styles["tag-content"] }}>{tag.label}</span>
|
|
145
|
-
<div style={{ ...styles["tag-tools"] }}>
|
|
146
|
-
<button style={{ ...styles["tag-tool-button"] }} onClick={() => editTag(index)}>编辑</button>
|
|
147
|
-
<span> | </span>
|
|
148
|
-
<button style={{ ...styles["tag-tool-button"] }} onClick={() => removeTag(index)}>删除</button>
|
|
149
|
-
</div>
|
|
150
|
-
<div style={{ ...styles["tag-arrow"] }}/>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
}).filter(element => element !== undefined)}
|
|
154
|
-
</div>
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export { FiveTagComponent, Tag };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "a-five-react-component",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "a-five-react-component",
|
|
5
|
-
"main": "./build/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"example": "concurrently --names \"http,webpack\" --kill-others \"http-server ./ -p 8080 -c-1 --cors\" \"webpack -w --config ./devtools/webpack.example.js\"",
|
|
8
|
-
"build:example": "webpack --config ./devtools/webpack.example.js",
|
|
9
|
-
"build:doc": "typedoc --hideGenerator --includeVersion --excludeExternals --tsconfig ./devtools/tsconfig.build.json --out ./docs ./lib/index.tsx",
|
|
10
|
-
"build:typescript": "del ./build && tsc --project ./devtools/tsconfig.build.json",
|
|
11
|
-
"build:bundle": "webpack --progress --config ./devtools/webpack.bundle.js",
|
|
12
|
-
"build:all": "npm run build:doc && npm run build:typescript && && npm run build:example && npm run build:bundle"
|
|
13
|
-
},
|
|
14
|
-
"author": "realsee.com",
|
|
15
|
-
"license": "ISC",
|
|
16
|
-
"peerDependencies": {
|
|
17
|
-
"@types/react": "^17.0.14",
|
|
18
|
-
"react": "^17.0.2",
|
|
19
|
-
"three": "^0.117.1",
|
|
20
|
-
"typescript": "^4.3.2"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/react": "^17.0.14",
|
|
24
|
-
"@types/react-dom": "^17.0.9",
|
|
25
|
-
"concurrently": "^6.2.0",
|
|
26
|
-
"del-cli": "^4.0.1",
|
|
27
|
-
"glob": "^7.1.6",
|
|
28
|
-
"http-server": "^0.12.1",
|
|
29
|
-
"react": "^17.0.2",
|
|
30
|
-
"react-dom": "^17.0.2",
|
|
31
|
-
"three": "^0.117.1",
|
|
32
|
-
"ts-loader": "^9.1.1",
|
|
33
|
-
"typedoc": "^0.20.36",
|
|
34
|
-
"typescript": "^4.2.4",
|
|
35
|
-
"webpack": "^5.35.1",
|
|
36
|
-
"webpack-cli": "^4.6.0"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Basic Options */
|
|
4
|
-
"jsx": "react",
|
|
5
|
-
"target": "ES5",
|
|
6
|
-
"lib": ["ES5", "DOM"],
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"rootDir": "./",
|
|
10
|
-
|
|
11
|
-
/* Strict Type-Checking Options */
|
|
12
|
-
"strict": true,
|
|
13
|
-
"noImplicitAny": true,
|
|
14
|
-
"strictNullChecks": true,
|
|
15
|
-
"declarationMap": false,
|
|
16
|
-
|
|
17
|
-
/* Module Resolution Options */
|
|
18
|
-
"moduleResolution": "node",
|
|
19
|
-
"baseUrl": "./",
|
|
20
|
-
"esModuleInterop": true,
|
|
21
|
-
"preserveSymlinks": true,
|
|
22
|
-
|
|
23
|
-
/* Experimental Options */
|
|
24
|
-
"experimentalDecorators": true,
|
|
25
|
-
"emitDecoratorMetadata": true
|
|
26
|
-
}
|
|
27
|
-
}
|