@operato/scene-visualizer 10.0.0-beta.1 → 10.0.0-beta.2
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 +2 -2
- package/dist/banner.d.ts +0 -244
- package/dist/banner.js +0 -75
- package/dist/banner.js.map +0 -1
- package/dist/camera.d.ts +0 -249
- package/dist/camera.js +0 -107
- package/dist/camera.js.map +0 -1
- package/dist/cube.d.ts +0 -241
- package/dist/cube.js +0 -37
- package/dist/cube.js.map +0 -1
- package/dist/cylinder.d.ts +0 -9
- package/dist/cylinder.js +0 -37
- package/dist/cylinder.js.map +0 -1
- package/dist/ellipse.d.ts +0 -5
- package/dist/ellipse.js +0 -20
- package/dist/ellipse.js.map +0 -1
- package/dist/gltf-object.d.ts +0 -249
- package/dist/gltf-object.js +0 -103
- package/dist/gltf-object.js.map +0 -1
- package/dist/html-overlay-element.d.ts +0 -1
- package/dist/html-overlay-element.js +0 -8
- package/dist/html-overlay-element.js.map +0 -1
- package/dist/light.d.ts +0 -14
- package/dist/light.js +0 -134
- package/dist/light.js.map +0 -1
- package/dist/polygon.d.ts +0 -17
- package/dist/polygon.js +0 -62
- package/dist/polygon.js.map +0 -1
- package/dist/rect.d.ts +0 -5
- package/dist/rect.js +0 -34
- package/dist/rect.js.map +0 -1
- package/dist/scene/component.d.ts +0 -1
- package/dist/scene/component.js +0 -29
- package/dist/scene/component.js.map +0 -1
- package/dist/sphere.d.ts +0 -9
- package/dist/sphere.js +0 -37
- package/dist/sphere.js.map +0 -1
- package/dist/sprite.d.ts +0 -238
- package/dist/sprite.js +0 -27
- package/dist/sprite.js.map +0 -1
- package/dist/text.d.ts +0 -1
- package/dist/text.js +0 -7
- package/dist/text.js.map +0 -1
- package/dist/three-container-editor.d.ts +0 -22
- package/dist/three-container-editor.js +0 -132
- package/dist/three-container-editor.js.map +0 -1
- package/dist/three-container.d.ts +0 -61
- package/dist/three-container.js +0 -371
- package/dist/three-container.js.map +0 -1
- package/dist/three-controls.d.ts +0 -111
- package/dist/three-controls.js +0 -414
- package/dist/three-controls.js.map +0 -1
- package/dist/three-layout.d.ts +0 -8
- package/dist/three-layout.js +0 -20
- package/dist/three-layout.js.map +0 -1
- package/dist/three-space.d.ts +0 -8
- package/dist/three-space.js +0 -58
- package/dist/three-space.js.map +0 -1
- package/dist/threed/common.d.ts +0 -22
- package/dist/threed/common.js +0 -19
- package/dist/threed/common.js.map +0 -1
- package/dist/threed/floor/floor.d.ts +0 -3
- package/dist/threed/floor/floor.js +0 -51
- package/dist/threed/floor/floor.js.map +0 -1
- package/dist/threed/html/elements.d.ts +0 -2
- package/dist/threed/html/elements.js +0 -21
- package/dist/threed/html/elements.js.map +0 -1
- package/dist/threed/index.d.ts +0 -16
- package/dist/threed/index.js +0 -17
- package/dist/threed/index.js.map +0 -1
- package/dist/threed/interfaces.d.ts +0 -15
- package/dist/threed/interfaces.js +0 -5
- package/dist/threed/interfaces.js.map +0 -1
- package/dist/threed/managers/camera-manager.d.ts +0 -14
- package/dist/threed/managers/camera-manager.js +0 -60
- package/dist/threed/managers/camera-manager.js.map +0 -1
- package/dist/threed/managers/controls-manager.d.ts +0 -50
- package/dist/threed/managers/controls-manager.js +0 -249
- package/dist/threed/managers/controls-manager.js.map +0 -1
- package/dist/threed/managers/event-manager3d.d.ts +0 -19
- package/dist/threed/managers/event-manager3d.js +0 -76
- package/dist/threed/managers/event-manager3d.js.map +0 -1
- package/dist/threed/managers/index.d.ts +0 -7
- package/dist/threed/managers/index.js +0 -7
- package/dist/threed/managers/index.js.map +0 -1
- package/dist/threed/managers/light-manager.d.ts +0 -7
- package/dist/threed/managers/light-manager.js +0 -37
- package/dist/threed/managers/light-manager.js.map +0 -1
- package/dist/threed/managers/renderer-manager.d.ts +0 -30
- package/dist/threed/managers/renderer-manager.js +0 -120
- package/dist/threed/managers/renderer-manager.js.map +0 -1
- package/dist/threed/managers/scene-manager.d.ts +0 -15
- package/dist/threed/managers/scene-manager.js +0 -48
- package/dist/threed/managers/scene-manager.js.map +0 -1
- package/dist/threed/managers/types.d.ts +0 -36
- package/dist/threed/managers/types.js +0 -2
- package/dist/threed/managers/types.js.map +0 -1
- package/dist/threed/real-object-camera-meshed.d.ts +0 -12
- package/dist/threed/real-object-camera-meshed.js +0 -49
- package/dist/threed/real-object-camera-meshed.js.map +0 -1
- package/dist/threed/real-object-camera.d.ts +0 -9
- package/dist/threed/real-object-camera.js +0 -31
- package/dist/threed/real-object-camera.js.map +0 -1
- package/dist/threed/real-object-dom-element.d.ts +0 -9
- package/dist/threed/real-object-dom-element.js +0 -48
- package/dist/threed/real-object-dom-element.js.map +0 -1
- package/dist/threed/real-object-dummy.d.ts +0 -6
- package/dist/threed/real-object-dummy.js +0 -11
- package/dist/threed/real-object-dummy.js.map +0 -1
- package/dist/threed/real-object-extrude.d.ts +0 -22
- package/dist/threed/real-object-extrude.js +0 -180
- package/dist/threed/real-object-extrude.js.map +0 -1
- package/dist/threed/real-object-gltf.d.ts +0 -16
- package/dist/threed/real-object-gltf.js +0 -105
- package/dist/threed/real-object-gltf.js.map +0 -1
- package/dist/threed/real-object-group.d.ts +0 -5
- package/dist/threed/real-object-group.js +0 -11
- package/dist/threed/real-object-group.js.map +0 -1
- package/dist/threed/real-object-mesh.d.ts +0 -13
- package/dist/threed/real-object-mesh.js +0 -73
- package/dist/threed/real-object-mesh.js.map +0 -1
- package/dist/threed/real-object-plane.d.ts +0 -5
- package/dist/threed/real-object-plane.js +0 -22
- package/dist/threed/real-object-plane.js.map +0 -1
- package/dist/threed/real-object-registry.d.ts +0 -7
- package/dist/threed/real-object-registry.js +0 -32
- package/dist/threed/real-object-registry.js.map +0 -1
- package/dist/threed/real-object-scene.d.ts +0 -21
- package/dist/threed/real-object-scene.js +0 -72
- package/dist/threed/real-object-scene.js.map +0 -1
- package/dist/threed/real-object-sprite-2d.d.ts +0 -14
- package/dist/threed/real-object-sprite-2d.js +0 -45
- package/dist/threed/real-object-sprite-2d.js.map +0 -1
- package/dist/threed/real-object-sprite.d.ts +0 -11
- package/dist/threed/real-object-sprite.js +0 -52
- package/dist/threed/real-object-sprite.js.map +0 -1
- package/dist/threed/real-object-text.d.ts +0 -15
- package/dist/threed/real-object-text.js +0 -66
- package/dist/threed/real-object-text.js.map +0 -1
- package/dist/threed/real-object.d.ts +0 -65
- package/dist/threed/real-object.js +0 -251
- package/dist/threed/real-object.js.map +0 -1
- package/dist/threed/texture/canvas-texture.d.ts +0 -4
- package/dist/threed/texture/canvas-texture.js +0 -49
- package/dist/threed/texture/canvas-texture.js.map +0 -1
- package/dist/threed/texture/text-texture.d.ts +0 -8
- package/dist/threed/texture/text-texture.js +0 -79
- package/dist/threed/texture/text-texture.js.map +0 -1
- package/dist/threed/three-dimensional-container.d.ts +0 -7
- package/dist/threed/three-dimensional-container.js +0 -2
- package/dist/threed/three-dimensional-container.js.map +0 -1
- package/dist/threed/utils/bound-uv-generator.d.ts +0 -16
- package/dist/threed/utils/bound-uv-generator.js +0 -42
- package/dist/threed/utils/bound-uv-generator.js.map +0 -1
- package/dist/threed/utils/dispose.d.ts +0 -2
- package/dist/threed/utils/dispose.js +0 -32
- package/dist/threed/utils/dispose.js.map +0 -1
- package/dist/wall.d.ts +0 -241
- package/dist/wall.js +0 -44
- package/dist/wall.js.map +0 -1
package/dist/rect.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { RealObjectExtrude } from './threed/real-object-extrude.js';
|
|
6
|
-
import { registerRealObjectFactory } from './threed/real-object-registry.js';
|
|
7
|
-
export class RectExtrude extends RealObjectExtrude {
|
|
8
|
-
get shape() {
|
|
9
|
-
var { width, height, round } = this.component.state;
|
|
10
|
-
var shape = new THREE.Shape();
|
|
11
|
-
if (round > 0) {
|
|
12
|
-
var radius = (round / 100) * (width / 2);
|
|
13
|
-
shape.moveTo(radius, 0);
|
|
14
|
-
shape.lineTo(width - radius, 0);
|
|
15
|
-
shape.quadraticCurveTo(width, 0, width, radius);
|
|
16
|
-
shape.lineTo(width, height - radius);
|
|
17
|
-
shape.quadraticCurveTo(width, height, width - radius, height);
|
|
18
|
-
shape.lineTo(radius, height);
|
|
19
|
-
shape.quadraticCurveTo(0, height, 0, height - radius);
|
|
20
|
-
shape.lineTo(0, radius);
|
|
21
|
-
shape.quadraticCurveTo(0, 0, radius, 0);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
shape.moveTo(0, 0);
|
|
25
|
-
shape.lineTo(width, 0);
|
|
26
|
-
shape.lineTo(width, height);
|
|
27
|
-
shape.lineTo(0, height);
|
|
28
|
-
shape.lineTo(0, 0);
|
|
29
|
-
}
|
|
30
|
-
return shape;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
registerRealObjectFactory('rect', (component) => new RectExtrude(component));
|
|
34
|
-
//# sourceMappingURL=rect.js.map
|
package/dist/rect.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../src/rect.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAE5E,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAChD,IAAI,KAAK;QACP,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QACnD,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;QAE7B,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,IAAI,MAAM,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,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import * as THREE from 'three'\nimport { RealObjectExtrude } from './threed/real-object-extrude.js'\nimport { registerRealObjectFactory } from './threed/real-object-registry.js'\n\nexport class RectExtrude extends RealObjectExtrude {\n get shape() {\n var { width, height, round } = this.component.state\n var shape = new THREE.Shape()\n\n if (round > 0) {\n var radius = (round / 100) * (width / 2)\n\n shape.moveTo(radius, 0)\n shape.lineTo(width - radius, 0)\n shape.quadraticCurveTo(width, 0, width, radius)\n shape.lineTo(width, height - radius)\n shape.quadraticCurveTo(width, height, width - radius, height)\n shape.lineTo(radius, height)\n shape.quadraticCurveTo(0, height, 0, height - radius)\n shape.lineTo(0, radius)\n shape.quadraticCurveTo(0, 0, radius, 0)\n } else {\n shape.moveTo(0, 0)\n shape.lineTo(width, 0)\n shape.lineTo(width, height)\n shape.lineTo(0, height)\n shape.lineTo(0, 0)\n }\n\n return shape\n }\n}\n\nregisterRealObjectFactory('rect', (component) => new RectExtrude(component))\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/scene/component.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Component } from '@hatiolab/things-scene';
|
|
2
|
-
import { RealObjectSprite2D } from '../threed/real-object-sprite-2d.js';
|
|
3
|
-
Component.prototype.buildRealObject = function () {
|
|
4
|
-
return new RealObjectSprite2D(this);
|
|
5
|
-
};
|
|
6
|
-
Component.prototype.is3dish = function () {
|
|
7
|
-
return true;
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(Component.prototype, 'realObject', {
|
|
10
|
-
get: function () {
|
|
11
|
-
if (!this.disposed && !this._realObject) {
|
|
12
|
-
this._realObject = this.buildRealObject();
|
|
13
|
-
if (!this._realObject) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
this._realObject.update();
|
|
17
|
-
this._realObject.updateTransform();
|
|
18
|
-
}
|
|
19
|
-
return this._realObject;
|
|
20
|
-
},
|
|
21
|
-
enumerable: false,
|
|
22
|
-
configurable: false
|
|
23
|
-
});
|
|
24
|
-
var oldDispose = Component.prototype.dispose;
|
|
25
|
-
Component.prototype.dispose = function () {
|
|
26
|
-
oldDispose.call(this);
|
|
27
|
-
this.realObject && this.realObject.dispose();
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/scene/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAEvE,SAAS,CAAC,SAAS,CAAC,eAAe,GAAG;IACpC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA;AAED,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG;IAC5B,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,SAAS,EAAE,YAAY,EAAE;IACvD,GAAG,EAAE;QACH,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;YAEzC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAM;YACR,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;YACzB,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAA;QACpC,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IACD,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,KAAK;CACpB,CAAC,CAAA;AAEF,IAAI,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAA;AAE5C,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG;IAC5B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAErB,IAAI,CAAC,UAAU,IAAK,IAAI,CAAC,UAAkB,CAAC,OAAO,EAAE,CAAA;AACvD,CAAC,CAAA","sourcesContent":["import { Component } from '@hatiolab/things-scene'\nimport { RealObject } from '../threed/real-object.js'\nimport { RealObjectSprite2D } from '../threed/real-object-sprite-2d.js'\n\nComponent.prototype.buildRealObject = function (this: Component): RealObject | undefined {\n return new RealObjectSprite2D(this)\n}\n\nComponent.prototype.is3dish = function (this: Component): boolean {\n return true\n}\n\nObject.defineProperty(Component.prototype, 'realObject', {\n get: function (this: Component): RealObject | undefined {\n if (!this.disposed && !this._realObject) {\n this._realObject = this.buildRealObject()\n\n if (!this._realObject) {\n return\n }\n\n this._realObject.update()\n this._realObject.updateTransform()\n }\n\n return this._realObject\n },\n enumerable: false,\n configurable: false\n})\n\nvar oldDispose = Component.prototype.dispose\n\nComponent.prototype.dispose = function () {\n oldDispose.call(this)\n\n this.realObject && (this.realObject as any).dispose()\n}\n"]}
|
package/dist/sphere.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ComponentNature, Ellipse, RealObject, RealObjectMesh } from '@hatiolab/things-scene';
|
|
2
|
-
export declare class Sphere3D extends RealObjectMesh {
|
|
3
|
-
buildGeometry(): void;
|
|
4
|
-
}
|
|
5
|
-
export declare class Sphere extends Ellipse {
|
|
6
|
-
is3dish(): boolean;
|
|
7
|
-
buildRealObject(): RealObject | undefined;
|
|
8
|
-
get nature(): ComponentNature;
|
|
9
|
-
}
|
package/dist/sphere.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
import { Ellipse, sceneComponent, RealObjectMesh } from '@hatiolab/things-scene';
|
|
6
|
-
import * as THREE from 'three';
|
|
7
|
-
const NATURE = {
|
|
8
|
-
mutable: false,
|
|
9
|
-
resizable: true,
|
|
10
|
-
rotatable: true,
|
|
11
|
-
properties: [],
|
|
12
|
-
help: 'scene/component/sphere'
|
|
13
|
-
};
|
|
14
|
-
export class Sphere3D extends RealObjectMesh {
|
|
15
|
-
buildGeometry() {
|
|
16
|
-
var { depth = 0, rx = 0, ry = 0 } = this.component.state;
|
|
17
|
-
let geometry = new THREE.SphereGeometry(1, 32, 16);
|
|
18
|
-
geometry.scale(rx, depth, ry);
|
|
19
|
-
this.object3d.geometry = geometry;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
let Sphere = class Sphere extends Ellipse {
|
|
23
|
-
is3dish() {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
buildRealObject() {
|
|
27
|
-
return new Sphere3D(this);
|
|
28
|
-
}
|
|
29
|
-
get nature() {
|
|
30
|
-
return NATURE;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
Sphere = __decorate([
|
|
34
|
-
sceneComponent('sphere')
|
|
35
|
-
], Sphere);
|
|
36
|
-
export { Sphere };
|
|
37
|
-
//# sourceMappingURL=sphere.js.map
|
package/dist/sphere.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sphere.js","sourceRoot":"","sources":["../src/sphere.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAA8B,OAAO,EAAE,cAAc,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACxH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,wBAAwB;CAC/B,CAAA;AAED,MAAM,OAAO,QAAS,SAAQ,cAAc;IAC1C,aAAa;QACX,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAExD,IAAI,QAAQ,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;QAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;QAE7B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACnC,CAAC;CACF;AAGM,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,OAAO;IACjC,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe;QACb,OAAO,IAAI,QAAQ,CAAC,IAAW,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAZY,MAAM;IADlB,cAAc,CAAC,QAAQ,CAAC;GACZ,MAAM,CAYlB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, ComponentNature, Ellipse, sceneComponent, RealObject, RealObjectMesh } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [],\n help: 'scene/component/sphere'\n}\n\nexport class Sphere3D extends RealObjectMesh {\n buildGeometry() {\n var { depth = 0, rx = 0, ry = 0 } = this.component.state\n\n let geometry = new THREE.SphereGeometry(1, 32, 16)\n geometry.scale(rx, depth, ry)\n\n this.object3d.geometry = geometry\n }\n}\n\n@sceneComponent('sphere')\nexport class Sphere extends Ellipse {\n is3dish() {\n return true\n }\n\n buildRealObject(): RealObject | undefined {\n return new Sphere3D(this as any)\n }\n\n get nature(): ComponentNature {\n return NATURE\n }\n}\n"]}
|
package/dist/sprite.d.ts
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentNature, Shape, RealObject } from '@hatiolab/things-scene';
|
|
2
|
-
declare const Sprite_base: (new (...args: any[]) => {
|
|
3
|
-
contains(x: any, y: any): boolean;
|
|
4
|
-
get path(): {
|
|
5
|
-
x: any;
|
|
6
|
-
y: any;
|
|
7
|
-
}[];
|
|
8
|
-
set path(path: {
|
|
9
|
-
x: any;
|
|
10
|
-
y: any;
|
|
11
|
-
}[]): any;
|
|
12
|
-
get anchors(): {
|
|
13
|
-
name: string;
|
|
14
|
-
position: {
|
|
15
|
-
x: any;
|
|
16
|
-
y: any;
|
|
17
|
-
};
|
|
18
|
-
}[];
|
|
19
|
-
get bounds(): any;
|
|
20
|
-
set bounds(bounds: any): any;
|
|
21
|
-
render(ctx: any): void;
|
|
22
|
-
_app: any;
|
|
23
|
-
_model: any;
|
|
24
|
-
_state: any;
|
|
25
|
-
_delta: any;
|
|
26
|
-
_animation: any;
|
|
27
|
-
_animate: any;
|
|
28
|
-
_parent: any;
|
|
29
|
-
_disposed: any;
|
|
30
|
-
_textHidden: any;
|
|
31
|
-
_text_substitutor: any;
|
|
32
|
-
_value_substitutor: any;
|
|
33
|
-
_mappings: any;
|
|
34
|
-
_realObject: import("@hatiolab/things-scene").IRealObject | undefined;
|
|
35
|
-
_cachedState: any;
|
|
36
|
-
updatedAt: any;
|
|
37
|
-
fontSize: any;
|
|
38
|
-
__cache__: any;
|
|
39
|
-
created(): void;
|
|
40
|
-
added(parent: any): void;
|
|
41
|
-
removed(parent: any): void;
|
|
42
|
-
ready(): Promise<void>;
|
|
43
|
-
touch(): void;
|
|
44
|
-
clearCache(...attrs: any[]): void;
|
|
45
|
-
removeSelf(completely: any): void;
|
|
46
|
-
resetAnimation(): void;
|
|
47
|
-
dispose(): void;
|
|
48
|
-
get nature(): import("@hatiolab/things-scene").ComponentNature;
|
|
49
|
-
get disposed(): boolean;
|
|
50
|
-
isLayer(): boolean;
|
|
51
|
-
isGroup(): boolean;
|
|
52
|
-
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
|
|
53
|
-
isLine(): boolean;
|
|
54
|
-
isRoot(): boolean;
|
|
55
|
-
isRootModel(): boolean;
|
|
56
|
-
is3dish(): boolean;
|
|
57
|
-
isIn3DSpace(): boolean;
|
|
58
|
-
isTemplate(): boolean;
|
|
59
|
-
isHTMLElement(): boolean;
|
|
60
|
-
isConnectable(): boolean;
|
|
61
|
-
isIdentifiable(): boolean;
|
|
62
|
-
isPositionable(): boolean;
|
|
63
|
-
replaceRefids(replaceMap: any): void;
|
|
64
|
-
get(property: any): any;
|
|
65
|
-
set(props: any, propval?: any): any;
|
|
66
|
-
getState(property: any): any;
|
|
67
|
-
setState(props: any, propval?: any): any;
|
|
68
|
-
get model(): any;
|
|
69
|
-
get state(): any;
|
|
70
|
-
get hierarchy(): any;
|
|
71
|
-
get volatile(): never[];
|
|
72
|
-
_applyProps(target: any, props: any, options: any): any;
|
|
73
|
-
move(offset: {
|
|
74
|
-
x: number;
|
|
75
|
-
y: number;
|
|
76
|
-
}, ...args: boolean[]): void;
|
|
77
|
-
symmetryX(x?: number): void;
|
|
78
|
-
symmetryY(y: number): void;
|
|
79
|
-
adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): any;
|
|
80
|
-
adjustRotation(rotation: number, step: boolean): any;
|
|
81
|
-
outline(progress: number): any;
|
|
82
|
-
get center(): import("@hatiolab/things-scene").POINT;
|
|
83
|
-
set center(p: import("@hatiolab/things-scene").POINT): any;
|
|
84
|
-
get location(): import("@hatiolab/things-scene").POINT;
|
|
85
|
-
set location(l: import("@hatiolab/things-scene").POINT): any;
|
|
86
|
-
get rotate(): import("@hatiolab/things-scene").POINT;
|
|
87
|
-
set rotate(r: import("@hatiolab/things-scene").POINT): any;
|
|
88
|
-
get dimension(): import("@hatiolab/things-scene").DIMENSION;
|
|
89
|
-
set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
|
|
90
|
-
get drawPath(): import("@hatiolab/things-scene").POINT[];
|
|
91
|
-
get rotatePoint(): import("@hatiolab/things-scene").POINT;
|
|
92
|
-
get mutable(): boolean;
|
|
93
|
-
get resizable(): boolean;
|
|
94
|
-
get rotatable(): boolean;
|
|
95
|
-
buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
96
|
-
get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
97
|
-
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
98
|
-
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
99
|
-
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
100
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
101
|
-
prepareIf(condition: boolean): void;
|
|
102
|
-
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
103
|
-
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
104
|
-
drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
105
|
-
get strokeStyle(): any;
|
|
106
|
-
set strokeStyle(v: any): any;
|
|
107
|
-
get fillStyle(): any;
|
|
108
|
-
set fillStyle(v: any): any;
|
|
109
|
-
get fontColor(): string;
|
|
110
|
-
set fontColor(v: string): any;
|
|
111
|
-
get rotation(): number;
|
|
112
|
-
set rotation(v: number): any;
|
|
113
|
-
get decorators(): string[];
|
|
114
|
-
get decotag(): string;
|
|
115
|
-
get hidden(): boolean;
|
|
116
|
-
set hidden(v: boolean): any;
|
|
117
|
-
get tag(): string;
|
|
118
|
-
set tag(v: string): any;
|
|
119
|
-
get appendum(): any;
|
|
120
|
-
set appendum(v: any): any;
|
|
121
|
-
defaultTextSubstitutor(): any;
|
|
122
|
-
textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any;
|
|
123
|
-
get font(): string;
|
|
124
|
-
get lineHeight(): number;
|
|
125
|
-
get textSubstitutor(): () => string;
|
|
126
|
-
get text(): string;
|
|
127
|
-
set text(v: string): any;
|
|
128
|
-
get textBounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
129
|
-
get textRotation(): number;
|
|
130
|
-
get textHidden(): boolean;
|
|
131
|
-
set textHidden(v: boolean): any;
|
|
132
|
-
get hasTextProperty(): boolean;
|
|
133
|
-
animate(opts: import("@hatiolab/things-scene/dist-types/animation/interfaces").AnimationConfig): any;
|
|
134
|
-
effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): any;
|
|
135
|
-
serialize(...others: any[]): any;
|
|
136
|
-
trim(): void;
|
|
137
|
-
closeScene(data: any): void;
|
|
138
|
-
delta(attr?: string | object, value?: any): any;
|
|
139
|
-
invalidate(): void;
|
|
140
|
-
get value(): any;
|
|
141
|
-
set value(v: any): any;
|
|
142
|
-
get data(): any;
|
|
143
|
-
set data(v: any): any;
|
|
144
|
-
set tap(v: any): any;
|
|
145
|
-
get mappings(): any[];
|
|
146
|
-
get retention(): number;
|
|
147
|
-
get animation(): import("@hatiolab/things-scene/dist-types/animation/interfaces").AnimationController | undefined;
|
|
148
|
-
get started(): boolean;
|
|
149
|
-
set started(v: boolean): any;
|
|
150
|
-
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
151
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): any;
|
|
152
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any;
|
|
153
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
154
|
-
findAnchor(name: string): any;
|
|
155
|
-
isDescendible(container: Component): any;
|
|
156
|
-
getContext(component?: unknown): any;
|
|
157
|
-
get root(): Component;
|
|
158
|
-
get rootModel(): Component;
|
|
159
|
-
get parent(): Component;
|
|
160
|
-
set parent(v: Component): any;
|
|
161
|
-
get scalable(): boolean;
|
|
162
|
-
get stuck(): boolean;
|
|
163
|
-
get capturable(): boolean;
|
|
164
|
-
get position(): string;
|
|
165
|
-
get origin(): string;
|
|
166
|
-
get offset(): import("@hatiolab/things-scene").POINT;
|
|
167
|
-
get app(): import("@hatiolab/things-scene").ApplicationContext;
|
|
168
|
-
drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
169
|
-
prepareFill(resolve: Function, reject: Function): void;
|
|
170
|
-
prepareFillIf(condition: boolean): void;
|
|
171
|
-
onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
|
|
172
|
-
drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
|
|
173
|
-
mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
|
|
174
|
-
mutatePath(beforeLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, afterLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, context?: any): void;
|
|
175
|
-
access(accessor: string, data: any): any;
|
|
176
|
-
substitute(template: string, data: any): any;
|
|
177
|
-
onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
|
|
178
|
-
onchangeData(after: Record<string, any>, before: Record<string, any>): void;
|
|
179
|
-
buildMappings(): void;
|
|
180
|
-
executeMappings(force?: boolean): void;
|
|
181
|
-
disposeMappings(): void;
|
|
182
|
-
ondropfile(transfered: FileList, files: string[]): void;
|
|
183
|
-
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
184
|
-
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
185
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
186
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
187
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
-
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
193
|
-
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
194
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
195
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
-
on(name: string | object, callback: Function, context?: any): any;
|
|
200
|
-
off(name?: string | object, callback?: Function, context?: any): any;
|
|
201
|
-
once(name: string | object, callback: Function, context?: any): any;
|
|
202
|
-
trigger(name: string, ...args: any[]): any;
|
|
203
|
-
delegate_on(delegator: any): any;
|
|
204
|
-
delegate_off(delegator: any): any;
|
|
205
|
-
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
206
|
-
calculateBounds?(): void;
|
|
207
|
-
oncreate_element?(element: HTMLElement): void;
|
|
208
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
209
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
210
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
211
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
212
|
-
findById(id: string): Component | undefined;
|
|
213
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
214
|
-
findAllById(id: string): Component[];
|
|
215
|
-
resize(): void;
|
|
216
|
-
fit(type?: string): void;
|
|
217
|
-
get components(): Component[] | undefined;
|
|
218
|
-
get layout(): any;
|
|
219
|
-
get auxOverlay(): HTMLElement | undefined;
|
|
220
|
-
get isReady(): boolean;
|
|
221
|
-
get unitScale(): number;
|
|
222
|
-
get selected(): Component[];
|
|
223
|
-
set selected(_v: Component[]): any;
|
|
224
|
-
get focused(): Component | null;
|
|
225
|
-
set focused(_v: Component | null): any;
|
|
226
|
-
get hasSameParentForAllSelected(): boolean;
|
|
227
|
-
set hasSameParentForAllSelected(_v: boolean): any;
|
|
228
|
-
get fitMode(): string | undefined;
|
|
229
|
-
set fitMode(_v: string | undefined): any;
|
|
230
|
-
get element(): HTMLElement | null;
|
|
231
|
-
set element(_v: HTMLElement | null): any;
|
|
232
|
-
}) & typeof Shape;
|
|
233
|
-
export declare class Sprite extends Sprite_base {
|
|
234
|
-
is3dish(): boolean;
|
|
235
|
-
buildRealObject(): RealObject | undefined;
|
|
236
|
-
get nature(): ComponentNature;
|
|
237
|
-
}
|
|
238
|
-
export {};
|
package/dist/sprite.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { __decorate } from "tslib";
|
|
5
|
-
import { RectPath, Shape, sceneComponent, RealObjectSprite2D } from '@hatiolab/things-scene';
|
|
6
|
-
const NATURE = {
|
|
7
|
-
mutable: false,
|
|
8
|
-
resizable: true,
|
|
9
|
-
rotatable: true,
|
|
10
|
-
properties: []
|
|
11
|
-
};
|
|
12
|
-
let Sprite = class Sprite extends RectPath(Shape) {
|
|
13
|
-
is3dish() {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
buildRealObject() {
|
|
17
|
-
return new RealObjectSprite2D(this);
|
|
18
|
-
}
|
|
19
|
-
get nature() {
|
|
20
|
-
return NATURE;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
Sprite = __decorate([
|
|
24
|
-
sceneComponent('sprite')
|
|
25
|
-
], Sprite);
|
|
26
|
-
export { Sprite };
|
|
27
|
-
//# sourceMappingURL=sprite.js.map
|
package/dist/sprite.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sprite.js","sourceRoot":"","sources":["../src/sprite.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAA8B,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAc,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEpI,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,EAAE;CACf,CAAA;AAGM,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACzC,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe;QACb,OAAO,IAAI,kBAAkB,CAAC,IAAW,CAAC,CAAA;IAC5C,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAZY,MAAM;IADlB,cAAc,CAAC,QAAQ,CAAC;GACZ,MAAM,CAYlB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, RectPath, Shape, sceneComponent, RealObject, RealObjectSprite2D } from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: []\n}\n\n@sceneComponent('sprite')\nexport class Sprite extends RectPath(Shape) {\n is3dish(): boolean {\n return true\n }\n\n buildRealObject(): RealObject | undefined {\n return new RealObjectSprite2D(this as any)\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/dist/text.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/text.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { registerRealObjectFactory } from './threed/real-object-registry.js';
|
|
5
|
-
import { RealObjectText } from './threed/real-object-text.js';
|
|
6
|
-
registerRealObjectFactory('text', (component) => new RealObjectText(component));
|
|
7
|
-
//# sourceMappingURL=text.js.map
|
package/dist/text.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAE7D,yBAAyB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { registerRealObjectFactory } from './threed/real-object-registry.js'\nimport { RealObjectText } from './threed/real-object-text.js'\n\nregisterRealObjectFactory('text', (component) => new RealObjectText(component))\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
3
|
-
import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
|
|
4
|
-
export declare class ThreeContainerEditor {
|
|
5
|
-
private ortho;
|
|
6
|
-
private persp;
|
|
7
|
-
private scene;
|
|
8
|
-
private camera;
|
|
9
|
-
private renderer;
|
|
10
|
-
private orbit?;
|
|
11
|
-
private transform?;
|
|
12
|
-
constructor(scene: THREE.Scene, ortho: THREE.OrthographicCamera, persp: THREE.PerspectiveCamera, camera: THREE.Camera, renderer: THREE.Renderer);
|
|
13
|
-
dispose(): void;
|
|
14
|
-
get orbitControls(): OrbitControls;
|
|
15
|
-
get transformControls(): TransformControls;
|
|
16
|
-
attach(target: THREE.Object3D): void;
|
|
17
|
-
detach(): void;
|
|
18
|
-
onKeyDown(e: KeyboardEvent): void;
|
|
19
|
-
onKeyUp(e: KeyboardEvent): void;
|
|
20
|
-
onWindowResize(): void;
|
|
21
|
-
render(): void;
|
|
22
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
3
|
-
import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
|
|
4
|
-
export class ThreeContainerEditor {
|
|
5
|
-
constructor(scene, ortho, persp, camera, renderer) {
|
|
6
|
-
this.ortho = ortho;
|
|
7
|
-
this.persp = persp;
|
|
8
|
-
this.scene = scene;
|
|
9
|
-
this.camera = camera;
|
|
10
|
-
this.renderer = renderer;
|
|
11
|
-
}
|
|
12
|
-
dispose() {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
(_a = this.orbit) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
15
|
-
(_b = this.transform) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
16
|
-
}
|
|
17
|
-
get orbitControls() {
|
|
18
|
-
if (!this.orbit) {
|
|
19
|
-
this.orbit = new OrbitControls(this.camera, this.renderer.domElement);
|
|
20
|
-
this.orbit.update();
|
|
21
|
-
this.orbit.addEventListener('change', this.render);
|
|
22
|
-
}
|
|
23
|
-
return this.orbit;
|
|
24
|
-
}
|
|
25
|
-
get transformControls() {
|
|
26
|
-
if (!this.transform) {
|
|
27
|
-
this.transform = new TransformControls(this.camera, this.renderer.domElement);
|
|
28
|
-
this.transform.addEventListener('change', this.render);
|
|
29
|
-
this.transform.addEventListener('dragging-changed', event => {
|
|
30
|
-
this.orbitControls.enabled = !event.value;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return this.transform;
|
|
34
|
-
}
|
|
35
|
-
attach(target) {
|
|
36
|
-
var _a;
|
|
37
|
-
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.attach(target);
|
|
38
|
-
this.scene.add(this.transformControls);
|
|
39
|
-
}
|
|
40
|
-
detach() {
|
|
41
|
-
this.scene.remove(this.transformControls);
|
|
42
|
-
}
|
|
43
|
-
onKeyDown(e) {
|
|
44
|
-
switch (e.code) {
|
|
45
|
-
case 'KeyQ':
|
|
46
|
-
this.transformControls.setSpace(this.transformControls.space === 'local' ? 'world' : 'local');
|
|
47
|
-
break;
|
|
48
|
-
case 'ShiftLeft':
|
|
49
|
-
case 'ShiftRight':
|
|
50
|
-
this.transformControls.setTranslationSnap(100);
|
|
51
|
-
this.transformControls.setRotationSnap(THREE.MathUtils.degToRad(15));
|
|
52
|
-
this.transformControls.setScaleSnap(0.25);
|
|
53
|
-
break;
|
|
54
|
-
case 'KeyW':
|
|
55
|
-
this.transformControls.setMode('translate');
|
|
56
|
-
break;
|
|
57
|
-
case 'KeyE':
|
|
58
|
-
this.transformControls.setMode('rotate');
|
|
59
|
-
break;
|
|
60
|
-
case 'KeyR':
|
|
61
|
-
this.transformControls.setMode('scale');
|
|
62
|
-
break;
|
|
63
|
-
case 'KeyC':
|
|
64
|
-
const position = this.camera.position.clone();
|
|
65
|
-
this.camera = this.camera.isPerspectiveCamera ? this.ortho : this.persp;
|
|
66
|
-
this.camera.position.copy(position);
|
|
67
|
-
this.orbitControls.object = this.camera;
|
|
68
|
-
this.transformControls.camera = this.camera;
|
|
69
|
-
this.camera.lookAt(this.orbitControls.target.x, this.orbitControls.target.y, this.orbitControls.target.z);
|
|
70
|
-
this.onWindowResize();
|
|
71
|
-
break;
|
|
72
|
-
case 'KeyV':
|
|
73
|
-
const randomFoV = Math.random() + 0.1;
|
|
74
|
-
const randomZoom = Math.random() + 0.1;
|
|
75
|
-
this.persp.fov = randomFoV * 160;
|
|
76
|
-
this.ortho.bottom = -randomFoV * 500;
|
|
77
|
-
this.ortho.top = randomFoV * 500;
|
|
78
|
-
this.persp.zoom = randomZoom * 5;
|
|
79
|
-
this.ortho.zoom = randomZoom * 5;
|
|
80
|
-
this.onWindowResize();
|
|
81
|
-
break;
|
|
82
|
-
case 'Equal':
|
|
83
|
-
case 'NumpadAdd':
|
|
84
|
-
case 'NumpadEqual':
|
|
85
|
-
this.transformControls.setSize(this.transformControls.size + 0.1);
|
|
86
|
-
break;
|
|
87
|
-
case 'Minus': // -
|
|
88
|
-
case 'IntlRo': // _
|
|
89
|
-
case 'NumpadSubtract': // num-
|
|
90
|
-
this.transformControls.setSize(Math.max(this.transformControls.size - 0.1, 0.1));
|
|
91
|
-
break;
|
|
92
|
-
case 'KeyX':
|
|
93
|
-
this.transformControls.showX = !this.transformControls.showX;
|
|
94
|
-
break;
|
|
95
|
-
case 'KeyY':
|
|
96
|
-
this.transformControls.showY = !this.transformControls.showY;
|
|
97
|
-
break;
|
|
98
|
-
case 'KeyZ':
|
|
99
|
-
this.transformControls.showZ = !this.transformControls.showZ;
|
|
100
|
-
break;
|
|
101
|
-
case 'Space':
|
|
102
|
-
this.transformControls.enabled = !this.transformControls.enabled;
|
|
103
|
-
break;
|
|
104
|
-
case 'Esc':
|
|
105
|
-
this.transformControls.reset();
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
onKeyUp(e) {
|
|
110
|
-
switch (e.code) {
|
|
111
|
-
case 'Shift':
|
|
112
|
-
this.transformControls.setTranslationSnap(null);
|
|
113
|
-
this.transformControls.setRotationSnap(null);
|
|
114
|
-
this.transformControls.setScaleSnap(null);
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
onWindowResize() {
|
|
119
|
-
const aspect = window.innerWidth / window.innerHeight;
|
|
120
|
-
this.persp.aspect = aspect;
|
|
121
|
-
this.persp.updateProjectionMatrix();
|
|
122
|
-
this.ortho.left = this.ortho.bottom * aspect;
|
|
123
|
-
this.ortho.right = this.ortho.top * aspect;
|
|
124
|
-
this.ortho.updateProjectionMatrix();
|
|
125
|
-
this.renderer.setSize(window.innerWidth, window.innerHeight);
|
|
126
|
-
this.render();
|
|
127
|
-
}
|
|
128
|
-
render() {
|
|
129
|
-
this.renderer.render(this.scene, this.camera);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=three-container-editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"three-container-editor.js","sourceRoot":"","sources":["../src/three-container-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAA;AAEpF,MAAM,OAAO,oBAAoB;IAW/B,YACE,KAAkB,EAClB,KAA+B,EAC/B,KAA8B,EAC9B,MAAoB,EACpB,QAAwB;QAExB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAElB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,OAAO;;QACL,MAAA,IAAI,CAAC,KAAK,0CAAE,OAAO,EAAE,CAAA;QACrB,MAAA,IAAI,CAAC,SAAS,0CAAE,OAAO,EAAE,CAAA;IAC3B,CAAC;IAED,IAAI,aAAa;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;YACtE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;YAEnB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACpD,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,IAAI,iBAAiB;QACnB,IAAI,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/examples/jsm/controls/OrbitControls.js'\nimport { TransformControls } from 'three/examples/jsm/controls/TransformControls.js'\n\nexport class ThreeContainerEditor {\n private ortho: THREE.OrthographicCamera\n private persp: THREE.PerspectiveCamera\n\n private scene: THREE.Scene\n private camera: THREE.Camera\n private renderer: THREE.Renderer\n\n private orbit?: OrbitControls\n private transform?: TransformControls\n\n constructor(\n scene: THREE.Scene,\n ortho: THREE.OrthographicCamera,\n persp: THREE.PerspectiveCamera,\n camera: THREE.Camera,\n renderer: THREE.Renderer\n ) {\n this.ortho = ortho\n this.persp = persp\n\n this.scene = scene\n this.camera = camera\n this.renderer = renderer\n }\n\n dispose() {\n this.orbit?.dispose()\n this.transform?.dispose()\n }\n\n get orbitControls(): OrbitControls {\n if (!this.orbit) {\n this.orbit = new OrbitControls(this.camera!, this.renderer.domElement)\n this.orbit.update()\n\n this.orbit.addEventListener('change', this.render)\n }\n\n return this.orbit\n }\n\n get transformControls(): TransformControls {\n if (!this.transform) {\n this.transform = new TransformControls(this.camera!, this.renderer.domElement)\n this.transform.addEventListener('change', this.render)\n\n this.transform.addEventListener('dragging-changed', event => {\n this.orbitControls.enabled = !event.value\n })\n }\n\n return this.transform\n }\n\n attach(target: THREE.Object3D) {\n this.transform?.attach(target)\n this.scene.add(this.transformControls)\n }\n\n detach() {\n this.scene.remove(this.transformControls)\n }\n\n onKeyDown(e: KeyboardEvent) {\n switch (e.code) {\n case 'KeyQ':\n this.transformControls.setSpace(this.transformControls.space === 'local' ? 'world' : 'local')\n break\n\n case 'ShiftLeft':\n case 'ShiftRight':\n this.transformControls.setTranslationSnap(100)\n this.transformControls.setRotationSnap(THREE.MathUtils.degToRad(15))\n this.transformControls.setScaleSnap(0.25)\n break\n\n case 'KeyW':\n this.transformControls.setMode('translate')\n break\n\n case 'KeyE':\n this.transformControls.setMode('rotate')\n break\n\n case 'KeyR':\n this.transformControls.setMode('scale')\n break\n\n case 'KeyC':\n const position = this.camera.position.clone()\n\n this.camera = (this.camera as THREE.PerspectiveCamera).isPerspectiveCamera ? this.ortho : this.persp\n this.camera.position.copy(position)\n\n this.orbitControls.object = this.camera\n this.transformControls.camera = this.camera\n\n this.camera.lookAt(this.orbitControls.target.x, this.orbitControls.target.y, this.orbitControls.target.z)\n\n this.onWindowResize()\n\n break\n\n case 'KeyV':\n const randomFoV = Math.random() + 0.1\n const randomZoom = Math.random() + 0.1\n\n this.persp.fov = randomFoV * 160\n this.ortho.bottom = -randomFoV * 500\n this.ortho.top = randomFoV * 500\n\n this.persp.zoom = randomZoom * 5\n this.ortho.zoom = randomZoom * 5\n\n this.onWindowResize()\n\n break\n\n case 'Equal':\n case 'NumpadAdd':\n case 'NumpadEqual':\n this.transformControls.setSize(this.transformControls.size + 0.1)\n break\n\n case 'Minus': // -\n case 'IntlRo': // _\n case 'NumpadSubtract': // num-\n this.transformControls.setSize(Math.max(this.transformControls.size - 0.1, 0.1))\n break\n\n case 'KeyX':\n this.transformControls.showX = !this.transformControls.showX\n break\n\n case 'KeyY':\n this.transformControls.showY = !this.transformControls.showY\n break\n\n case 'KeyZ':\n this.transformControls.showZ = !this.transformControls.showZ\n break\n\n case 'Space':\n this.transformControls.enabled = !this.transformControls.enabled\n break\n\n case 'Esc':\n this.transformControls.reset()\n break\n }\n }\n\n onKeyUp(e: KeyboardEvent) {\n switch (e.code) {\n case 'Shift':\n this.transformControls.setTranslationSnap(null)\n this.transformControls.setRotationSnap(null)\n this.transformControls.setScaleSnap(null)\n break\n }\n }\n\n onWindowResize() {\n const aspect = window.innerWidth / window.innerHeight\n\n this.persp.aspect = aspect\n this.persp.updateProjectionMatrix()\n\n this.ortho.left = this.ortho.bottom * aspect\n this.ortho.right = this.ortho.top * aspect\n this.ortho.updateProjectionMatrix()\n\n this.renderer.setSize(window.innerWidth, window.innerHeight)\n\n this.render()\n }\n\n render() {\n this.renderer.render(this.scene, this.camera)\n }\n}\n"]}
|