@operato/scene-urdf 7.0.1 → 7.3.19
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/package.json +3 -3
- package/CHANGELOG.md +0 -343
- package/demo/index.html +0 -109
- package/src/editors/index.ts +0 -0
- package/src/elements/drag-n-drop.ts +0 -142
- package/src/elements/urdf-controller-element.ts +0 -297
- package/src/elements/urdf-drag-controls.ts +0 -248
- package/src/elements/urdf-manipulator-element.ts +0 -133
- package/src/elements/urdf-viewer-element.ts +0 -496
- package/src/index.ts +0 -2
- package/src/templates/index.ts +0 -4
- package/src/templates/urdf-controller.ts +0 -16
- package/src/templates/urdf-viewer.ts +0 -16
- package/src/urdf-controller.ts +0 -82
- package/src/urdf-viewer.ts +0 -249
- package/tsconfig.json +0 -24
- package/tsconfig.tsbuildinfo +0 -1
- package/web-dev-server.config.mjs +0 -27
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/scene-urdf",
|
|
3
3
|
"description": "Scene module for manipulating robot simulation through URDF format",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "7.
|
|
5
|
+
"version": "7.3.19",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"migration": "things-factory-migration"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hatiolab/things-scene": "^3.
|
|
30
|
+
"@hatiolab/things-scene": "^3.4.0",
|
|
31
31
|
"@operato/styles": "^7.0.0",
|
|
32
32
|
"lit": "^3.1.2",
|
|
33
33
|
"three": "^0.164.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"prettier --write"
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ff73072a62ee02520f9d986d0095f6d329de64f9"
|
|
68
68
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [7.0.1](https://github.com/things-scene/operato-scene/compare/v7.0.0...v7.0.1) (2024-06-30)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### :bug: Bug Fix
|
|
10
|
-
|
|
11
|
-
* things-factory@7.0.0 ([f4cfe44](https://github.com/things-scene/operato-scene/commit/f4cfe44cb565e7b8fdc0df210a722b6526871848))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## [7.0.0](https://github.com/things-scene/operato-scene/compare/v7.0.0-rc.4...v7.0.0) (2024-06-30)
|
|
16
|
-
|
|
17
|
-
**Note:** Version bump only for package @operato/scene-urdf
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## [7.0.0-rc.4](https://github.com/things-scene/operato-scene/compare/v7.0.0-rc.3...v7.0.0-rc.4) (2024-06-30)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### :bug: Bug Fix
|
|
27
|
-
|
|
28
|
-
* operato@7.0.0 ([9740f89](https://github.com/things-scene/operato-scene/commit/9740f8949654b9dd9388558059e89cbed3d8235a))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## [7.0.0-rc.1](https://github.com/things-scene/operato-scene/compare/v7.0.0-rc.0...v7.0.0-rc.1) (2024-06-21)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### :bug: Bug Fix
|
|
36
|
-
|
|
37
|
-
* apply v7-rc dependencies ([eee5612](https://github.com/things-scene/operato-scene/commit/eee5612e1d569387c284a7c6c49d64ef44b6d701))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## [7.0.0-rc.0](https://github.com/things-scene/operato-scene/compare/v2.0.0-beta.8...v7.0.0-rc.0) (2024-06-21)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### :bug: Bug Fix
|
|
45
|
-
|
|
46
|
-
* apply operato@7.0.0-rc ([7d5fa6e](https://github.com/things-scene/operato-scene/commit/7d5fa6e9bef5f6d2231e4d1eface82578fe794f3))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## [2.0.0-beta.0](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.12...v2.0.0-beta.0) (2024-06-01)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### :rocket: New Features
|
|
54
|
-
|
|
55
|
-
* 2.0.0-beta.0 ([a2e2869](https://github.com/things-scene/operato-scene/commit/a2e28694eedf5bab0c54bcab5432d54ec59edd7f))
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### :bug: Bug Fix
|
|
59
|
-
|
|
60
|
-
* allowJs in tsconfig option ([fa77174](https://github.com/things-scene/operato-scene/commit/fa771742188f21f177f0a85281570f59f0c478cf))
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## [2.0.0-alpha.12](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.11...v2.0.0-alpha.12) (2024-05-11)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### :bug: Bug Fix
|
|
68
|
-
|
|
69
|
-
* ignore 'cache' folder for git and npm ([d70f811](https://github.com/things-scene/operato-scene/commit/d70f8118ff3e9248f80aa9435d6e6cbb8aacfcaf))
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## [2.0.0-alpha.9](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2024-04-11)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### :bug: Bug Fix
|
|
77
|
-
|
|
78
|
-
* things-factory@7.0.1 ([a9f4c18](https://github.com/things-scene/operato-scene/commit/a9f4c1873b80c540e4c2e16649e127ccffcf9a4c))
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## [2.0.0-alpha.8](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2024-03-29)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### :bug: Bug Fix
|
|
86
|
-
|
|
87
|
-
* upgrade lit ([87e6494](https://github.com/things-scene/operato-scene/commit/87e6494e02a74ec768d0695089aea36184afe572))
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
## [2.0.0-alpha.6](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2024-03-24)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### :bug: Bug Fix
|
|
95
|
-
|
|
96
|
-
* translation ([266d423](https://github.com/things-scene/operato-scene/commit/266d423d9d6992464f45a437acc90ccf8ed33bf6))
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
## [2.0.0-alpha.4](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2024-03-21)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### :bug: Bug Fix
|
|
104
|
-
|
|
105
|
-
* 컴포넌트 명 다국어 ([64e1f08](https://github.com/things-scene/operato-scene/commit/64e1f08af32d2ac193c3d31b0025f8d06f569ca4))
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
## [2.0.0-alpha.3](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-04)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### :bug: Bug Fix
|
|
113
|
-
|
|
114
|
-
* upgrade three.js ([4319dab](https://github.com/things-scene/operato-scene/commit/4319dabec8a0ae04577ca401db333d9b3303df4f))
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## [2.0.0-alpha.1](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.0...v2.0.0-alpha.1) (2024-02-04)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
### :bug: Bug Fix
|
|
122
|
-
|
|
123
|
-
* upgrade three@161 ([b41788e](https://github.com/things-scene/operato-scene/commit/b41788e7dbe0321c2c8b4dc98126ebc7f97d8285))
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
## [2.0.0-alpha.0](https://github.com/things-scene/operato-scene/compare/v1.3.9...v2.0.0-alpha.0) (2024-01-14)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### :bug: Bug Fix
|
|
131
|
-
|
|
132
|
-
* 2.0.0-alpha.0 ([93274e3](https://github.com/things-scene/operato-scene/commit/93274e36c5d184f339f83899654dd48b4786ac2b))
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
## [1.3.8](https://github.com/things-scene/operato-scene/compare/v1.3.7...v1.3.8) (2024-01-01)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
### :bug: Bug Fix
|
|
140
|
-
|
|
141
|
-
* upgrade three ([6f0e8f4](https://github.com/things-scene/operato-scene/commit/6f0e8f4faa1f30640468da0755502e8b9a999d0c))
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
## [1.3.7](https://github.com/things-scene/operato-scene/compare/v1.3.6...v1.3.7) (2024-01-01)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
### :bug: Bug Fix
|
|
149
|
-
|
|
150
|
-
* mpi module moved from things-factory ([47b743f](https://github.com/things-scene/operato-scene/commit/47b743fd19001f195db85e50b8f6e457a1573aa5))
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
## [1.3.2](https://github.com/things-scene/operato-scene/compare/v1.3.1...v1.3.2) (2023-12-01)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
### :bug: Bug Fix
|
|
158
|
-
|
|
159
|
-
* upgrade theejs ([55f49c2](https://github.com/things-scene/operato-scene/commit/55f49c23fbaf17c79130b63868e12a685e8039e2))
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
## [1.2.90](https://github.com/things-scene/operato-scene/compare/v1.2.89...v1.2.90) (2023-11-22)
|
|
164
|
-
|
|
165
|
-
**Note:** Version bump only for package @operato/scene-urdf
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
## [1.2.88](https://github.com/things-scene/operato-scene/compare/v1.2.87...v1.2.88) (2023-11-12)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
### :bug: Bug Fix
|
|
175
|
-
|
|
176
|
-
* three@0.158.0 ([8f56203](https://github.com/things-scene/operato-scene/commit/8f5620347e290c53dffc43319e08d77ab66b7caa))
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
## [1.2.87](https://github.com/things-scene/operato-scene/compare/v1.2.86...v1.2.87) (2023-11-10)
|
|
181
|
-
|
|
182
|
-
**Note:** Version bump only for package @operato/scene-urdf
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
## [1.2.76](https://github.com/things-scene/operato-scene/compare/v1.2.75...v1.2.76) (2023-10-28)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
### :bug: Bug Fix
|
|
192
|
-
|
|
193
|
-
* scene-tab ([ad62f96](https://github.com/things-scene/operato-scene/commit/ad62f967b149eb5adf8f2e0714d79e8a9dc7186c))
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
## [1.2.70](https://github.com/things-scene/operato-scene/compare/v1.2.69...v1.2.70) (2023-10-06)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
### :bug: Bug Fix
|
|
201
|
-
|
|
202
|
-
* upgrade three@0.157.0 ([cb6eaf5](https://github.com/things-scene/operato-scene/commit/cb6eaf519d10ba60b0d9aa3ea4aa46e684e3acc2))
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
## [1.2.66](https://github.com/things-scene/operato-scene/compare/v1.2.65...v1.2.66) (2023-09-14)
|
|
207
|
-
|
|
208
|
-
**Note:** Version bump only for package @operato/scene-urdf
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
## [1.2.65](https://github.com/things-scene/operato-scene/compare/v1.2.64...v1.2.65) (2023-09-14)
|
|
215
|
-
|
|
216
|
-
**Note:** Version bump only for package @operato/scene-urdf
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
## [1.2.62](https://github.com/things-scene/operato-scene/compare/v1.2.61...v1.2.62) (2023-09-11)
|
|
223
|
-
|
|
224
|
-
**Note:** Version bump only for package @operato/scene-urdf
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
## [1.2.57](https://github.com/things-scene/operato-scene/compare/v1.2.56...v1.2.57) (2023-09-05)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
### :bug: Bug Fix
|
|
234
|
-
|
|
235
|
-
* revoke three version to 0.152.2 ([cabdaba](https://github.com/things-scene/operato-scene/commit/cabdaba60abd28de261dfbcd1c483793d157bcc3))
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
## [1.2.56](https://github.com/things-scene/operato-scene/compare/v1.2.55...v1.2.56) (2023-09-05)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
### :bug: Bug Fix
|
|
243
|
-
|
|
244
|
-
* upgrade three.js ([e74e5e6](https://github.com/things-scene/operato-scene/commit/e74e5e69910aadcd59f49fcf1f56aec0e8529d48))
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
## [1.2.46](https://github.com/things-scene/operato-scene/compare/v1.2.45...v1.2.46) (2023-06-10)
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
### :bug: Bug Fix
|
|
252
|
-
|
|
253
|
-
* typescript build options ([3eb0d7f](https://github.com/things-scene/operato-scene/commit/3eb0d7fd80e2c3cea698501aa1d9d54903423a7b))
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
## [1.2.39](https://github.com/things-scene/operato-scene/compare/v1.2.38...v1.2.39) (2023-05-25)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
### :bug: Bug Fix
|
|
261
|
-
|
|
262
|
-
* add light component into 3d module ([110b312](https://github.com/things-scene/operato-scene/commit/110b3121a0ee6e65bd1cbcffb8254e16c0592460))
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
## [1.2.36](https://github.com/things-scene/operato-scene/compare/v1.2.35...v1.2.36) (2023-05-13)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
### :bug: Bug Fix
|
|
270
|
-
|
|
271
|
-
* license ([d37d485](https://github.com/things-scene/operato-scene/commit/d37d48597407dea1ad022e674f2899720e56d695))
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
## [1.2.30](https://github.com/things-scene/operato-scene/compare/v1.2.29...v1.2.30) (2023-04-30)
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
### :bug: Bug Fix
|
|
279
|
-
|
|
280
|
-
* improve performance for visualizer ([d57aa3d](https://github.com/things-scene/operato-scene/commit/d57aa3da34e9539b8d7db89c195af1e2d789e37d))
|
|
281
|
-
* update dependencies ([59357a0](https://github.com/things-scene/operato-scene/commit/59357a04eb0211f51db84cb37b0fda0d53c4ec41))
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
## [1.2.29](https://github.com/things-scene/operato-scene/compare/v1.2.28...v1.2.29) (2023-04-30)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
### :bug: Bug Fix
|
|
289
|
-
|
|
290
|
-
* update module's version ([047d08b](https://github.com/things-scene/operato-scene/commit/047d08b5d912d12c04b2f6b63156d1e812588365))
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
### [1.2.27](https://github.com/things-scene/operato-scene/compare/v1.2.26...v1.2.27) (2023-04-22)
|
|
295
|
-
|
|
296
|
-
**Note:** Version bump only for package @operato/scene-urdf
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
### [1.2.24](https://github.com/things-scene/operato-scene/compare/v1.2.23...v1.2.24) (2023-04-08)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
### :bug: Bug Fix
|
|
306
|
-
|
|
307
|
-
* latest three@0.151.3 ([4dfb5f3](https://github.com/things-scene/operato-scene/commit/4dfb5f384b8d299ac56a1237dec21039528f4523))
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
### [1.2.11](https://github.com/things-scene/operato-scene/compare/v1.2.10...v1.2.11) (2023-03-03)
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
### :bug: Bug Fix
|
|
315
|
-
|
|
316
|
-
* merge Object3D => RealObject ([201886b](https://github.com/things-scene/operato-scene/commit/201886b135064c1625d5f02a1e85221822d7e449))
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
### [1.2.4](https://github.com/things-scene/operato-scene/compare/v1.2.3...v1.2.4) (2023-02-13)
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
### :bug: Bug Fix
|
|
324
|
-
|
|
325
|
-
* [#5](https://github.com/things-scene/operato-scene/issues/5) done ([8de018c](https://github.com/things-scene/operato-scene/commit/8de018c61c3195a557ba69121a4255865dfa2345))
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
### [1.2.3](https://github.com/things-scene/operato-scene/compare/v1.2.2...v1.2.3) (2023-02-09)
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
### :bug: Bug Fix
|
|
333
|
-
|
|
334
|
-
* add robot-arm assets for scene-urdf ([a63ce4c](https://github.com/things-scene/operato-scene/commit/a63ce4cc0ecbe6b05ecf94ff6afd82378d04d163))
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
### [1.2.2](https://github.com/things-scene/operato-scene/compare/v1.2.1...v1.2.2) (2023-02-09)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
### :bug: Bug Fix
|
|
342
|
-
|
|
343
|
-
* migrate scene-urdf from things-factory ([3f75f87](https://github.com/things-scene/operato-scene/commit/3f75f8743e993a9a3ed595eed8f94b15da042a31))
|
package/demo/index.html
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" />
|
|
6
|
-
<style>
|
|
7
|
-
body {
|
|
8
|
-
margin: 0;
|
|
9
|
-
padding: 0;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
|
|
12
|
-
/* This is a font-stack that tries to use the system-default sans-serifs first */
|
|
13
|
-
font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
14
|
-
line-height: 1.5;
|
|
15
|
-
-webkit-font-smoothing: antialiased;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
ox-board-viewer {
|
|
19
|
-
width: 100vw;
|
|
20
|
-
height: 100vh;
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
|
-
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
|
|
24
|
-
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<div id="demo"></div>
|
|
28
|
-
<script type="module">
|
|
29
|
-
import { html, render } from 'lit'
|
|
30
|
-
import { ReferenceMap, create, error } from '@hatiolab/things-scene'
|
|
31
|
-
import '@operato/board/ox-board-viewer.js'
|
|
32
|
-
import '../dist/simple-switch.js'
|
|
33
|
-
|
|
34
|
-
const colors = ['red', 'blue', 'orange', 'yellow', 'magenta', 'violet', 'navy', 'green', 'cyan', 'lime']
|
|
35
|
-
const boards = colors.map((color, idx) => {
|
|
36
|
-
var to = colors[(idx + 1) % colors.length]
|
|
37
|
-
return {
|
|
38
|
-
id: color,
|
|
39
|
-
model: {
|
|
40
|
-
width: 400,
|
|
41
|
-
height: 300,
|
|
42
|
-
fillStyle: color,
|
|
43
|
-
components: [
|
|
44
|
-
{
|
|
45
|
-
type: 'text',
|
|
46
|
-
left: 100,
|
|
47
|
-
top: 100,
|
|
48
|
-
width: 200,
|
|
49
|
-
height: 30,
|
|
50
|
-
text: `Click to move to ${to}`,
|
|
51
|
-
event: {
|
|
52
|
-
tap: {
|
|
53
|
-
action: 'goto',
|
|
54
|
-
target: to
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: 'simple-switch',
|
|
60
|
-
left: 100,
|
|
61
|
-
top: 200,
|
|
62
|
-
width: 100,
|
|
63
|
-
height: 30
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
var provider = new ReferenceMap(
|
|
71
|
-
async (boardId, resolve, reject) => {
|
|
72
|
-
try {
|
|
73
|
-
const board = boards.find(board => {
|
|
74
|
-
return board.id === boardId
|
|
75
|
-
})
|
|
76
|
-
if (!board) {
|
|
77
|
-
throw `no board named as ${boardId}`
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
var scene
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
scene = await provider.get(boardId)
|
|
84
|
-
console.warn('Board fetched more than twice.', boardId)
|
|
85
|
-
} catch (e) {
|
|
86
|
-
scene = create({
|
|
87
|
-
model: JSON.parse(JSON.stringify(board.model)),
|
|
88
|
-
mode: 0,
|
|
89
|
-
refProvider: provider
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
resolve(scene, board)
|
|
93
|
-
} catch (e) {
|
|
94
|
-
error(e)
|
|
95
|
-
reject(e)
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
async (id, ref) => {
|
|
99
|
-
ref.dispose()
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
render(
|
|
104
|
-
html` <ox-board-viewer .board=${boards[0]} .provider=${provider}></ox-board-viewer> `,
|
|
105
|
-
document.querySelector('#demo')
|
|
106
|
-
)
|
|
107
|
-
</script>
|
|
108
|
-
</body>
|
|
109
|
-
</html>
|
package/src/editors/index.ts
DELETED
|
File without changes
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
// Converts a datatransfer structer into an object with all paths and files
|
|
2
|
-
|
|
3
|
-
import URDFViewerElement from './urdf-viewer-element'
|
|
4
|
-
|
|
5
|
-
// listed out. Returns a promise that resolves with the file structure.
|
|
6
|
-
function dataTransferToFiles(dataTransfer: DataTransfer) {
|
|
7
|
-
if (!(dataTransfer instanceof DataTransfer)) {
|
|
8
|
-
throw new Error('Data must be of type "DataTransfer"')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const files = {} as any
|
|
12
|
-
|
|
13
|
-
// recurse down the webkit file structure resolving
|
|
14
|
-
// the paths to files names to store in the `files`
|
|
15
|
-
// object
|
|
16
|
-
function recurseDirectory(item: any): Promise<void> {
|
|
17
|
-
if (item.isFile) {
|
|
18
|
-
return new Promise(resolve => {
|
|
19
|
-
item.file((file: any) => {
|
|
20
|
-
files[item.fullPath] = file
|
|
21
|
-
resolve()
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
} else {
|
|
25
|
-
const reader = item.createReader()
|
|
26
|
-
|
|
27
|
-
return new Promise(resolve => {
|
|
28
|
-
const promises = [] as any
|
|
29
|
-
|
|
30
|
-
// exhaustively read all the directory entries
|
|
31
|
-
function readNextEntries() {
|
|
32
|
-
reader.readEntries((et: any) => {
|
|
33
|
-
if (et.length === 0) {
|
|
34
|
-
Promise.all(promises).then(() => resolve())
|
|
35
|
-
} else {
|
|
36
|
-
et.forEach((e: any) => {
|
|
37
|
-
promises.push(recurseDirectory(e))
|
|
38
|
-
})
|
|
39
|
-
readNextEntries()
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
readNextEntries()
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return new Promise(resolve => {
|
|
50
|
-
// Traverse down the tree and add the files into the zip
|
|
51
|
-
// const dtitems = dataTransfer.items && [...dataTransfer.items]
|
|
52
|
-
// const dtfiles = [...dataTransfer.files]
|
|
53
|
-
var dtitems = [] as DataTransferItem[]
|
|
54
|
-
if (dataTransfer.items) {
|
|
55
|
-
for (let i = 0; i < dataTransfer.items.length; i++) {
|
|
56
|
-
dtitems.push(dataTransfer.items[i])
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var dtfiles = [] as File[]
|
|
61
|
-
if (dataTransfer.files) {
|
|
62
|
-
for (let i = 0; i < dataTransfer.files.length; i++) {
|
|
63
|
-
dtfiles.push(dataTransfer.files[i])
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (dtitems.length && (dtitems[0].webkitGetAsEntry as any)) {
|
|
68
|
-
const promises = []
|
|
69
|
-
for (let i = 0; i < dtitems.length; i++) {
|
|
70
|
-
const item = dtitems[i]
|
|
71
|
-
const entry = item.webkitGetAsEntry()
|
|
72
|
-
|
|
73
|
-
promises.push(recurseDirectory(entry))
|
|
74
|
-
}
|
|
75
|
-
Promise.all(promises).then(() => resolve(files))
|
|
76
|
-
} else {
|
|
77
|
-
// add a '/' prefix to math the file directory entry
|
|
78
|
-
// on webkit browsers
|
|
79
|
-
dtfiles.filter(f => f.size !== 0).forEach(f => (files['/' + f.name] = f))
|
|
80
|
-
|
|
81
|
-
resolve(files)
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function registerDragEvents(viewer: URDFViewerElement, callback: () => void) {
|
|
87
|
-
document.addEventListener('dragover', e => e.preventDefault())
|
|
88
|
-
document.addEventListener('dragenter', e => e.preventDefault())
|
|
89
|
-
document.addEventListener('drop', e => {
|
|
90
|
-
e.preventDefault()
|
|
91
|
-
|
|
92
|
-
// convert the files
|
|
93
|
-
dataTransferToFiles(e.dataTransfer!).then((files: any) => {
|
|
94
|
-
// removes '..' and '.' tokens and normalizes slashes
|
|
95
|
-
const cleanFilePath = (path: string) => {
|
|
96
|
-
return path
|
|
97
|
-
.replace(/\\/g, '/')
|
|
98
|
-
.split(/\//g)
|
|
99
|
-
.reduce((acc, el) => {
|
|
100
|
-
if (el === '..') acc.pop()
|
|
101
|
-
else if (el !== '.') acc.push(el)
|
|
102
|
-
return acc
|
|
103
|
-
}, [] as string[])
|
|
104
|
-
.join('/')
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// set the loader url modifier to check the list
|
|
108
|
-
// of files
|
|
109
|
-
const fileNames = Object.keys(files).map(n => cleanFilePath(n))
|
|
110
|
-
viewer.urlModifierFunc = (url: string) => {
|
|
111
|
-
// find the matching file given the requested url
|
|
112
|
-
const cleaned = cleanFilePath(url.replace(viewer.package, ''))
|
|
113
|
-
const fileName = fileNames
|
|
114
|
-
.filter(name => {
|
|
115
|
-
// check if the end of file and url are the same
|
|
116
|
-
const len = Math.min(name.length, cleaned.length)
|
|
117
|
-
return cleaned.substr(cleaned.length - len) === name.substr(name.length - len)
|
|
118
|
-
})
|
|
119
|
-
.pop()
|
|
120
|
-
|
|
121
|
-
if (fileName !== undefined) {
|
|
122
|
-
// revoke the url after it's been used
|
|
123
|
-
const bloburl = URL.createObjectURL(files[fileName])
|
|
124
|
-
requestAnimationFrame(() => URL.revokeObjectURL(bloburl))
|
|
125
|
-
|
|
126
|
-
return bloburl
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return url
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// set the source of the element to the most likely intended display model
|
|
133
|
-
const filesNames = Object.keys(files)
|
|
134
|
-
viewer.up = '+Z'
|
|
135
|
-
;(document.getElementById('up-select') as any)!.value = viewer.up
|
|
136
|
-
|
|
137
|
-
viewer.urdf = filesNames.filter(n => /urdf$/i.test(n)).shift()!
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
callback()
|
|
141
|
-
})
|
|
142
|
-
}
|