@shapediver/viewer.features.drawing-tools 3.3.4 → 3.3.6
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 +12 -13
- package/src/api/implementation/DrawingToolsApi.ts +0 -130
- package/src/api/implementation/restrictions/AbstractRestrictionApi.ts +0 -34
- package/src/api/implementation/restrictions/AbstractSnapRestrictionApi.ts +0 -36
- package/src/api/implementation/restrictions/geometry/GeometryRestrictionApi.ts +0 -56
- package/src/api/implementation/restrictions/plane/PlaneRestrictionApi.ts +0 -70
- package/src/api/implementation/restrictions/plane/snap/AngularRestrictionApi.ts +0 -35
- package/src/api/implementation/restrictions/plane/snap/AxisRestrictionApi.ts +0 -19
- package/src/api/implementation/restrictions/plane/snap/GridRestrictionApi.ts +0 -35
- package/src/api/interfaces/IDrawingToolsApi.ts +0 -98
- package/src/api/interfaces/IRestrictionApi.ts +0 -15
- package/src/api/interfaces/ISnapRestrictionApi.ts +0 -18
- package/src/business/implementation/DrawingToolsManager.ts +0 -618
- package/src/business/implementation/managers/HistoryManager.ts +0 -101
- package/src/business/implementation/managers/TextVisualizationManager.ts +0 -269
- package/src/business/implementation/managers/geometry/GeometryManager.ts +0 -95
- package/src/business/implementation/managers/geometry/GeometryMathManager.ts +0 -289
- package/src/business/implementation/managers/geometry/GeometryState.ts +0 -436
- package/src/business/implementation/managers/geometry/helpers/GeometryManagerHelper.ts +0 -170
- package/src/business/implementation/managers/interaction/EventManager.ts +0 -80
- package/src/business/implementation/managers/interaction/InteractionManager.ts +0 -268
- package/src/business/implementation/managers/interaction/RestrictionManager.ts +0 -132
- package/src/business/implementation/managers/interaction/handlers/DeletionInteractionHandler.ts +0 -48
- package/src/business/implementation/managers/interaction/handlers/InsertionInteractionHandler.ts +0 -149
- package/src/business/implementation/managers/interaction/handlers/MidPointInteractionHandler.ts +0 -127
- package/src/business/implementation/managers/interaction/helpers/InteractionManagerHelper.ts +0 -411
- package/src/business/implementation/managers/interaction/restrictions/AbstractRestriction.ts +0 -99
- package/src/business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction.ts +0 -237
- package/src/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.ts +0 -337
- package/src/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.ts +0 -394
- package/src/business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction.ts +0 -116
- package/src/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.ts +0 -246
- package/src/business/implementation/utils/numberCleaner.ts +0 -5
- package/src/business/interfaces/IDrawingToolsManager.ts +0 -312
- package/src/business/interfaces/IManager.ts +0 -7
- package/src/business/interfaces/IRestriction.ts +0 -63
- package/src/business/interfaces/IRestrictionBase.ts +0 -33
- package/src/business/interfaces/ISnapRestriction.ts +0 -70
- package/src/business/interfaces/events/EventResponseMapping.ts +0 -19
- package/src/business/interfaces/events/IDrawingToolsEvent.ts +0 -16
- package/src/index.ts +0 -72
- package/src/three/CSS2DRenderer.ts +0 -212
- package/tsconfig.json +0 -17
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { IRay } from '@shapediver/viewer.features.interaction';
|
|
2
|
-
import { IRestrictionBase } from './IRestrictionBase';
|
|
3
|
-
import { RestrictionMetaData } from './IRestriction';
|
|
4
|
-
import { vec3 } from 'gl-matrix';
|
|
5
|
-
|
|
6
|
-
// #region Type aliases (1)
|
|
7
|
-
|
|
8
|
-
export type SnapRestrictionProperties = {
|
|
9
|
-
/**
|
|
10
|
-
* If the restriction should be enabled by default.
|
|
11
|
-
*/
|
|
12
|
-
enabled?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* If the enabling or disabling of the restriction is allowed to the end user.
|
|
15
|
-
* If it is not editable, the default value for enabling or disabling the restriction is used.
|
|
16
|
-
*/
|
|
17
|
-
enabledEditable?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Priority of the restriction.
|
|
20
|
-
* The higher the priority, the sooner the restriction is applied.
|
|
21
|
-
* If the priority is the same, the result that is closer to the original point is chosen.
|
|
22
|
-
*/
|
|
23
|
-
priority?: number;
|
|
24
|
-
/**
|
|
25
|
-
* The activation key of the restriction.
|
|
26
|
-
* If the key is not provided, no key is assigned.
|
|
27
|
-
* If the key is provided, the restriction is only active when the key is pressed.
|
|
28
|
-
*/
|
|
29
|
-
activationKey?: string;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// #endregion Type aliases (1)
|
|
33
|
-
|
|
34
|
-
// #region Interfaces (1)
|
|
35
|
-
|
|
36
|
-
export interface ISnapRestriction extends IRestrictionBase {
|
|
37
|
-
// #region Properties (3)
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* If the restriction is actively being used at the moment.
|
|
41
|
-
*/
|
|
42
|
-
active: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* If the enabling or disabling of the restriction is allowed to the end user.
|
|
45
|
-
* If it is not editable, the default value for enabling or disabling the restriction is used.
|
|
46
|
-
*/
|
|
47
|
-
enabledEditable: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* The priority of the restriction.
|
|
50
|
-
*/
|
|
51
|
-
priority: number;
|
|
52
|
-
|
|
53
|
-
// #endregion Properties (3)
|
|
54
|
-
|
|
55
|
-
// #region Public Methods (1)
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Restrict the position of a point.
|
|
59
|
-
*
|
|
60
|
-
* @param ray The ray that is used for the restriction.
|
|
61
|
-
* @param point The position of the point.
|
|
62
|
-
* @param metaData The meta data of the point.
|
|
63
|
-
* @returns The restricted position of the point.
|
|
64
|
-
*/
|
|
65
|
-
snap(ray: IRay, point: vec3, metaData?: RestrictionMetaData): vec3 | undefined;
|
|
66
|
-
|
|
67
|
-
// #endregion Public Methods (1)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// #endregion Interfaces (1)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { EVENTTYPE_DRAWING_TOOLS } from '@shapediver/viewer';
|
|
2
|
-
import { IDrawingToolsEvent } from './IDrawingToolsEvent';
|
|
3
|
-
|
|
4
|
-
export type DrawingToolsEventResponseMapping = {
|
|
5
|
-
[EVENTTYPE_DRAWING_TOOLS.CANCEL]: IDrawingToolsEvent,
|
|
6
|
-
[EVENTTYPE_DRAWING_TOOLS.FINISH]: IDrawingToolsEvent,
|
|
7
|
-
[EVENTTYPE_DRAWING_TOOLS.ADDED]: IDrawingToolsEvent,
|
|
8
|
-
[EVENTTYPE_DRAWING_TOOLS.REMOVED]: IDrawingToolsEvent,
|
|
9
|
-
[EVENTTYPE_DRAWING_TOOLS.MOVED]: IDrawingToolsEvent,
|
|
10
|
-
[EVENTTYPE_DRAWING_TOOLS.GEOMETRY_CHANGED]: IDrawingToolsEvent,
|
|
11
|
-
[EVENTTYPE_DRAWING_TOOLS.SELECTED]: IDrawingToolsEvent,
|
|
12
|
-
[EVENTTYPE_DRAWING_TOOLS.DESELECTED]: IDrawingToolsEvent,
|
|
13
|
-
[EVENTTYPE_DRAWING_TOOLS.DRAG_START]: IDrawingToolsEvent,
|
|
14
|
-
[EVENTTYPE_DRAWING_TOOLS.DRAG_MOVE]: IDrawingToolsEvent,
|
|
15
|
-
[EVENTTYPE_DRAWING_TOOLS.DRAG_END]: IDrawingToolsEvent,
|
|
16
|
-
[EVENTTYPE_DRAWING_TOOLS.MINIMUM_POINTS]: IDrawingToolsEvent,
|
|
17
|
-
[EVENTTYPE_DRAWING_TOOLS.MAXIMUM_POINTS]: IDrawingToolsEvent,
|
|
18
|
-
[EVENTTYPE_DRAWING_TOOLS.UNCLOSED_LOOP]: IDrawingToolsEvent,
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IViewportEvent } from '@shapediver/viewer';
|
|
2
|
-
import { PointsData } from '../IDrawingToolsManager';
|
|
3
|
-
|
|
4
|
-
export interface IDrawingToolsEvent extends IViewportEvent {
|
|
5
|
-
// #region Properties (7)
|
|
6
|
-
|
|
7
|
-
drawingToolId: string;
|
|
8
|
-
fromHistory?: boolean;
|
|
9
|
-
index?: number;
|
|
10
|
-
message?: string;
|
|
11
|
-
points?: PointsData;
|
|
12
|
-
recordHistory?: boolean;
|
|
13
|
-
temporary?: boolean;
|
|
14
|
-
|
|
15
|
-
// #endregion Properties (7)
|
|
16
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { AngularRestrictionApi } from './api/implementation/restrictions/plane/snap/AngularRestrictionApi';
|
|
2
|
-
import { AngularRestrictionProperties } from './business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction';
|
|
3
|
-
import { AxisRestrictionApi } from './api/implementation/restrictions/plane/snap/AxisRestrictionApi';
|
|
4
|
-
import { AxisRestrictionProperties } from './business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction';
|
|
5
|
-
import { Callbacks, PointsData, SettingsOptional } from './business/interfaces/IDrawingToolsManager';
|
|
6
|
-
import { DrawingToolsApi } from './api/implementation/DrawingToolsApi';
|
|
7
|
-
import { DrawingToolsEventResponseMapping } from './business/interfaces/events/EventResponseMapping';
|
|
8
|
-
import { GeometryRestrictionApi } from './api/implementation/restrictions/geometry/GeometryRestrictionApi';
|
|
9
|
-
import { GeometryRestrictionProperties } from './business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction';
|
|
10
|
-
import { GridRestrictionApi } from './api/implementation/restrictions/plane/snap/GridRestrictionApi';
|
|
11
|
-
import { GridRestrictionProperties } from './business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction';
|
|
12
|
-
import { IDrawingToolsApi } from './api/interfaces/IDrawingToolsApi';
|
|
13
|
-
import { IDrawingToolsEvent } from './business/interfaces/events/IDrawingToolsEvent';
|
|
14
|
-
import {
|
|
15
|
-
IMapData,
|
|
16
|
-
IViewportApi,
|
|
17
|
-
MaterialEngine,
|
|
18
|
-
ShapeDiverViewerDrawingToolsError
|
|
19
|
-
} from '@shapediver/viewer';
|
|
20
|
-
import {
|
|
21
|
-
IRestriction,
|
|
22
|
-
RESTRICTION_TYPE,
|
|
23
|
-
RestrictionMetaData,
|
|
24
|
-
RestrictionProperties
|
|
25
|
-
} from './business/interfaces/IRestriction';
|
|
26
|
-
import { IRestrictionApi } from './api/interfaces/IRestrictionApi';
|
|
27
|
-
import { IRestrictionBase } from './business/interfaces/IRestrictionBase';
|
|
28
|
-
import { ISnapRestriction, SnapRestrictionProperties } from './business/interfaces/ISnapRestriction';
|
|
29
|
-
import { PlaneRestrictionApi } from './api/implementation/restrictions/plane/PlaneRestrictionApi';
|
|
30
|
-
import { PlaneRestrictionProperties } from './business/implementation/managers/interaction/restrictions/plane/PlaneRestriction';
|
|
31
|
-
import { SystemInfo } from '@shapediver/viewer.shared.services';
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
SettingsOptional as Settings, Callbacks,
|
|
35
|
-
DrawingToolsEventResponseMapping, IDrawingToolsEvent,
|
|
36
|
-
IDrawingToolsApi, DrawingToolsApi, PointsData,
|
|
37
|
-
PlaneRestrictionProperties, GridRestrictionProperties, AngularRestrictionProperties,
|
|
38
|
-
GeometryRestrictionProperties,
|
|
39
|
-
AxisRestrictionProperties,
|
|
40
|
-
IRestrictionApi, PlaneRestrictionApi, GridRestrictionApi, AngularRestrictionApi, GeometryRestrictionApi, AxisRestrictionApi,
|
|
41
|
-
IRestrictionBase, RestrictionProperties, IRestriction, RestrictionMetaData, RESTRICTION_TYPE, SnapRestrictionProperties, ISnapRestriction,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const defaultTextures: { [key: string]: Promise<IMapData> | IMapData } = {};
|
|
45
|
-
|
|
46
|
-
defaultTextures['variation_0'] = MaterialEngine.instance.loadMap('https://viewer.shapediver.com/v3/graphics/point_soft.png')
|
|
47
|
-
.then((mapData: IMapData | undefined) => {
|
|
48
|
-
defaultTextures['variation_0'] = mapData!;
|
|
49
|
-
return mapData!;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
let drawingTools: IDrawingToolsApi | undefined;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Create a new instance of DrawingTools.
|
|
56
|
-
*
|
|
57
|
-
* @param viewport The viewport to which the DrawingTools should be attached.
|
|
58
|
-
* @param callback The callback function that is called when the drawing is finished.
|
|
59
|
-
* @param properties The customization properties for the DrawingTools.
|
|
60
|
-
* @returns The DrawingTools instance.
|
|
61
|
-
* @throws An error if there is already an active instance of DrawingTools.
|
|
62
|
-
*/
|
|
63
|
-
export const createDrawingTools = (viewport: IViewportApi, callbacks: Callbacks, settings: SettingsOptional): IDrawingToolsApi => {
|
|
64
|
-
if (SystemInfo.instance.isMobile)
|
|
65
|
-
throw new ShapeDiverViewerDrawingToolsError('The DrawingTools are not supported on mobile devices.');
|
|
66
|
-
|
|
67
|
-
if (drawingTools && drawingTools.closed === false)
|
|
68
|
-
throw new ShapeDiverViewerDrawingToolsError('There can only be one instance of DrawingTools active at a time. Please close the current instance before creating a new one.');
|
|
69
|
-
|
|
70
|
-
drawingTools = new DrawingToolsApi(viewport, callbacks, settings, defaultTextures);
|
|
71
|
-
return drawingTools;
|
|
72
|
-
};
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Matrix4,
|
|
3
|
-
Object3D,
|
|
4
|
-
Vector2,
|
|
5
|
-
Vector3,
|
|
6
|
-
Scene,
|
|
7
|
-
Camera
|
|
8
|
-
} from 'three';
|
|
9
|
-
|
|
10
|
-
class CSS2DObject extends Object3D {
|
|
11
|
-
// #region Properties (3)
|
|
12
|
-
|
|
13
|
-
public center: Vector2;
|
|
14
|
-
public element: HTMLElement;
|
|
15
|
-
public isCSS2DObject: boolean;
|
|
16
|
-
|
|
17
|
-
// #endregion Properties (3)
|
|
18
|
-
|
|
19
|
-
// #region Constructors (1)
|
|
20
|
-
|
|
21
|
-
constructor(element = document.createElement('div')) {
|
|
22
|
-
super();
|
|
23
|
-
|
|
24
|
-
this.isCSS2DObject = true;
|
|
25
|
-
|
|
26
|
-
this.element = element;
|
|
27
|
-
|
|
28
|
-
this.element.style.position = 'absolute';
|
|
29
|
-
this.element.style.userSelect = 'none';
|
|
30
|
-
|
|
31
|
-
this.element.setAttribute('draggable', 'false');
|
|
32
|
-
|
|
33
|
-
this.center = new Vector2(0.5, 0.5); // ( 0, 0 ) is the lower left; ( 1, 1 ) is the top right
|
|
34
|
-
|
|
35
|
-
this.addEventListener('removed', () => {
|
|
36
|
-
this.traverse((o: Object3D) => {
|
|
37
|
-
const object = o as CSS2DObject;
|
|
38
|
-
|
|
39
|
-
if (object.element instanceof Element && object.element.parentNode !== null) {
|
|
40
|
-
object.element.parentNode.removeChild(object.element);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// #endregion Constructors (1)
|
|
49
|
-
|
|
50
|
-
// #region Public Methods (1)
|
|
51
|
-
|
|
52
|
-
public copy(source: this, recursive?: boolean): this {
|
|
53
|
-
super.copy(source, recursive);
|
|
54
|
-
|
|
55
|
-
this.element = source.element.cloneNode(true) as HTMLDivElement;
|
|
56
|
-
|
|
57
|
-
this.center = source.center;
|
|
58
|
-
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// #endregion Public Methods (1)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
const _vector = new Vector3();
|
|
68
|
-
const _viewMatrix = new Matrix4();
|
|
69
|
-
const _viewProjectionMatrix = new Matrix4();
|
|
70
|
-
const _a = new Vector3();
|
|
71
|
-
const _b = new Vector3();
|
|
72
|
-
|
|
73
|
-
type CSS2DParameters = {
|
|
74
|
-
element?: HTMLElement;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
class CSS2DRenderer {
|
|
78
|
-
// #region Properties (6)
|
|
79
|
-
|
|
80
|
-
private readonly _cache = {
|
|
81
|
-
objects: new WeakMap()
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
private _height: number = 0;
|
|
85
|
-
private _heightHalf: number = 0;
|
|
86
|
-
private _width: number = 0;
|
|
87
|
-
private _widthHalf: number = 0;
|
|
88
|
-
|
|
89
|
-
public domElement: HTMLElement;
|
|
90
|
-
|
|
91
|
-
// #endregion Properties (6)
|
|
92
|
-
|
|
93
|
-
// #region Constructors (1)
|
|
94
|
-
|
|
95
|
-
constructor(parameters?: CSS2DParameters) {
|
|
96
|
-
const domElement = parameters?.element !== undefined ? parameters.element : document.createElement('div');
|
|
97
|
-
|
|
98
|
-
domElement.style.overflow = 'hidden';
|
|
99
|
-
|
|
100
|
-
this.domElement = domElement;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// #endregion Constructors (1)
|
|
104
|
-
|
|
105
|
-
// #region Public Methods (7)
|
|
106
|
-
|
|
107
|
-
public filterAndFlatten(scene: Scene) {
|
|
108
|
-
const result: CSS2DObject[] = [];
|
|
109
|
-
|
|
110
|
-
scene.traverse((object) => {
|
|
111
|
-
if ((object as CSS2DObject).isCSS2DObject) result.push(object as CSS2DObject);
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public getDistanceToSquared(object1: Object3D, object2: Object3D) {
|
|
119
|
-
_a.setFromMatrixPosition(object1.matrixWorld);
|
|
120
|
-
_b.setFromMatrixPosition(object2.matrixWorld);
|
|
121
|
-
|
|
122
|
-
return _a.distanceToSquared(_b);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
public getSize(): { width: number; height: number } {
|
|
126
|
-
return {
|
|
127
|
-
width: this._width,
|
|
128
|
-
height: this._height
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public render(scene: Scene, camera: Camera) {
|
|
133
|
-
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
|
|
134
|
-
if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();
|
|
135
|
-
|
|
136
|
-
_viewMatrix.copy(camera.matrixWorldInverse);
|
|
137
|
-
_viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix);
|
|
138
|
-
|
|
139
|
-
this.renderObject(scene, scene, camera);
|
|
140
|
-
this.zOrder(scene);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public renderObject(o: Object3D, scene: Scene, camera: Camera) {
|
|
144
|
-
if ((o as CSS2DObject).isCSS2DObject) {
|
|
145
|
-
const object = o as CSS2DObject;
|
|
146
|
-
_vector.setFromMatrixPosition(object.matrixWorld);
|
|
147
|
-
_vector.applyMatrix4(_viewProjectionMatrix);
|
|
148
|
-
|
|
149
|
-
const visible = (object.visible === true) && (_vector.z >= - 1 && _vector.z <= 1) && (object.layers.test(camera.layers) === true);
|
|
150
|
-
object.element.style.display = (visible === true) ? '' : 'none';
|
|
151
|
-
|
|
152
|
-
if (visible === true) {
|
|
153
|
-
(object as unknown as { onBeforeRender: (renderer: unknown, scene: Scene, camera: Camera) => void }).onBeforeRender(this, scene, camera);
|
|
154
|
-
|
|
155
|
-
const element = object.element;
|
|
156
|
-
|
|
157
|
-
element.style.transform = 'translate(' + (- 100 * object.center.x) + '%,' + (- 100 * object.center.y) + '%)' + 'translate(' + (_vector.x * this._widthHalf + this._widthHalf) + 'px,' + (- _vector.y * this._heightHalf + this._heightHalf) + 'px)';
|
|
158
|
-
|
|
159
|
-
if (element.parentNode !== this.domElement) {
|
|
160
|
-
this.domElement.appendChild(element);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
(object as unknown as { onAfterRender: (renderer: unknown, scene: Scene, camera: Camera) => void }).onAfterRender(this, scene, camera);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const objectData = {
|
|
167
|
-
distanceToCameraSquared: this.getDistanceToSquared(camera, object)
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
this._cache.objects.set(object, objectData);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
for (let i = 0, l = o.children.length; i < l; i++) {
|
|
174
|
-
this.renderObject(o.children[i], scene, camera);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
public setSize(width: number, height: number) {
|
|
179
|
-
this._width = width;
|
|
180
|
-
this._height = height;
|
|
181
|
-
|
|
182
|
-
this._widthHalf = this._width / 2;
|
|
183
|
-
this._heightHalf = this._height / 2;
|
|
184
|
-
|
|
185
|
-
this.domElement.style.width = width + 'px';
|
|
186
|
-
this.domElement.style.height = height + 'px';
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
public zOrder(scene: Scene) {
|
|
190
|
-
const sorted = this.filterAndFlatten(scene).sort((a, b) => {
|
|
191
|
-
if (a.renderOrder !== b.renderOrder) {
|
|
192
|
-
return b.renderOrder - a.renderOrder;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const distanceA = this._cache.objects.get(a).distanceToCameraSquared;
|
|
196
|
-
const distanceB = this._cache.objects.get(b).distanceToCameraSquared;
|
|
197
|
-
|
|
198
|
-
return distanceA - distanceB;
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
const zMax = sorted.length;
|
|
203
|
-
|
|
204
|
-
for (let i = 0, l = sorted.length; i < l; i++) {
|
|
205
|
-
sorted[i].element.style.zIndex = (zMax - i) + '';
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// #endregion Public Methods (7)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export { CSS2DObject, CSS2DRenderer };
|
package/tsconfig.json
DELETED