@operato/scene-legend 1.2.46 → 1.2.49
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -0
- package/package.json +2 -2
- package/dist/editors/property-editor-gltf-info.d.ts +0 -14
- package/dist/editors/property-editor-gltf-info.js +0 -130
- package/dist/editors/property-editor-gltf-info.js.map +0 -1
- package/dist/templates/legend copy.d.ts +0 -18
- package/dist/templates/legend copy.js +0 -19
- package/dist/templates/legend copy.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.2.49](https://github.com/things-scene/operato-scene/compare/v1.2.48...v1.2.49) (2023-06-26)
|
7
|
+
|
8
|
+
|
9
|
+
### :bug: Bug Fix
|
10
|
+
|
11
|
+
* missing .npmignore ([61ba4f2](https://github.com/things-scene/operato-scene/commit/61ba4f2ae22a865d700a971d62eb01f950c34d0e))
|
12
|
+
|
13
|
+
|
14
|
+
|
6
15
|
## [1.2.46](https://github.com/things-scene/operato-scene/compare/v1.2.45...v1.2.46) (2023-06-10)
|
7
16
|
|
8
17
|
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@operato/scene-legend",
|
3
3
|
"description": "Legend component for things-scene.",
|
4
4
|
"author": "heartyoh",
|
5
|
-
"version": "1.2.
|
5
|
+
"version": "1.2.49",
|
6
6
|
"main": "dist/index.js",
|
7
7
|
"module": "dist/index.js",
|
8
8
|
"license": "MIT",
|
@@ -58,5 +58,5 @@
|
|
58
58
|
"prettier --write"
|
59
59
|
]
|
60
60
|
},
|
61
|
-
"gitHead": "
|
61
|
+
"gitHead": "f91b0d45641177ae36015ebd23b780a48715349b"
|
62
62
|
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import '@operato/i18n/ox-i18n.js';
|
2
|
-
import { PropertyValues, TemplateResult } from 'lit';
|
3
|
-
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor';
|
4
|
-
import { Component } from '@hatiolab/things-scene';
|
5
|
-
export default class GLTFInfoEditor extends OxPropertyEditor {
|
6
|
-
static styles: import("lit").CSSResult[];
|
7
|
-
src?: string;
|
8
|
-
width: number;
|
9
|
-
height: number;
|
10
|
-
depth: number;
|
11
|
-
editorTemplate(value: any, spec: PropertySpec): TemplateResult;
|
12
|
-
updated(changes: PropertyValues<this>): void;
|
13
|
-
fetchSourceInfo(component: Component, src: string): Promise<unknown>;
|
14
|
-
}
|
@@ -1,130 +0,0 @@
|
|
1
|
-
import { __decorate } from "tslib";
|
2
|
-
import '@operato/i18n/ox-i18n.js';
|
3
|
-
import { css, html } from 'lit';
|
4
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
5
|
-
import { OxPropertyEditor } from '@operato/property-editor';
|
6
|
-
import * as THREE from 'three';
|
7
|
-
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
|
8
|
-
let GLTFInfoEditor = class GLTFInfoEditor extends OxPropertyEditor {
|
9
|
-
constructor() {
|
10
|
-
super(...arguments);
|
11
|
-
this.width = 0;
|
12
|
-
this.height = 0;
|
13
|
-
this.depth = 0;
|
14
|
-
}
|
15
|
-
editorTemplate(value, spec) {
|
16
|
-
const valid = this.width && this.height && this.depth;
|
17
|
-
var property = spec.property || {};
|
18
|
-
var { action } = property;
|
19
|
-
return html `
|
20
|
-
<fieldset fullwidth>
|
21
|
-
<legend><ox-i18n msgid="label.gltf-info">GLTF info.</ox-i18n></legend>
|
22
|
-
|
23
|
-
<div>
|
24
|
-
<div info>
|
25
|
-
<div label>[W x H x D] :</div>
|
26
|
-
${valid
|
27
|
-
? html ` <div value>${this.width} x ${this.height} x ${this.depth}</div>
|
28
|
-
<mwc-icon-button
|
29
|
-
icon="autorenew"
|
30
|
-
@click=${(e) => {
|
31
|
-
this.dispatchEvent(new CustomEvent('i-need-selected', {
|
32
|
-
bubbles: true,
|
33
|
-
composed: true,
|
34
|
-
detail: {
|
35
|
-
callback: (selected) => {
|
36
|
-
typeof action === 'function' &&
|
37
|
-
action(selected[0], {
|
38
|
-
width: this.width,
|
39
|
-
height: this.height,
|
40
|
-
depth: this.depth
|
41
|
-
});
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}));
|
45
|
-
}}
|
46
|
-
></mwc-icon-button>`
|
47
|
-
: html ` <div></div> `}
|
48
|
-
</div>
|
49
|
-
</div>
|
50
|
-
</fieldset>
|
51
|
-
`;
|
52
|
-
}
|
53
|
-
updated(changes) {
|
54
|
-
if (changes.has('src')) {
|
55
|
-
this.dispatchEvent(new CustomEvent('i-need-selected', {
|
56
|
-
bubbles: true,
|
57
|
-
composed: true,
|
58
|
-
detail: {
|
59
|
-
callback: async (selected) => {
|
60
|
-
await this.fetchSourceInfo(selected[0], this.src);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}));
|
64
|
-
}
|
65
|
-
}
|
66
|
-
async fetchSourceInfo(component, src) {
|
67
|
-
if (!src || !src.trim()) {
|
68
|
-
return;
|
69
|
-
}
|
70
|
-
try {
|
71
|
-
const path = component.app.url(src);
|
72
|
-
let gltfLoader = new GLTFLoader();
|
73
|
-
gltfLoader.setCrossOrigin('use-credentials');
|
74
|
-
return new Promise((resolve) => {
|
75
|
-
gltfLoader.load(path, gltf => {
|
76
|
-
var box = new THREE.Box3().setFromObject(gltf.scene);
|
77
|
-
var { x, y, z } = box.getSize(new THREE.Vector3());
|
78
|
-
this.width = Math.floor(x);
|
79
|
-
this.depth = Math.floor(y);
|
80
|
-
this.height = Math.floor(z);
|
81
|
-
resolve();
|
82
|
-
});
|
83
|
-
});
|
84
|
-
}
|
85
|
-
catch (e) {
|
86
|
-
console.error(e);
|
87
|
-
return;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
};
|
91
|
-
GLTFInfoEditor.styles = [
|
92
|
-
...OxPropertyEditor.styles,
|
93
|
-
css `
|
94
|
-
div[info] {
|
95
|
-
display: flex;
|
96
|
-
flex-direction: row;
|
97
|
-
font-size: 12px;
|
98
|
-
}
|
99
|
-
|
100
|
-
div[info] * {
|
101
|
-
align-self: center;
|
102
|
-
}
|
103
|
-
|
104
|
-
div[info] title {
|
105
|
-
font-weight: bold;
|
106
|
-
}
|
107
|
-
|
108
|
-
div[info] mwc-icon-button {
|
109
|
-
margin-left: auto;
|
110
|
-
--mdc-icon-button-size: 24px;
|
111
|
-
}
|
112
|
-
`
|
113
|
-
];
|
114
|
-
__decorate([
|
115
|
-
property({ type: Number })
|
116
|
-
], GLTFInfoEditor.prototype, "src", void 0);
|
117
|
-
__decorate([
|
118
|
-
state()
|
119
|
-
], GLTFInfoEditor.prototype, "width", void 0);
|
120
|
-
__decorate([
|
121
|
-
state()
|
122
|
-
], GLTFInfoEditor.prototype, "height", void 0);
|
123
|
-
__decorate([
|
124
|
-
state()
|
125
|
-
], GLTFInfoEditor.prototype, "depth", void 0);
|
126
|
-
GLTFInfoEditor = __decorate([
|
127
|
-
customElement('property-editor-gltf-info')
|
128
|
-
], GLTFInfoEditor);
|
129
|
-
export default GLTFInfoEditor;
|
130
|
-
//# sourceMappingURL=property-editor-gltf-info.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"property-editor-gltf-info.js","sourceRoot":"","sources":["../../src/editors/property-editor-gltf-info.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,gBAAgB,EAAgB,MAAM,0BAA0B,CAAA;AAGzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAGlE,IAAqB,cAAc,GAAnC,MAAqB,cAAe,SAAQ,gBAAgB;IAA5D;;QA2BW,UAAK,GAAW,CAAC,CAAA;Q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,CAAA;YAChB,OAAM;SACP;IACH,CAAC;;AArHM,qBAAM,GAAG;IACd,GAAG,gBAAgB,CAAC,MAAM;IAC1B,GAAG,CAAA;;;;;;;;;;;;;;;;;;;KAmBF;CACF,AAtBY,CAsBZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAa;AAE/B;IAAR,KAAK,EAAE;6CAAkB;AACjB;IAAR,KAAK,EAAE;8CAAmB;AAClB;IAAR,KAAK,EAAE;6CAAkB;AA7BP,cAAc;IADlC,aAAa,CAAC,2BAA2B,CAAC;GACtB,cAAc,CAuHlC;eAvHoB,cAAc","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { css, html, PropertyValues, TemplateResult } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { OxPropertyEditor, PropertySpec } from '@operato/property-editor'\nimport { Component } from '@hatiolab/things-scene'\n\nimport * as THREE from 'three'\nimport { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'\n\n@customElement('property-editor-gltf-info')\nexport default class GLTFInfoEditor extends OxPropertyEditor {\n static styles = [\n ...OxPropertyEditor.styles,\n css`\n div[info] {\n display: flex;\n flex-direction: row;\n font-size: 12px;\n }\n\n div[info] * {\n align-self: center;\n }\n\n div[info] title {\n font-weight: bold;\n }\n\n div[info] mwc-icon-button {\n margin-left: auto;\n --mdc-icon-button-size: 24px;\n }\n `\n ]\n\n @property({ type: Number }) src?: string\n\n @state() width: number = 0\n @state() height: number = 0\n @state() depth: number = 0\n\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n const valid = this.width && this.height && this.depth\n\n var property = spec.property || {}\n var { action } = property\n\n return html`\n <fieldset fullwidth>\n <legend><ox-i18n msgid=\"label.gltf-info\">GLTF info.</ox-i18n></legend>\n\n <div>\n <div info>\n <div label>[W x H x D] :</div>\n ${valid\n ? html` <div value>${this.width} x ${this.height} x ${this.depth}</div>\n <mwc-icon-button\n icon=\"autorenew\"\n @click=${(e: MouseEvent) => {\n this.dispatchEvent(\n new CustomEvent('i-need-selected', {\n bubbles: true,\n composed: true,\n detail: {\n callback: (selected: any[]) => {\n typeof action === 'function' &&\n action(selected[0], {\n width: this.width,\n height: this.height,\n depth: this.depth\n })\n }\n }\n })\n )\n }}\n ></mwc-icon-button>`\n : html` <div></div> `}\n </div>\n </div>\n </fieldset>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('src')) {\n this.dispatchEvent(\n new CustomEvent('i-need-selected', {\n bubbles: true,\n composed: true,\n detail: {\n callback: async (selected: any[]) => {\n await this.fetchSourceInfo(selected[0], this.src!)\n }\n }\n })\n )\n }\n }\n\n async fetchSourceInfo(component: Component, src: string) {\n if (!src || !src.trim()) {\n return\n }\n\n try {\n const path = component.app.url(src)\n\n let gltfLoader = new GLTFLoader()\n\n gltfLoader.setCrossOrigin('use-credentials')\n\n return new Promise((resolve: any) => {\n gltfLoader.load(path, gltf => {\n var box = new THREE.Box3().setFromObject(gltf.scene)\n var { x, y, z } = box.getSize(new THREE.Vector3())\n\n this.width = Math.floor(x)\n this.depth = Math.floor(y)\n this.height = Math.floor(z)\n\n resolve()\n })\n })\n } catch (e) {\n console.error(e)\n return\n }\n }\n}\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
declare const _default: {
|
2
|
-
type: string;
|
3
|
-
description: string;
|
4
|
-
group: string;
|
5
|
-
icon: string;
|
6
|
-
model: {
|
7
|
-
type: string;
|
8
|
-
left: number;
|
9
|
-
top: number;
|
10
|
-
width: number;
|
11
|
-
height: number;
|
12
|
-
fillStyle: string;
|
13
|
-
direction: string;
|
14
|
-
strokeStyle: string;
|
15
|
-
lineWidth: number;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
export default _default;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
const icon = new URL('../../icons/legend.png', import.meta.url).href;
|
2
|
-
export default {
|
3
|
-
type: 'legend',
|
4
|
-
description: 'legend for visualizer',
|
5
|
-
group: 'warehouse' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
6
|
-
icon,
|
7
|
-
model: {
|
8
|
-
type: 'legend',
|
9
|
-
left: 100,
|
10
|
-
top: 100,
|
11
|
-
width: 200,
|
12
|
-
height: 150,
|
13
|
-
fillStyle: '#efefef',
|
14
|
-
direction: 'vertical',
|
15
|
-
strokeStyle: 'rgba(0, 0, 0, 0.3)',
|
16
|
-
lineWidth: 1
|
17
|
-
}
|
18
|
-
};
|
19
|
-
//# sourceMappingURL=legend%20copy.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"legend copy.js","sourceRoot":"","sources":["../../src/templates/legend copy.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEpE,eAAe;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uBAAuB;IACpC,KAAK,EAAE,WAAW,CAAC,gGAAgG;IACnH,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,UAAU;QACrB,WAAW,EAAE,oBAAoB;QACjC,SAAS,EAAE,CAAC;KACb;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/legend.png', import.meta.url).href\n\nexport default {\n type: 'legend',\n description: 'legend for visualizer',\n group: 'warehouse' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,\n icon,\n model: {\n type: 'legend',\n left: 100,\n top: 100,\n width: 200,\n height: 150,\n fillStyle: '#efefef',\n direction: 'vertical',\n strokeStyle: 'rgba(0, 0, 0, 0.3)',\n lineWidth: 1\n }\n}\n"]}
|