@operato/process 1.1.7 → 1.1.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/CHANGELOG.md +18 -0
- package/dist/src/modeller/property-sidebar/shapes/shapes.js +4 -4
- package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -1
- package/dist/src/ox-process-modeller.d.ts +4 -6
- package/dist/src/ox-process-modeller.js +28 -30
- package/dist/src/ox-process-modeller.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -8
- package/src/modeller/property-sidebar/shapes/shapes.ts +4 -4
- package/src/ox-process-modeller.ts +28 -30
- package/dist/src/modeller/scene-viewer/scene-handler.d.ts +0 -11
- package/dist/src/modeller/scene-viewer/scene-handler.js +0 -32
- package/dist/src/modeller/scene-viewer/scene-handler.js.map +0 -1
- package/dist/src/modeller/scene-viewer/scene-layer.d.ts +0 -10
- package/dist/src/modeller/scene-viewer/scene-layer.js +0 -38
- package/dist/src/modeller/scene-viewer/scene-layer.js.map +0 -1
- package/dist/src/modeller/scene-viewer/scene-property.d.ts +0 -6
- package/dist/src/modeller/scene-viewer/scene-property.js +0 -15
- package/dist/src/modeller/scene-viewer/scene-property.js.map +0 -1
- package/dist/src/modeller/scene-viewer/scene-viewer.d.ts +0 -38
- package/dist/src/modeller/scene-viewer/scene-viewer.js +0 -243
- package/dist/src/modeller/scene-viewer/scene-viewer.js.map +0 -1
- package/src/modeller/scene-viewer/scene-handler.ts +0 -39
- package/src/modeller/scene-viewer/scene-layer.ts +0 -41
- package/src/modeller/scene-viewer/scene-property.ts +0 -9
- package/src/modeller/scene-viewer/scene-viewer.ts +0 -249
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/process",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"description": "Webcomponent for business process modeling following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,15 +52,16 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@open-wc/scoped-elements": "^2.1.3",
|
|
55
|
-
"@operato/app": "^1.1.
|
|
56
|
-
"@operato/
|
|
57
|
-
"@operato/
|
|
55
|
+
"@operato/app": "^1.1.10",
|
|
56
|
+
"@operato/board": "^1.1.10",
|
|
57
|
+
"@operato/data-grist": "^1.1.10",
|
|
58
|
+
"@operato/font": "^1.1.10",
|
|
58
59
|
"@operato/graphql": "^1.1.1",
|
|
59
60
|
"@operato/i18n": "^1.1.4",
|
|
60
|
-
"@operato/input": "^1.1.
|
|
61
|
+
"@operato/input": "^1.1.10",
|
|
61
62
|
"@operato/markdown": "^1.1.1",
|
|
62
|
-
"@operato/popup": "^1.1.
|
|
63
|
-
"@operato/property-editor": "^1.1.
|
|
63
|
+
"@operato/popup": "^1.1.10",
|
|
64
|
+
"@operato/property-editor": "^1.1.10",
|
|
64
65
|
"@operato/styles": "^1.1.1",
|
|
65
66
|
"@operato/utils": "^1.1.1",
|
|
66
67
|
"@polymer/paper-dropdown-menu": "^3.2.0",
|
|
@@ -111,5 +112,5 @@
|
|
|
111
112
|
"prettier --write"
|
|
112
113
|
]
|
|
113
114
|
},
|
|
114
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "e4f3cc8687d0e2e0d2650c94097ef99a7315001f"
|
|
115
116
|
}
|
|
@@ -207,7 +207,7 @@ export class PropertyShapes extends AbstractProperty {
|
|
|
207
207
|
? html``
|
|
208
208
|
: html`
|
|
209
209
|
<label class="rotate"> <ox-i18n msgid="label.rotate">rotate</ox-i18n> </label>
|
|
210
|
-
<ox-input-angle value-key="rotation" .
|
|
210
|
+
<ox-input-angle value-key="rotation" .value=${value.rotation}> </ox-input-angle>
|
|
211
211
|
`}
|
|
212
212
|
</div>
|
|
213
213
|
</fieldset>
|
|
@@ -233,13 +233,13 @@ export class PropertyShapes extends AbstractProperty {
|
|
|
233
233
|
<input type="number" value-key="depth" .value=${value.depth} />
|
|
234
234
|
|
|
235
235
|
<label class="rotationX"> <ox-i18n msgid="label.rotation-x">rot. X</ox-i18n> </label>
|
|
236
|
-
<ox-input-angle value-key="rotationX" .
|
|
236
|
+
<ox-input-angle value-key="rotationX" .value=${value.rotationX}> </ox-input-angle>
|
|
237
237
|
|
|
238
238
|
<label class="rotationY"> <ox-i18n msgid="label.rotation-y">rot. Y</ox-i18n> </label>
|
|
239
|
-
<ox-input-angle value-key="rotationY" .
|
|
239
|
+
<ox-input-angle value-key="rotationY" .value=${value.rotationY}> </ox-input-angle>
|
|
240
240
|
|
|
241
241
|
<label class="rotationZ"> <ox-i18n msgid="label.rotation-z">rot. Z</ox-i18n> </label>
|
|
242
|
-
<ox-input-angle value-key="rotation" .
|
|
242
|
+
<ox-input-angle value-key="rotation" .value=${value.rotation}> </ox-input-angle>
|
|
243
243
|
</div>
|
|
244
244
|
</fieldset>
|
|
245
245
|
`
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import '@material/mwc-fab'
|
|
2
2
|
import '@hatiolab/things-scene'
|
|
3
3
|
import './ox-process-viewer'
|
|
4
|
+
import '@operato/board/ox-scene-handler.js'
|
|
5
|
+
import '@operato/board/ox-scene-layer.js'
|
|
6
|
+
import '@operato/board/ox-scene-property.js'
|
|
7
|
+
import '@operato/board/ox-scene-viewer.js'
|
|
4
8
|
|
|
5
9
|
import { saveAs } from 'file-saver'
|
|
6
10
|
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
@@ -16,9 +20,6 @@ import { ComponentGroup, ComponentTemplate } from './types'
|
|
|
16
20
|
import { ComponentToolbar } from './modeller/component-toolbar/component-toolbar'
|
|
17
21
|
import { EditToolbar } from './modeller/edit-toolbar'
|
|
18
22
|
import { PropertySidebar } from './modeller/property-sidebar/property-sidebar'
|
|
19
|
-
import SceneViewer from './modeller/scene-viewer/scene-viewer'
|
|
20
|
-
import SceneLayer from './modeller/scene-viewer/scene-layer'
|
|
21
|
-
import SceneProperty from './modeller/scene-viewer/scene-property'
|
|
22
23
|
|
|
23
24
|
const MACOS = isMacOS()
|
|
24
25
|
|
|
@@ -74,7 +75,7 @@ export class OxProcessModeller extends ScopedElementsMixin(LitElement) {
|
|
|
74
75
|
flex-direction: row;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
scene-viewer {
|
|
78
|
+
ox-scene-viewer {
|
|
78
79
|
flex: 1;
|
|
79
80
|
width: 100%;
|
|
80
81
|
height: 100%;
|
|
@@ -201,10 +202,7 @@ export class OxProcessModeller extends ScopedElementsMixin(LitElement) {
|
|
|
201
202
|
return {
|
|
202
203
|
'process-edit-toolbar': EditToolbar,
|
|
203
204
|
'process-property-sidebar': PropertySidebar,
|
|
204
|
-
'process-component-toolbar': ComponentToolbar
|
|
205
|
-
'scene-viewer': SceneViewer,
|
|
206
|
-
'scene-layer': SceneLayer,
|
|
207
|
-
'scene-property': SceneProperty
|
|
205
|
+
'process-component-toolbar': ComponentToolbar
|
|
208
206
|
}
|
|
209
207
|
}
|
|
210
208
|
|
|
@@ -233,7 +231,7 @@ export class OxProcessModeller extends ScopedElementsMixin(LitElement) {
|
|
|
233
231
|
</process-component-toolbar>
|
|
234
232
|
|
|
235
233
|
<div id="scene-wrap">
|
|
236
|
-
<scene-viewer
|
|
234
|
+
<ox-scene-viewer
|
|
237
235
|
id="scene"
|
|
238
236
|
.scene=${this.scene}
|
|
239
237
|
@scene-changed=${(e: CustomEvent) => {
|
|
@@ -254,27 +252,27 @@ export class OxProcessModeller extends ScopedElementsMixin(LitElement) {
|
|
|
254
252
|
.provider=${this.provider}
|
|
255
253
|
name="modeller"
|
|
256
254
|
>
|
|
257
|
-
<scene-layer type="selection-layer"></scene-layer>
|
|
258
|
-
<scene-layer type="modeling-layer"></scene-layer>
|
|
259
|
-
<scene-layer type="add-layer"> </scene-layer>
|
|
260
|
-
<scene-layer type="guide-layer">
|
|
261
|
-
<scene-property name="ruler" value="disabled"></scene-property>
|
|
262
|
-
</scene-layer>
|
|
263
|
-
<scene-layer type="shift-layer">
|
|
264
|
-
<scene-property name="text" value="${this.overlay}"></scene-property>
|
|
265
|
-
<scene-property name="alpha" value="0.3"></scene-property>
|
|
266
|
-
<scene-property name="fontFamily" value="arial"></scene-property>
|
|
267
|
-
<scene-property name="fontSize" value="30" type="number"></scene-property>
|
|
268
|
-
<scene-property name="fontColor" value="navy"></scene-property>
|
|
269
|
-
<scene-property name="textBaseline" value="top"></scene-property>
|
|
270
|
-
<scene-property name="textAlign" value="left"></scene-property>
|
|
271
|
-
<scene-property name="paddingTop" value="50" type="number"></scene-property>
|
|
272
|
-
<scene-property name="paddingLeft" value="50" type="number"></scene-property>
|
|
273
|
-
</scene-layer>
|
|
274
|
-
<scene-layer type="decotag-layer"></scene-layer>
|
|
275
|
-
<scene-handler type="text-editor"></scene-handler>
|
|
276
|
-
<scene-handler type="move-handler"></scene-handler>
|
|
277
|
-
</scene-viewer>
|
|
255
|
+
<ox-scene-layer type="selection-layer"></ox-scene-layer>
|
|
256
|
+
<ox-scene-layer type="modeling-layer"></ox-scene-layer>
|
|
257
|
+
<ox-scene-layer type="add-layer"> </ox-scene-layer>
|
|
258
|
+
<ox-scene-layer type="guide-layer">
|
|
259
|
+
<ox-scene-property name="ruler" value="disabled"></ox-scene-property>
|
|
260
|
+
</ox-scene-layer>
|
|
261
|
+
<ox-scene-layer type="shift-layer">
|
|
262
|
+
<ox-scene-property name="text" value="${this.overlay}"></ox-scene-property>
|
|
263
|
+
<ox-scene-property name="alpha" value="0.3"></ox-scene-property>
|
|
264
|
+
<ox-scene-property name="fontFamily" value="arial"></ox-scene-property>
|
|
265
|
+
<ox-scene-property name="fontSize" value="30" type="number"></ox-scene-property>
|
|
266
|
+
<ox-scene-property name="fontColor" value="navy"></ox-scene-property>
|
|
267
|
+
<ox-scene-property name="textBaseline" value="top"></ox-scene-property>
|
|
268
|
+
<ox-scene-property name="textAlign" value="left"></ox-scene-property>
|
|
269
|
+
<ox-scene-property name="paddingTop" value="50" type="number"></ox-scene-property>
|
|
270
|
+
<ox-scene-property name="paddingLeft" value="50" type="number"></ox-scene-property>
|
|
271
|
+
</ox-scene-layer>
|
|
272
|
+
<ox-scene-layer type="decotag-layer"></ox-scene-layer>
|
|
273
|
+
<ox-scene-handler type="text-editor"></ox-scene-handler>
|
|
274
|
+
<ox-scene-handler type="move-handler"></ox-scene-handler>
|
|
275
|
+
</ox-scene-viewer>
|
|
278
276
|
|
|
279
277
|
<mwc-fab icon="save" @click=${() => this.onTapSave()} title="save"> </mwc-fab>
|
|
280
278
|
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import './scene-property';
|
|
2
|
-
import { LitElement } from 'lit';
|
|
3
|
-
export default class SceneHandler extends LitElement {
|
|
4
|
-
type: string;
|
|
5
|
-
model: {
|
|
6
|
-
type: Object;
|
|
7
|
-
notify: true;
|
|
8
|
-
};
|
|
9
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
-
connectedCallback(): void;
|
|
11
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import './scene-property';
|
|
3
|
-
import { LitElement, html } from 'lit';
|
|
4
|
-
import { property } from 'lit/decorators.js';
|
|
5
|
-
export default class SceneHandler extends LitElement {
|
|
6
|
-
render() {
|
|
7
|
-
return html ` <slot select="scene-property"></slot> `;
|
|
8
|
-
}
|
|
9
|
-
connectedCallback() {
|
|
10
|
-
super.connectedCallback();
|
|
11
|
-
let model = {
|
|
12
|
-
type: this.type
|
|
13
|
-
};
|
|
14
|
-
model = Array.from(this.querySelectorAll('scene-property')).reduce((model, property) => {
|
|
15
|
-
const name = property.getAttribute('name');
|
|
16
|
-
const value = property.getAttribute('value');
|
|
17
|
-
if (name) {
|
|
18
|
-
model[name] = value;
|
|
19
|
-
}
|
|
20
|
-
return model;
|
|
21
|
-
}, model);
|
|
22
|
-
model.__host__ = this;
|
|
23
|
-
this.model = model;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
__decorate([
|
|
27
|
-
property({ type: String })
|
|
28
|
-
], SceneHandler.prototype, "type", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
property({ type: Object })
|
|
31
|
-
], SceneHandler.prototype, "model", void 0);
|
|
32
|
-
//# sourceMappingURL=scene-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scene-handler.js","sourceRoot":"","sources":["../../../../src/modeller/scene-viewer/scene-handler.ts"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IAOlD,MAAM;QACJ,OAAO,IAAI,CAAA,yCAAyC,CAAA;IACtD,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,KAAK,GAAQ;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAA;QAED,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,QAAa,EAAE,EAAE;YAC/F,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;YAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;YAE5C,IAAI,IAAI,EAAE;gBACR,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;aACpB;YAED,OAAO,KAAK,CAAA;QACd,CAAC,EAAE,KAAK,CAAC,CAAA;QAET,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAA;QAErB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AAhC6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAG1B","sourcesContent":["import './scene-property'\n\nimport { LitElement, html } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nexport default class SceneHandler extends LitElement {\n @property({ type: String }) type!: string\n @property({ type: Object }) model!: {\n type: Object\n notify: true\n }\n\n render() {\n return html` <slot select=\"scene-property\"></slot> `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n let model: any = {\n type: this.type\n }\n\n model = Array.from(this.querySelectorAll('scene-property')).reduce((model: any, property: any) => {\n const name = property.getAttribute('name')\n const value = property.getAttribute('value')\n\n if (name) {\n model[name] = value\n }\n\n return model\n }, model)\n\n model.__host__ = this\n\n this.model = model\n }\n}\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import './scene-property';
|
|
3
|
-
import { LitElement, html } from 'lit';
|
|
4
|
-
import { property } from 'lit/decorators.js';
|
|
5
|
-
export default class SceneLayer extends LitElement {
|
|
6
|
-
render() {
|
|
7
|
-
return html ` <slot select="scene-property"></slot> `;
|
|
8
|
-
}
|
|
9
|
-
getModel() {
|
|
10
|
-
let model = {
|
|
11
|
-
type: this.type
|
|
12
|
-
};
|
|
13
|
-
model = Array.from(this.querySelectorAll('scene-property')).reduce((model, property) => {
|
|
14
|
-
let value = property.value;
|
|
15
|
-
if (property.name) {
|
|
16
|
-
switch (property.type) {
|
|
17
|
-
case 'number':
|
|
18
|
-
value = Number(value);
|
|
19
|
-
break;
|
|
20
|
-
case 'boolean':
|
|
21
|
-
value = Boolean(value);
|
|
22
|
-
break;
|
|
23
|
-
default:
|
|
24
|
-
}
|
|
25
|
-
model[property.name] = value;
|
|
26
|
-
}
|
|
27
|
-
return model;
|
|
28
|
-
}, model);
|
|
29
|
-
return model;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
__decorate([
|
|
33
|
-
property({ type: String })
|
|
34
|
-
], SceneLayer.prototype, "type", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
property({ type: String })
|
|
37
|
-
], SceneLayer.prototype, "text", void 0);
|
|
38
|
-
//# sourceMappingURL=scene-layer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scene-layer.js","sourceRoot":"","sources":["../../../../src/modeller/scene-viewer/scene-layer.ts"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;IAIhD,MAAM;QACJ,OAAO,IAAI,CAAA,yCAAyC,CAAA;IACtD,CAAC;IAED,QAAQ;QACN,IAAI,KAAK,GAAG;YACV,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAA;QAED,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,QAAa,EAAE,EAAE;YAC/F,IAAI,KAAK,GAAQ,QAAQ,CAAC,KAAK,CAAA;YAE/B,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACjB,QAAQ,QAAQ,CAAC,IAAI,EAAE;oBACrB,KAAK,QAAQ;wBACX,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;wBACrB,MAAK;oBACP,KAAK,SAAS;wBACZ,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;wBACtB,MAAK;oBACP,QAAQ;iBACT;gBAED,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;aAC7B;YAED,OAAO,KAAK,CAAA;QACd,CAAC,EAAE,KAAK,CAAC,CAAA;QAET,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAlC6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAc","sourcesContent":["import './scene-property'\n\nimport { LitElement, html } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nexport default class SceneLayer extends LitElement {\n @property({ type: String }) type?: String\n @property({ type: String }) text?: String\n\n render() {\n return html` <slot select=\"scene-property\"></slot> `\n }\n\n getModel() {\n let model = {\n type: this.type\n }\n\n model = Array.from(this.querySelectorAll('scene-property')).reduce((model: any, property: any) => {\n let value: any = property.value\n\n if (property.name) {\n switch (property.type) {\n case 'number':\n value = Number(value)\n break\n case 'boolean':\n value = Boolean(value)\n break\n default:\n }\n\n model[property.name] = value\n }\n\n return model\n }, model)\n\n return model\n }\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { LitElement } from 'lit';
|
|
4
|
-
export default class OxSceneProperty extends LitElement {
|
|
5
|
-
}
|
|
6
|
-
__decorate([
|
|
7
|
-
property({ type: String })
|
|
8
|
-
], OxSceneProperty.prototype, "name", void 0);
|
|
9
|
-
__decorate([
|
|
10
|
-
property({ type: String })
|
|
11
|
-
], OxSceneProperty.prototype, "value", void 0);
|
|
12
|
-
__decorate([
|
|
13
|
-
property({ type: String })
|
|
14
|
-
], OxSceneProperty.prototype, "type", void 0);
|
|
15
|
-
//# sourceMappingURL=scene-property.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scene-property.js","sourceRoot":"","sources":["../../../../src/modeller/scene-viewer/scene-property.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAEhC,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU;CAItD;AAH6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc","sourcesContent":["import { property } from 'lit/decorators.js'\n\nimport { LitElement } from 'lit'\n\nexport default class OxSceneProperty extends LitElement {\n @property({ type: String }) name!: string\n @property({ type: String }) value!: string\n @property({ type: String }) type!: string\n}\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import './scene-layer';
|
|
2
|
-
import './scene-handler';
|
|
3
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
4
|
-
import { Component, FITMODE, Model, Properties, Scene, SCENE_MODE } from '@hatiolab/things-scene';
|
|
5
|
-
export default class SceneViewer extends LitElement {
|
|
6
|
-
static styles: import("lit").CSSResult;
|
|
7
|
-
scene: Scene | null;
|
|
8
|
-
model?: Model;
|
|
9
|
-
mode: SCENE_MODE;
|
|
10
|
-
screenSize: number;
|
|
11
|
-
variables: Properties;
|
|
12
|
-
data: any;
|
|
13
|
-
fit: FITMODE;
|
|
14
|
-
selected: Component[];
|
|
15
|
-
disposeWhenDetached: boolean;
|
|
16
|
-
baseUrl: string;
|
|
17
|
-
provider: any;
|
|
18
|
-
name: string;
|
|
19
|
-
enableInspector: boolean;
|
|
20
|
-
showInspector: boolean;
|
|
21
|
-
private lastOffsetWidth?;
|
|
22
|
-
disconnectedCallback(): void;
|
|
23
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
24
|
-
updated(change: PropertyValues<this>): void;
|
|
25
|
-
_setScene(scene: Scene | null): void;
|
|
26
|
-
_setMode(mode: SCENE_MODE): void;
|
|
27
|
-
_setVariables(variables: Properties): void;
|
|
28
|
-
_setSelected(selected: Component[]): void;
|
|
29
|
-
_disposeScene(): void;
|
|
30
|
-
resize(force: boolean): void;
|
|
31
|
-
_onModelChanged(model?: Model): void;
|
|
32
|
-
_onDisplayChanged(screenSize: string | number): void;
|
|
33
|
-
_onModeChanged(mode: SCENE_MODE): void;
|
|
34
|
-
_onDataChanged(data: any): void;
|
|
35
|
-
_onSelectedChanged(after: Component[]): void;
|
|
36
|
-
_onSceneModeChanged(after: SCENE_MODE): void;
|
|
37
|
-
_onBaseUrlChanged(after: string): void;
|
|
38
|
-
}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import './scene-layer';
|
|
3
|
-
import './scene-handler';
|
|
4
|
-
import { css, html, LitElement } from 'lit';
|
|
5
|
-
import { property } from 'lit/decorators.js';
|
|
6
|
-
import { create as createScene, SCENE_MODE } from '@hatiolab/things-scene';
|
|
7
|
-
export default class SceneViewer extends LitElement {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.scene = null;
|
|
11
|
-
/* Scene Mode - mode 0 : view mode, mode 1 : edit mode, mode 2 : shift mode */
|
|
12
|
-
this.mode = SCENE_MODE.VIEW;
|
|
13
|
-
this.screenSize = 13.3;
|
|
14
|
-
this.variables = {};
|
|
15
|
-
/*
|
|
16
|
-
* 캔바스에 모델을 어떻게 적절하게 보여줄 것인지를 설정한다.
|
|
17
|
-
*
|
|
18
|
-
* @none 가로, 세로 스케일을 1로 고정하고, {0, 0}좌표로 translate시킨다.
|
|
19
|
-
* @both 캔바스에 모델을 꼭 채우도록 가로, 세로 스케일을 조정하고, {0, 0}좌표로 translate시킨다.
|
|
20
|
-
* @width 캔바스의 폭에 모델의 폭을 일치하도록 가로, 세로 스케일을 동일하게 조정하고, {0, 0}좌표로 translate시킨다.
|
|
21
|
-
* @height 캔바스의 높이에 모델의 높이를 일치하도록 가로, 세로 스케일을 동일하게 조정하고, {0, 0}좌표로 translate시킨다.
|
|
22
|
-
* @center 가로, 세로 스케일을 1로 고정하고 모델이 화면의 중앙에 위치하도록 translate시킨다.
|
|
23
|
-
* @ratio 모델의 모든 부분이 캔바스에 최대 크기로 표현될 수 있도록 가로, 세로 동일한 스케일로 조정하고, {0, 0}좌표로 translate시킨다.
|
|
24
|
-
*/
|
|
25
|
-
this.fit = 'none';
|
|
26
|
-
this.selected = [];
|
|
27
|
-
this.disposeWhenDetached = false;
|
|
28
|
-
this.baseUrl = '';
|
|
29
|
-
this.name = 'noname';
|
|
30
|
-
this.enableInspector = true;
|
|
31
|
-
this.showInspector = false;
|
|
32
|
-
}
|
|
33
|
-
disconnectedCallback() {
|
|
34
|
-
super.disconnectedCallback();
|
|
35
|
-
if (this.scene && this.disposeWhenDetached) {
|
|
36
|
-
this._disposeScene();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
render() {
|
|
40
|
-
return html ` <slot></slot> `;
|
|
41
|
-
}
|
|
42
|
-
updated(change) {
|
|
43
|
-
change.has('model') && this._onModelChanged(this.model);
|
|
44
|
-
change.has('mode') && this._onModeChanged(this.mode);
|
|
45
|
-
change.has('screenSize') && this._onDisplayChanged(this.screenSize);
|
|
46
|
-
change.has('data') && this._onDataChanged(this.data);
|
|
47
|
-
change.has('baseUrl') && this._onBaseUrlChanged(this.baseUrl);
|
|
48
|
-
}
|
|
49
|
-
_setScene(scene) {
|
|
50
|
-
this.scene = scene;
|
|
51
|
-
this.dispatchEvent(new CustomEvent('scene-changed', {
|
|
52
|
-
bubbles: true,
|
|
53
|
-
composed: true,
|
|
54
|
-
detail: { value: scene }
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
_setMode(mode) {
|
|
58
|
-
this.mode = mode;
|
|
59
|
-
this.dispatchEvent(new CustomEvent('mode-changed', {
|
|
60
|
-
bubbles: true,
|
|
61
|
-
composed: true,
|
|
62
|
-
detail: { value: mode }
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
_setVariables(variables) {
|
|
66
|
-
this.variables = variables;
|
|
67
|
-
this.dispatchEvent(new CustomEvent('variables-changed', {
|
|
68
|
-
bubbles: true,
|
|
69
|
-
composed: true,
|
|
70
|
-
detail: { value: variables }
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
_setSelected(selected) {
|
|
74
|
-
this.selected = selected;
|
|
75
|
-
this.dispatchEvent(new CustomEvent('selected-changed', {
|
|
76
|
-
bubbles: true,
|
|
77
|
-
composed: true,
|
|
78
|
-
detail: { value: selected }
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
_disposeScene() {
|
|
82
|
-
if (this.scene) {
|
|
83
|
-
this.scene.off('selected', this._onSelectedChanged, this);
|
|
84
|
-
this.scene.off('mode', this._onSceneModeChanged, this);
|
|
85
|
-
if (this.provider) {
|
|
86
|
-
this.scene.release && this.scene.release();
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
this.scene.dispose();
|
|
90
|
-
}
|
|
91
|
-
this._setScene(null);
|
|
92
|
-
this._setSelected([]);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
resize(force) {
|
|
96
|
-
if (typeof this.scene == 'object') {
|
|
97
|
-
if (force || this.fit === 'both' || Math.abs(this.offsetWidth - (this.lastOffsetWidth || 0)) >= 1) {
|
|
98
|
-
requestAnimationFrame(() => {
|
|
99
|
-
if (this.scene) {
|
|
100
|
-
this.scene.resize();
|
|
101
|
-
this.scene.fit(this.fit);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
this.lastOffsetWidth = this.offsetWidth;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
_onModelChanged(model) {
|
|
109
|
-
this._disposeScene();
|
|
110
|
-
if (!model) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const layers = Array.from(this.querySelectorAll('scene-layer')).map(layer => layer.getModel());
|
|
114
|
-
const handlers = Array.from(this.querySelectorAll('scene-handler')).map(handler => handler.getAttribute('type'));
|
|
115
|
-
this._setScene(createScene({
|
|
116
|
-
target: this,
|
|
117
|
-
model: JSON.parse(JSON.stringify(model)),
|
|
118
|
-
layers,
|
|
119
|
-
handlers,
|
|
120
|
-
mode: this.mode,
|
|
121
|
-
refProvider: this.provider
|
|
122
|
-
}));
|
|
123
|
-
if (this.provider) {
|
|
124
|
-
this.provider.add(this.name, this.scene);
|
|
125
|
-
}
|
|
126
|
-
this.scene.screen = this.screenSize;
|
|
127
|
-
/* 이 컴포넌트의 폭이 값을 가지고 있으면 - 화면상에 자리를 잡고 보여지고 있음을 의미한다.
|
|
128
|
-
* 이 때는 정상적으로 그려주고,
|
|
129
|
-
* 그렇지 않으면, 다음 Resize Handling시에 처리하도록 한다.
|
|
130
|
-
*/
|
|
131
|
-
this.resize(true);
|
|
132
|
-
this._setVariables(model.variables || this.scene.variables);
|
|
133
|
-
this.scene.on('selected', this._onSelectedChanged, this);
|
|
134
|
-
this.scene.on('mode', this._onSceneModeChanged, this);
|
|
135
|
-
this._onModeChanged(this.mode);
|
|
136
|
-
this._onDisplayChanged(this.screenSize);
|
|
137
|
-
this._onBaseUrlChanged(this.baseUrl);
|
|
138
|
-
}
|
|
139
|
-
_onDisplayChanged(screenSize) {
|
|
140
|
-
if (!this.scene) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (screenSize) {
|
|
144
|
-
this.scene.screen = parseFloat(String(screenSize));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
_onModeChanged(mode) {
|
|
148
|
-
if (!this.scene) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
this.scene.mode = Number(mode);
|
|
152
|
-
}
|
|
153
|
-
_onDataChanged(data) {
|
|
154
|
-
if (!this.scene || !data) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
this.scene.data = data;
|
|
158
|
-
}
|
|
159
|
-
_onSelectedChanged(after) {
|
|
160
|
-
/*
|
|
161
|
-
scene 컴포넌트의 속성을 속성 에디터(input box등)에서 변경하다가,
|
|
162
|
-
scene의 다른 컴포넌트를 클릭해서 포커스(선택) 컴포넌트를 변경하게되면,
|
|
163
|
-
속성 에디터(input box등)의 value change 이벤트의 처리와 충돌(레이스)하게된다.
|
|
164
|
-
|
|
165
|
-
기대하는 순서는 먼저 속성 에디터의 value change 이벤트를 처리한 후에,
|
|
166
|
-
selected 이벤트를 처리할 수 있도록 requestAnimationFrame으로 한 프레임을 지연하도록 하였다.
|
|
167
|
-
*/
|
|
168
|
-
requestAnimationFrame(() => {
|
|
169
|
-
this._setSelected(after);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
_onSceneModeChanged(after) {
|
|
173
|
-
if (!this.scene) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
if (this.mode !== after) {
|
|
177
|
-
this._setMode(after);
|
|
178
|
-
}
|
|
179
|
-
if (after === 2) {
|
|
180
|
-
this.style.cursor = 'all-scroll';
|
|
181
|
-
}
|
|
182
|
-
else if (after === 3) {
|
|
183
|
-
this.style.cursor = 'crosshair';
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
this.style.cursor = 'default';
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
_onBaseUrlChanged(after) {
|
|
190
|
-
if (!this.scene) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
this.scene.baseUrl = after;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
SceneViewer.styles = css `
|
|
197
|
-
:host {
|
|
198
|
-
outline: none;
|
|
199
|
-
}
|
|
200
|
-
`;
|
|
201
|
-
__decorate([
|
|
202
|
-
property({ type: Object })
|
|
203
|
-
], SceneViewer.prototype, "scene", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
property({ type: Object })
|
|
206
|
-
], SceneViewer.prototype, "model", void 0);
|
|
207
|
-
__decorate([
|
|
208
|
-
property({ type: Number })
|
|
209
|
-
], SceneViewer.prototype, "mode", void 0);
|
|
210
|
-
__decorate([
|
|
211
|
-
property({ type: Number })
|
|
212
|
-
], SceneViewer.prototype, "screenSize", void 0);
|
|
213
|
-
__decorate([
|
|
214
|
-
property({ type: Object })
|
|
215
|
-
], SceneViewer.prototype, "variables", void 0);
|
|
216
|
-
__decorate([
|
|
217
|
-
property({ type: Object })
|
|
218
|
-
], SceneViewer.prototype, "data", void 0);
|
|
219
|
-
__decorate([
|
|
220
|
-
property({ type: String })
|
|
221
|
-
], SceneViewer.prototype, "fit", void 0);
|
|
222
|
-
__decorate([
|
|
223
|
-
property({ type: Array })
|
|
224
|
-
], SceneViewer.prototype, "selected", void 0);
|
|
225
|
-
__decorate([
|
|
226
|
-
property({ type: Boolean })
|
|
227
|
-
], SceneViewer.prototype, "disposeWhenDetached", void 0);
|
|
228
|
-
__decorate([
|
|
229
|
-
property({ type: String })
|
|
230
|
-
], SceneViewer.prototype, "baseUrl", void 0);
|
|
231
|
-
__decorate([
|
|
232
|
-
property({ type: Object })
|
|
233
|
-
], SceneViewer.prototype, "provider", void 0);
|
|
234
|
-
__decorate([
|
|
235
|
-
property({ type: String })
|
|
236
|
-
], SceneViewer.prototype, "name", void 0);
|
|
237
|
-
__decorate([
|
|
238
|
-
property({ type: Boolean })
|
|
239
|
-
], SceneViewer.prototype, "enableInspector", void 0);
|
|
240
|
-
__decorate([
|
|
241
|
-
property({ type: Boolean })
|
|
242
|
-
], SceneViewer.prototype, "showInspector", void 0);
|
|
243
|
-
//# sourceMappingURL=scene-viewer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scene-viewer.js","sourceRoot":"","sources":["../../../../src/modeller/scene-viewer/scene-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,eAAe,CAAA;AACtB,OAAO,iBAAiB,CAAA;AAExB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAa,MAAM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K,EAAE;YACf,OAAM;SACP;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAA;IAC5B,CAAC;;AA5OM,kBAAM,GAAG,GAAG,CAAA;;;;GAIlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAc;AAEb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAmC;AAClC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAWT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAsB;AACtB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAA2B;AACxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAqC;AACrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAAgC;AAC/B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAA+B","sourcesContent":["import './scene-layer'\nimport './scene-handler'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { Component, create as createScene, FITMODE, Model, Properties, Scene, SCENE_MODE } from '@hatiolab/things-scene'\n\nimport SceneLayer from './scene-layer'\n\nexport default class SceneViewer extends LitElement {\n static styles = css`\n :host {\n outline: none;\n }\n `\n\n @property({ type: Object }) scene: Scene | null = null\n @property({ type: Object }) model?: Model\n /* Scene Mode - mode 0 : view mode, mode 1 : edit mode, mode 2 : shift mode */\n @property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.VIEW\n @property({ type: Number }) screenSize: number = 13.3\n @property({ type: Object }) variables: Properties = {}\n @property({ type: Object }) data: any\n /*\n * 캔바스에 모델을 어떻게 적절하게 보여줄 것인지를 설정한다.\n *\n * @none 가로, 세로 스케일을 1로 고정하고, {0, 0}좌표로 translate시킨다.\n * @both 캔바스에 모델을 꼭 채우도록 가로, 세로 스케일을 조정하고, {0, 0}좌표로 translate시킨다.\n * @width 캔바스의 폭에 모델의 폭을 일치하도록 가로, 세로 스케일을 동일하게 조정하고, {0, 0}좌표로 translate시킨다.\n * @height 캔바스의 높이에 모델의 높이를 일치하도록 가로, 세로 스케일을 동일하게 조정하고, {0, 0}좌표로 translate시킨다.\n * @center 가로, 세로 스케일을 1로 고정하고 모델이 화면의 중앙에 위치하도록 translate시킨다.\n * @ratio 모델의 모든 부분이 캔바스에 최대 크기로 표현될 수 있도록 가로, 세로 동일한 스케일로 조정하고, {0, 0}좌표로 translate시킨다.\n */\n @property({ type: String }) fit: FITMODE = 'none'\n @property({ type: Array }) selected: Component[] = []\n @property({ type: Boolean }) disposeWhenDetached: boolean = false\n @property({ type: String }) baseUrl: string = ''\n @property({ type: Object }) provider: any\n @property({ type: String }) name: string = 'noname'\n @property({ type: Boolean }) enableInspector: boolean = true\n @property({ type: Boolean }) showInspector: boolean = false\n\n private lastOffsetWidth?: number\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n if (this.scene && this.disposeWhenDetached) {\n this._disposeScene()\n }\n }\n\n render() {\n return html` <slot></slot> `\n }\n\n updated(change: PropertyValues<this>) {\n change.has('model') && this._onModelChanged(this.model)\n change.has('mode') && this._onModeChanged(this.mode)\n change.has('screenSize') && this._onDisplayChanged(this.screenSize)\n change.has('data') && this._onDataChanged(this.data)\n change.has('baseUrl') && this._onBaseUrlChanged(this.baseUrl)\n }\n\n _setScene(scene: Scene | null) {\n this.scene = scene\n this.dispatchEvent(\n new CustomEvent('scene-changed', {\n bubbles: true,\n composed: true,\n detail: { value: scene }\n })\n )\n }\n\n _setMode(mode: SCENE_MODE) {\n this.mode = mode\n this.dispatchEvent(\n new CustomEvent('mode-changed', {\n bubbles: true,\n composed: true,\n detail: { value: mode }\n })\n )\n }\n\n _setVariables(variables: Properties) {\n this.variables = variables\n this.dispatchEvent(\n new CustomEvent('variables-changed', {\n bubbles: true,\n composed: true,\n detail: { value: variables }\n })\n )\n }\n\n _setSelected(selected: Component[]) {\n this.selected = selected\n this.dispatchEvent(\n new CustomEvent('selected-changed', {\n bubbles: true,\n composed: true,\n detail: { value: selected }\n })\n )\n }\n\n _disposeScene() {\n if (this.scene) {\n this.scene.off('selected', this._onSelectedChanged, this)\n this.scene.off('mode', this._onSceneModeChanged, this)\n\n if (this.provider) {\n this.scene.release && this.scene.release()\n } else {\n this.scene.dispose()\n }\n\n this._setScene(null)\n this._setSelected([])\n }\n }\n\n resize(force: boolean) {\n if (typeof this.scene == 'object') {\n if (force || this.fit === 'both' || Math.abs(this.offsetWidth - (this.lastOffsetWidth || 0)) >= 1) {\n requestAnimationFrame(() => {\n if (this.scene) {\n this.scene.resize()\n this.scene.fit(this.fit)\n }\n })\n }\n\n this.lastOffsetWidth = this.offsetWidth\n }\n }\n\n _onModelChanged(model?: Model) {\n this._disposeScene()\n\n if (!model) {\n return\n }\n\n const layers = Array.from(this.querySelectorAll('scene-layer')).map(layer => (layer as SceneLayer).getModel())\n\n const handlers = Array.from(this.querySelectorAll('scene-handler')).map(handler => handler.getAttribute('type'))\n\n this._setScene(\n createScene({\n target: this,\n model: JSON.parse(JSON.stringify(model)),\n layers,\n handlers,\n mode: this.mode,\n refProvider: this.provider\n })\n )\n\n if (this.provider) {\n this.provider.add(this.name, this.scene)\n }\n\n this.scene!.screen = this.screenSize\n\n /* 이 컴포넌트의 폭이 값을 가지고 있으면 - 화면상에 자리를 잡고 보여지고 있음을 의미한다.\n * 이 때는 정상적으로 그려주고,\n * 그렇지 않으면, 다음 Resize Handling시에 처리하도록 한다.\n */\n this.resize(true)\n\n this._setVariables(model.variables || this.scene!.variables)\n\n this.scene!.on('selected', this._onSelectedChanged, this)\n this.scene!.on('mode', this._onSceneModeChanged, this)\n\n this._onModeChanged(this.mode)\n this._onDisplayChanged(this.screenSize)\n this._onBaseUrlChanged(this.baseUrl)\n }\n\n _onDisplayChanged(screenSize: string | number) {\n if (!this.scene) {\n return\n }\n\n if (screenSize) {\n this.scene.screen = parseFloat(String(screenSize))\n }\n }\n\n _onModeChanged(mode: SCENE_MODE) {\n if (!this.scene) {\n return\n }\n this.scene.mode = Number(mode)\n }\n\n _onDataChanged(data: any) {\n if (!this.scene || !data) {\n return\n }\n\n this.scene.data = data\n }\n\n _onSelectedChanged(after: Component[]) {\n /*\n scene 컴포넌트의 속성을 속성 에디터(input box등)에서 변경하다가,\n scene의 다른 컴포넌트를 클릭해서 포커스(선택) 컴포넌트를 변경하게되면,\n 속성 에디터(input box등)의 value change 이벤트의 처리와 충돌(레이스)하게된다.\n \n 기대하는 순서는 먼저 속성 에디터의 value change 이벤트를 처리한 후에,\n selected 이벤트를 처리할 수 있도록 requestAnimationFrame으로 한 프레임을 지연하도록 하였다.\n */\n requestAnimationFrame(() => {\n this._setSelected(after)\n })\n }\n\n _onSceneModeChanged(after: SCENE_MODE) {\n if (!this.scene) {\n return\n }\n\n if (this.mode !== after) {\n this._setMode(after)\n }\n\n if (after === 2) {\n this.style.cursor = 'all-scroll'\n } else if (after === 3) {\n this.style.cursor = 'crosshair'\n } else {\n this.style.cursor = 'default'\n }\n }\n\n _onBaseUrlChanged(after: string) {\n if (!this.scene) {\n return\n }\n\n this.scene.baseUrl = after\n }\n}\n"]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import './scene-property'
|
|
2
|
-
|
|
3
|
-
import { LitElement, html } from 'lit'
|
|
4
|
-
import { property } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
export default class SceneHandler extends LitElement {
|
|
7
|
-
@property({ type: String }) type!: string
|
|
8
|
-
@property({ type: Object }) model!: {
|
|
9
|
-
type: Object
|
|
10
|
-
notify: true
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
render() {
|
|
14
|
-
return html` <slot select="scene-property"></slot> `
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
connectedCallback() {
|
|
18
|
-
super.connectedCallback()
|
|
19
|
-
|
|
20
|
-
let model: any = {
|
|
21
|
-
type: this.type
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
model = Array.from(this.querySelectorAll('scene-property')).reduce((model: any, property: any) => {
|
|
25
|
-
const name = property.getAttribute('name')
|
|
26
|
-
const value = property.getAttribute('value')
|
|
27
|
-
|
|
28
|
-
if (name) {
|
|
29
|
-
model[name] = value
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return model
|
|
33
|
-
}, model)
|
|
34
|
-
|
|
35
|
-
model.__host__ = this
|
|
36
|
-
|
|
37
|
-
this.model = model
|
|
38
|
-
}
|
|
39
|
-
}
|