@things-factory/board-ui 4.0.10 → 4.0.14

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.
Files changed (37) hide show
  1. package/client/index.js +0 -2
  2. package/client/pages/board-modeller-page.js +6 -75
  3. package/client/pages/board-player-page.js +1 -1
  4. package/client/pages/board-viewer-page.js +1 -1
  5. package/package.json +9 -10
  6. package/assets/images/icon-properties-ipattern.png +0 -0
  7. package/client/board-modeller/board-modeller.js +0 -237
  8. package/client/board-modeller/component-toolbar/component-menu.js +0 -153
  9. package/client/board-modeller/component-toolbar/component-toolbar.js +0 -193
  10. package/client/board-modeller/edit-toolbar-style.js +0 -228
  11. package/client/board-modeller/edit-toolbar.js +0 -637
  12. package/client/board-modeller/property-sidebar/abstract-property.js +0 -73
  13. package/client/board-modeller/property-sidebar/data-binding/data-binding-mapper.js +0 -366
  14. package/client/board-modeller/property-sidebar/data-binding/data-binding.js +0 -476
  15. package/client/board-modeller/property-sidebar/effects/effects-shared-style.js +0 -58
  16. package/client/board-modeller/property-sidebar/effects/effects.js +0 -64
  17. package/client/board-modeller/property-sidebar/effects/property-animation.js +0 -141
  18. package/client/board-modeller/property-sidebar/effects/property-animations.js +0 -92
  19. package/client/board-modeller/property-sidebar/effects/property-event-hover.js +0 -144
  20. package/client/board-modeller/property-sidebar/effects/property-event-tap.js +0 -146
  21. package/client/board-modeller/property-sidebar/effects/property-event.js +0 -72
  22. package/client/board-modeller/property-sidebar/effects/property-shadow.js +0 -122
  23. package/client/board-modeller/property-sidebar/effects/value-converter.js +0 -26
  24. package/client/board-modeller/property-sidebar/inspector/inspector.js +0 -338
  25. package/client/board-modeller/property-sidebar/property-shared-style.js +0 -132
  26. package/client/board-modeller/property-sidebar/property-sidebar.js +0 -324
  27. package/client/board-modeller/property-sidebar/shapes/box-padding-editor-styles.js +0 -94
  28. package/client/board-modeller/property-sidebar/shapes/shapes.js +0 -421
  29. package/client/board-modeller/property-sidebar/specifics/specific-properties-builder.js +0 -149
  30. package/client/board-modeller/property-sidebar/specifics/specifics.js +0 -248
  31. package/client/board-modeller/property-sidebar/styles/styles.js +0 -591
  32. package/client/board-modeller/scene-viewer/confidential-overlay.js +0 -18
  33. package/client/board-modeller/scene-viewer/things-scene-handler.js +0 -50
  34. package/client/board-modeller/scene-viewer/things-scene-layer.js +0 -52
  35. package/client/board-modeller/scene-viewer/things-scene-player.js +0 -115
  36. package/client/board-modeller/scene-viewer/things-scene-property.js +0 -25
  37. package/client/board-modeller/scene-viewer/things-scene-viewer.js +0 -312
@@ -1,637 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { html, LitElement } from 'lit-element'
6
-
7
- import { style } from './edit-toolbar-style'
8
-
9
- class EditToolbar extends LitElement {
10
- constructor() {
11
- super()
12
-
13
- this.scene = null
14
- this.selected = []
15
- this.hideProperty = false
16
- }
17
-
18
- static get properties() {
19
- return {
20
- scene: Object,
21
- selected: Array,
22
- hideProperty: Boolean
23
- }
24
- }
25
-
26
- static get styles() {
27
- return [style]
28
- }
29
-
30
- firstUpdated() {
31
- this.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)
32
-
33
- window.addEventListener('paste', e => {
34
- this.cliped = e.clipboardData.getData('text/plain')
35
- })
36
-
37
- this.shadowRoot.getElementById('align-left').addEventListener('tap', this.onTapAlign.bind(this))
38
- this.shadowRoot.getElementById('align-center').addEventListener('tap', this.onTapAlign.bind(this))
39
- this.shadowRoot.getElementById('align-right').addEventListener('tap', this.onTapAlign.bind(this))
40
- this.shadowRoot.getElementById('align-top').addEventListener('tap', this.onTapAlign.bind(this))
41
- this.shadowRoot.getElementById('align-middle').addEventListener('tap', this.onTapAlign.bind(this))
42
- this.shadowRoot.getElementById('align-bottom').addEventListener('tap', this.onTapAlign.bind(this))
43
- this.shadowRoot.getElementById('undo').addEventListener('tap', this.onTapUndo.bind(this))
44
- this.shadowRoot.getElementById('redo').addEventListener('tap', this.onTapRedo.bind(this))
45
- this.shadowRoot.getElementById('front').addEventListener('tap', this.onTapZorder.bind(this))
46
- this.shadowRoot.getElementById('back').addEventListener('tap', this.onTapZorder.bind(this))
47
- this.shadowRoot.getElementById('forward').addEventListener('tap', this.onTapZorder.bind(this))
48
- this.shadowRoot.getElementById('backward').addEventListener('tap', this.onTapZorder.bind(this))
49
- this.shadowRoot.getElementById('fullscreen').addEventListener('tap', this.onTapFullscreen.bind(this))
50
- this.shadowRoot.getElementById('cut').addEventListener('tap', this.onTapCut.bind(this))
51
- this.shadowRoot.getElementById('copy').addEventListener('tap', this.onTapCopy.bind(this))
52
- this.shadowRoot.getElementById('paste').addEventListener('tap', this.onTapPaste.bind(this))
53
- this.shadowRoot.getElementById('delete').addEventListener('tap', this.onTapDelete.bind(this))
54
- this.shadowRoot.getElementById('font-increase').addEventListener('tap', this.onTapFontIncrease.bind(this))
55
- this.shadowRoot.getElementById('font-decrease').addEventListener('tap', this.onTapFontDecrease.bind(this))
56
- this.shadowRoot.getElementById('group').addEventListener('tap', this.onTapGroup.bind(this))
57
- this.shadowRoot.getElementById('ungroup').addEventListener('tap', this.onTapUngroup.bind(this))
58
- this.shadowRoot.getElementById('symmetry-x').addEventListener('tap', this.onTapSymmetryX.bind(this))
59
- this.shadowRoot.getElementById('symmetry-y').addEventListener('tap', this.onTapSymmetryY.bind(this))
60
- this.shadowRoot.getElementById('rotate-cw').addEventListener('tap', this.onTapRotateCW.bind(this))
61
- this.shadowRoot.getElementById('rotate-ccw').addEventListener('tap', this.onTapRotateCCW.bind(this))
62
- this.shadowRoot.getElementById('toggle-property').addEventListener('tap', this.onTapToggle.bind(this))
63
- this.shadowRoot.getElementById('fit-scene').addEventListener('tap', this.onTapFitScene.bind(this))
64
- this.shadowRoot.getElementById('distribute-vertical').addEventListener('tap', this.onTapDistribute.bind(this))
65
- this.shadowRoot.getElementById('distribute-horizontal').addEventListener('tap', this.onTapDistribute.bind(this))
66
- this.shadowRoot.getElementById('preview').addEventListener('tap', this.onTapPreview.bind(this))
67
- }
68
-
69
- updated(change) {
70
- change.has('scene') && this.onSceneChanged(this.scene, change.scene)
71
- change.has('selected') && this.onSelectedChanged(this.selected, change.selected)
72
- }
73
-
74
- render() {
75
- return html`
76
- <div tools>
77
- <span><slot></slot></span>
78
-
79
- <span button id="undo" title="undo (${this.getShortcutString('cmd', 'z')})"> </span>
80
- <span button id="redo" title="redo (${this.getShortcutString('cmd', 'shift', 'z')})"> </span>
81
-
82
- <span class="vline"></span>
83
-
84
- <span button id="cut" title="cut (${this.getShortcutString('cmd', 'x')})"> </span>
85
- <span button id="copy" title="copy (${this.getShortcutString('cmd', 'c')})"> </span>
86
- <span button id="paste" title="paste (${this.getShortcutString('cmd', 'v')})"> </span>
87
- <span
88
- button
89
- id="delete"
90
- title="delete (${this.getShortcutString('backspace')}, ${this.getShortcutString('delete')})"
91
- >
92
- </span>
93
-
94
- <span class="vline"></span>
95
-
96
- <!-- TODO Implement style-copy
97
- <span button id="style-copy" title="format painter"></span>
98
- <span class="vline"></span>
99
- -->
100
-
101
- <span
102
- button
103
- data-align="left"
104
- id="align-left"
105
- title="align left (${this.getShortcutString('alt', 'shift', 'l')})"
106
- >
107
- </span>
108
- <span
109
- button
110
- data-align="center"
111
- id="align-center"
112
- title="align center (${this.getShortcutString('alt', 'shift', 'c')})"
113
- >
114
- </span>
115
- <span
116
- button
117
- data-align="right"
118
- id="align-right"
119
- title="align right (${this.getShortcutString('alt', 'shift', 'r')})"
120
- >
121
- </span>
122
-
123
- <span button data-align="top" id="align-top" title="align top (${this.getShortcutString('alt', 'shift', 't')})">
124
- </span>
125
- <span
126
- button
127
- data-align="middle"
128
- id="align-middle"
129
- title="align middle (${this.getShortcutString('alt', 'shift', 'm')})"
130
- >
131
- </span>
132
- <span
133
- button
134
- data-align="bottom"
135
- id="align-bottom"
136
- title="align bottom (${this.getShortcutString('alt', 'shift', 'b')})"
137
- >
138
- </span>
139
-
140
- <span
141
- button
142
- data-distribute="HORIZONTAL"
143
- id="distribute-horizontal"
144
- title="distribute horizontally (${this.getShortcutString('alt', 'shift', 'h')})"
145
- >
146
- </span>
147
-
148
- <span
149
- button
150
- data-distribute="VERTICAL"
151
- id="distribute-vertical"
152
- title="distribute vertically (${this.getShortcutString('alt', 'shift', 'v')})"
153
- >
154
- </span>
155
-
156
- <span class="vline"></span>
157
-
158
- <span
159
- button
160
- id="front"
161
- data-zorder="front"
162
- title="bring to front (${this.getShortcutString('cmd', 'shift', 'f')})"
163
- >
164
- </span>
165
- <span button id="back" data-zorder="back" title="send to back (${this.getShortcutString('cmd', 'shift', 'b')})">
166
- </span>
167
- <span button id="forward" data-zorder="forward" title="bring forward (${this.getShortcutString('cmd', 'f')})">
168
- </span>
169
- <span button id="backward" data-zorder="backward" title="send backward (${this.getShortcutString('cmd', 'b')})">
170
- </span>
171
-
172
- <span class="vline"></span>
173
-
174
- <span button id="symmetry-x" title="symmetry-x (${this.getShortcutString('alt', 'shift', 'x')})"> </span>
175
- <span button id="symmetry-y" title="symmetry-y (${this.getShortcutString('alt', 'shift', 'y')})"> </span>
176
- <span button id="rotate-cw" title="rotate clockwise (${this.getShortcutString('alt', 'shift', 'e')})"> </span>
177
- <span button id="rotate-ccw" title="rotate counter clockwise (${this.getShortcutString('alt', 'shift', 'w')})">
178
- </span>
179
-
180
- <span class="vline"></span>
181
-
182
- <span button id="group" title="group (${this.getShortcutString('cmd', 'g')})"> </span>
183
- <span button id="ungroup" title="ungroup (${this.getShortcutString('cmd', 'shift', 'g')})"> </span>
184
-
185
- <span class="vline"></span>
186
-
187
- <span button id="font-increase" title="increase font size"></span>
188
- <span button id="font-decrease" title="decrease font size"></span>
189
-
190
- <span class="vline"></span>
191
- <span padding></span>
192
-
193
- <span button id="fit-scene" title="fit scene (${this.getShortcutString('cmd', 'd')})"> </span>
194
-
195
- <span class="vline"></span>
196
-
197
- <span button id="preview" title="preview (${this.getShortcutString('ctrl', 'p')})"> </span>
198
-
199
- <span button id="fullscreen" title="fullscreen (${this.getShortcutString('f11')})"> </span>
200
-
201
- <span
202
- button
203
- id="toggle-property"
204
- title="toggle property panel (${this.getShortcutString('cmd', 'h')})"
205
- toggles="true"
206
- >
207
- </span>
208
- </div>
209
- `
210
- }
211
-
212
- onWheelEvent(e) {
213
- var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
214
- this.scrollLeft -= delta * 40
215
-
216
- e.preventDefault()
217
- }
218
-
219
- _isMacOS() {
220
- return navigator.userAgent.indexOf('Mac') != -1
221
- }
222
-
223
- getSymbol(key) {
224
- var symbol
225
- switch (key) {
226
- case 'cmd':
227
- case 'ctrl':
228
- symbol = this._isMacOS() ? '⌘' : 'Ctrl'
229
- break
230
- case 'shift':
231
- symbol = this._isMacOS() ? '⇧' : 'Shift'
232
- break
233
- case 'alt':
234
- case 'option':
235
- symbol = this._isMacOS() ? '⌥' : 'Alt'
236
- break
237
- case 'backspace':
238
- symbol = this._isMacOS() ? '⌫' : 'BackSpace'
239
- break
240
- case 'delete':
241
- symbol = this._isMacOS() ? '⌦' : 'Del'
242
- break
243
- default:
244
- symbol = key.toUpperCase()
245
- break
246
- }
247
-
248
- return symbol
249
- }
250
-
251
- getShortcutString() {
252
- var symbols = []
253
- for (var i = 0; i < arguments.length; i++) {
254
- symbols.push(this.getSymbol(arguments[i]))
255
- }
256
-
257
- return symbols.join(this._isMacOS() ? '' : '+')
258
- }
259
-
260
- onShortcut(e, MacOS) {
261
- if (MacOS) var ctrlKey = e.metaKey
262
- else var ctrlKey = e.ctrlKey
263
-
264
- var altKey = e.altKey
265
- var shiftKey = e.shiftKey
266
-
267
- var defaultPrevent = ctrlKey || altKey
268
-
269
- switch (e.code) {
270
- case 'KeyZ':
271
- if (ctrlKey && !shiftKey) this.onTapUndo()
272
- else if (ctrlKey && shiftKey) this.onTapRedo()
273
- break
274
- case 'KeyY':
275
- if (ctrlKey && !shiftKey) this.onTapRedo()
276
- else if (altKey && shiftKey) this.onTapSymmetryY()
277
- break
278
- case 'KeyC':
279
- if (ctrlKey && !shiftKey) this.onTapCopy()
280
- else if (altKey && shiftKey) this.onTapAlign('center')
281
- break
282
- case 'KeyX':
283
- if (ctrlKey && !shiftKey) this.onTapCut()
284
- else if (altKey && shiftKey) this.onTapSymmetryX()
285
- break
286
- case 'KeyV':
287
- if (ctrlKey && !shiftKey) {
288
- this.onTapPaste()
289
- defaultPrevent = false
290
- } else if (altKey && shiftKey) this.onTapDistribute('VERTICAL')
291
- break
292
- case 'Delete':
293
- case 'Backspace':
294
- this.onTapDelete()
295
- defaultPrevent = true
296
- break
297
- case 'KeyG':
298
- if (ctrlKey && !shiftKey) this.onTapGroup()
299
- else if (ctrlKey && shiftKey) this.onTapUngroup()
300
- break
301
- case 'KeyF':
302
- if (ctrlKey && !shiftKey) this.scene.zorder('forward')
303
- else if (ctrlKey && shiftKey) this.scene.zorder('front')
304
- break
305
- case 'KeyB':
306
- if (ctrlKey && !shiftKey) this.scene.zorder('backward')
307
- else if (ctrlKey && shiftKey) this.scene.zorder('back')
308
- else if (altKey && shiftKey) this.onTapAlign('bottom')
309
- break
310
- // case 'Equal':
311
- // if (ctrlKey) this.onTapZoom(zoomin)
312
- // break
313
- // case 'Minus':
314
- // if (ctrlKey) this.onTapZoom(zoomout)
315
- // break
316
- case 'KeyH':
317
- if (ctrlKey && !shiftKey) this.onTapToggle()
318
- else if (altKey && shiftKey) this.onTapDistribute('HORIZONTAL')
319
- break
320
- case 'F11':
321
- this.onTapFullscreen()
322
- defaultPrevent = true
323
- break
324
- case 'KeyP':
325
- if (ctrlKey) {
326
- this.onTapPreview()
327
- defaultPrevent = true
328
- }
329
- break
330
- case 'KeyA':
331
- if (ctrlKey) this.onTapSelectAll()
332
- break
333
- case 'KeyL':
334
- if (altKey && shiftKey) this.onTapAlign('left')
335
- break
336
- case 'KeyR':
337
- if (altKey && shiftKey) this.onTapAlign('right')
338
- break
339
- case 'KeyM':
340
- if (altKey && shiftKey) this.onTapAlign('middle')
341
- break
342
- case 'KeyT':
343
- if (altKey && shiftKey) this.onTapAlign('top')
344
- break
345
- case 'KeyY':
346
- if (altKey && shiftKey) this.onTapSymmetryY()
347
- break
348
- case 'KeyD':
349
- if (ctrlKey) {
350
- this.onTapFitScene()
351
- defaultPrevent = true
352
- }
353
- break
354
- case 'KeyE':
355
- if (altKey && shiftKey) this.onTapRotateCW()
356
- else if (ctrlKey && shiftKey) this.onTapDownloadModel()
357
- break
358
- case 'KeyW':
359
- if (altKey && shiftKey) this.onTapRotateCCW()
360
- break
361
- case 'Digit1':
362
- if (ctrlKey) {
363
- console.log('MODEL', this.scene && this.scene.model)
364
- defaultPrevent = true
365
- }
366
- break
367
- case 'Digit2':
368
- if (ctrlKey) {
369
- console.log('SELECTED', this.scene && this.scene.selected)
370
- defaultPrevent = true
371
- }
372
- break
373
-
374
- default:
375
- return false
376
- }
377
-
378
- if (defaultPrevent) e.preventDefault()
379
- return true
380
- }
381
-
382
- onExecute(command, undoable, redoable) {
383
- this.shadowRoot.getElementById('undo').disabled = !undoable
384
- this.shadowRoot.getElementById('redo').disabled = !redoable
385
- }
386
-
387
- onUndo(undoable, redoable) {
388
- this.shadowRoot.getElementById('undo').disabled = !undoable
389
- this.shadowRoot.getElementById('redo').disabled = !redoable
390
- }
391
-
392
- onRedo(undoable, redoable) {
393
- this.shadowRoot.getElementById('undo').disabled = !undoable
394
- this.shadowRoot.getElementById('redo').disabled = !redoable
395
- }
396
-
397
- onSceneChanged(after, before) {
398
- // if (before) {
399
- // before.off('execute', this.onExecute, this)
400
- // before.off('undo', this.onUndo, this)
401
- // before.off('redo', this.onRedo, this)
402
- // }
403
-
404
- if (after) {
405
- after.on('execute', this.onExecute, this)
406
- after.on('undo', this.onUndo, this)
407
- after.on('redo', this.onRedo, this)
408
- }
409
- }
410
-
411
- onSelectedChanged(after, before) {
412
- var alignable = after.length > 1
413
-
414
- this.shadowRoot.getElementById('align-left').disabled = !alignable
415
- this.shadowRoot.getElementById('align-center').disabled = !alignable
416
- this.shadowRoot.getElementById('align-right').disabled = !alignable
417
- this.shadowRoot.getElementById('align-top').disabled = !alignable
418
- this.shadowRoot.getElementById('align-middle').disabled = !alignable
419
- this.shadowRoot.getElementById('align-bottom').disabled = !alignable
420
-
421
- var movable = after.length === 1
422
-
423
- /* forward, backward 이동은 한 컴포넌트만 가능하다. */
424
- this.shadowRoot.getElementById('forward').disabled = !movable
425
- this.shadowRoot.getElementById('backward').disabled = !movable
426
-
427
- /* 여러 컴포넌트는 front, back 이동이 가능하다. */
428
- this.shadowRoot.getElementById('front').disabled = !(alignable || movable)
429
- this.shadowRoot.getElementById('back').disabled = !(alignable || movable)
430
- }
431
-
432
- onTapUndo(e) {
433
- this.scene && this.scene.undo()
434
- }
435
-
436
- onTapRedo(e) {
437
- this.scene && this.scene.redo()
438
- }
439
-
440
- onTapCut(e) {
441
- this.scene && this.scene.cut()
442
- }
443
-
444
- onTapCopy(e) {
445
- var copied = this.scene && this.scene.copy()
446
-
447
- if (!copied) return
448
-
449
- navigator.clipboard.writeText(copied)
450
- this.cliped = copied
451
- }
452
-
453
- onTapPaste(e) {
454
- setTimeout(() => {
455
- this.scene && this.scene.paste(this.cliped)
456
- }, 100)
457
- }
458
-
459
- onTapDelete(e) {
460
- this.scene && this.scene.remove()
461
- }
462
-
463
- onTapSelectAll(e) {
464
- this.scene.select('(child)')
465
- }
466
-
467
- onTapFontIncrease(e) {
468
- var selected = this.scene.selected
469
-
470
- this.scene.undoableChange(function () {
471
- selected.forEach(function (component) {
472
- var fontSize = component.get('fontSize')
473
-
474
- if (!fontSize) fontSize = '15'
475
-
476
- if (fontSize) {
477
- var size = parseInt(fontSize)
478
- component.set('fontSize', size + 1)
479
- }
480
- })
481
- })
482
- }
483
-
484
- onTapFontDecrease(e) {
485
- var selected = this.scene.selected
486
-
487
- this.scene.undoableChange(function () {
488
- selected.forEach(function (component) {
489
- var fontSize = component.get('fontSize')
490
-
491
- if (!fontSize) fontSize = '15'
492
-
493
- if (fontSize) {
494
- var size = parseInt(fontSize)
495
- if (size > 1) component.set('fontSize', size - 1)
496
- }
497
- })
498
- })
499
- }
500
-
501
- onTapAlign(e) {
502
- if (!this.scene) return
503
-
504
- var selected = this.scene.selected
505
- if (selected.length <= 1) return
506
-
507
- if (e.target) {
508
- var button = e.target
509
-
510
- while (!button.hasAttribute('data-align') && button !== document.body) button = button.parentElement
511
-
512
- var align = button.getAttribute('data-align')
513
- } else {
514
- var align = e
515
- }
516
-
517
- this.scene.align(align)
518
- }
519
-
520
- onTapZorder(e) {
521
- if (!this.scene) return
522
-
523
- var selected = this.scene.selected
524
- if (selected.length < 1) return
525
- if (e.target) {
526
- var button = e.target
527
-
528
- while (!button.hasAttribute('data-zorder') && button !== document.body) button = button.parentElement
529
-
530
- var zorder = button.getAttribute('data-zorder')
531
- } else {
532
- var zorder = e.getAttribute('data-zorder')
533
- }
534
-
535
- this.scene.zorder(zorder)
536
- }
537
-
538
- onTapSymmetryX(e) {
539
- this.scene && this.scene.symmetryX()
540
- }
541
-
542
- onTapSymmetryY(e) {
543
- this.scene && this.scene.symmetryY()
544
- }
545
-
546
- onTapRotateCW(e) {
547
- if (!this.scene) return
548
-
549
- var selected = this.scene.selected
550
- if (selected.length && selected[0].isRootModel()) return
551
-
552
- this.scene.undoableChange(function () {
553
- selected.forEach(function (component) {
554
- var rotation = component.get('rotation')
555
-
556
- if (!rotation) rotation = 0
557
-
558
- component.set('rotation', (rotation + Math.PI / 2) % (Math.PI * 2))
559
- })
560
- })
561
- }
562
-
563
- onTapRotateCCW(e) {
564
- if (!this.scene) return
565
-
566
- var selected = this.scene.selected
567
- if (selected.length && selected[0].isRootModel()) return
568
-
569
- this.scene.undoableChange(function () {
570
- selected.forEach(function (component) {
571
- var rotation = component.get('rotation')
572
-
573
- if (!rotation) rotation = 0
574
-
575
- component.set('rotation', (rotation - Math.PI / 2) % (Math.PI * 2))
576
- })
577
- })
578
- }
579
-
580
- onTapGroup(e) {
581
- this.scene && this.scene.group()
582
- }
583
-
584
- onTapUngroup(e) {
585
- this.scene && this.scene.ungroup()
586
- }
587
-
588
- onTapFullscreen(e) {
589
- this.dispatchEvent(new CustomEvent('modeller-fullscreen'))
590
- }
591
-
592
- onTapToggle(e) {
593
- this.hideProperty = !this.hideProperty
594
- this.dispatchEvent(
595
- new CustomEvent('hide-property-changed', {
596
- bubbles: true,
597
- composed: true,
598
- detail: { value: this.hideProperty }
599
- })
600
- )
601
- }
602
-
603
- onTapFitScene(e) {
604
- if (this.scene) {
605
- this.scene.resize()
606
- this.scene.fit('ratio')
607
- }
608
- }
609
-
610
- onTapPreview(e) {
611
- this.dispatchEvent(new CustomEvent('open-preview'))
612
- }
613
-
614
- onTapDownloadModel(e) {
615
- this.dispatchEvent(new CustomEvent('download-model'))
616
- }
617
-
618
- onTapDistribute(e) {
619
- if (!this.scene) return
620
-
621
- var selected = this.scene.selected
622
- if (selected.length <= 1) return
623
- if (e.target) {
624
- var button = e.target
625
-
626
- while (!button.hasAttribute('data-distribute') && button !== document.body) button = button.parentElement
627
-
628
- var distribute = button.getAttribute('data-distribute')
629
- } else {
630
- var distribute = e
631
- }
632
-
633
- this.scene.distribute(distribute)
634
- }
635
- }
636
-
637
- customElements.define('edit-toolbar', EditToolbar)
@@ -1,73 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { LitElement } from 'lit-element'
6
-
7
- export class AbstractProperty extends LitElement {
8
- firstUpdated() {
9
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
10
- }
11
-
12
- _onValueChange(e) {
13
- var element = e.target
14
- var key = element.getAttribute('value-key')
15
-
16
- if (!key) {
17
- return
18
- }
19
-
20
- var value = this._getValueFromEventTarget(element)
21
-
22
- this._onAfterValueChange(key, value)
23
- }
24
-
25
- _getValueFromEventTarget(element) {
26
- var value
27
-
28
- switch (element.tagName) {
29
- case 'THINGS-EDITOR-ANGLE-INPUT':
30
- value = Number(element.radian) || 0
31
- break
32
-
33
- case 'INPUT':
34
- switch (element.type) {
35
- case 'checkbox':
36
- value = element.checked
37
- break
38
- case 'number':
39
- value = Number(element.valueAsNumber)
40
- break
41
- case 'text':
42
- value = String(element.value)
43
- }
44
- break
45
-
46
- case 'PAPER-BUTTON':
47
- value = element.active
48
- break
49
-
50
- case 'PAPER-LISTBOX':
51
- value = element.selected
52
- break
53
-
54
- default:
55
- value = element.value
56
- break
57
- }
58
-
59
- return value
60
- }
61
-
62
- _onAfterValueChange(key, value) {
63
- this.dispatchEvent(
64
- new CustomEvent('property-change', {
65
- bubbles: true,
66
- composed: true,
67
- detail: {
68
- [key]: value
69
- }
70
- })
71
- )
72
- }
73
- }