worldorbit 2.5.17 → 3.0.0
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/README.md +91 -18
- package/dist/browser/core/dist/atlas-edit.d.ts +11 -0
- package/dist/browser/core/dist/atlas-edit.js +347 -0
- package/dist/browser/core/dist/atlas-utils.d.ts +22 -0
- package/dist/browser/core/dist/atlas-utils.js +189 -0
- package/dist/browser/core/dist/atlas-validate.d.ts +2 -0
- package/dist/browser/core/dist/atlas-validate.js +488 -0
- package/dist/browser/core/dist/diagnostics.d.ts +10 -0
- package/dist/browser/core/dist/diagnostics.js +109 -0
- package/dist/browser/core/dist/draft-parse.d.ts +3 -0
- package/dist/browser/core/dist/draft-parse.js +1654 -0
- package/dist/browser/core/dist/draft.d.ts +21 -0
- package/dist/browser/core/dist/draft.js +482 -0
- package/dist/browser/core/dist/errors.d.ts +7 -0
- package/dist/browser/core/dist/errors.js +16 -0
- package/dist/browser/core/dist/format.d.ts +4 -0
- package/dist/browser/core/dist/format.js +613 -0
- package/dist/browser/core/dist/index.d.ts +29 -0
- package/dist/browser/core/dist/index.js +35 -6101
- package/dist/browser/core/dist/load.d.ts +4 -0
- package/dist/browser/core/dist/load.js +182 -0
- package/dist/browser/core/dist/markdown.d.ts +2 -0
- package/dist/browser/core/dist/markdown.js +37 -0
- package/dist/browser/core/dist/normalize.d.ts +2 -0
- package/dist/browser/core/dist/normalize.js +312 -0
- package/dist/browser/core/dist/parse.d.ts +2 -0
- package/dist/browser/core/dist/parse.js +133 -0
- package/dist/browser/core/dist/scene.d.ts +3 -0
- package/dist/browser/core/dist/scene.js +1901 -0
- package/dist/browser/core/dist/schema.d.ts +8 -0
- package/dist/browser/core/dist/schema.js +298 -0
- package/dist/browser/core/dist/spatial-scene.d.ts +3 -0
- package/dist/browser/core/dist/spatial-scene.js +420 -0
- package/dist/browser/core/dist/tokenize.d.ts +4 -0
- package/dist/browser/core/dist/tokenize.js +68 -0
- package/dist/browser/core/dist/types.d.ts +637 -0
- package/dist/browser/core/dist/types.js +1 -0
- package/dist/browser/core/dist/validate.d.ts +2 -0
- package/dist/browser/core/dist/validate.js +56 -0
- package/dist/browser/editor/dist/editor.d.ts +2 -0
- package/dist/browser/editor/dist/editor.js +3700 -0
- package/dist/browser/editor/dist/index.d.ts +2 -0
- package/dist/browser/editor/dist/index.js +1 -11702
- package/dist/browser/editor/dist/types.d.ts +59 -0
- package/dist/browser/editor/dist/types.js +1 -0
- package/dist/browser/markdown/dist/html.d.ts +3 -0
- package/dist/browser/markdown/dist/html.js +64 -0
- package/dist/browser/markdown/dist/index.d.ts +4 -0
- package/dist/browser/markdown/dist/index.js +3 -5766
- package/dist/browser/markdown/dist/rehype.d.ts +10 -0
- package/dist/browser/markdown/dist/rehype.js +49 -0
- package/dist/browser/markdown/dist/remark.d.ts +9 -0
- package/dist/browser/markdown/dist/remark.js +28 -0
- package/dist/browser/markdown/dist/types.d.ts +11 -0
- package/dist/browser/markdown/dist/types.js +1 -0
- package/dist/browser/viewer/dist/atlas-state.d.ts +12 -0
- package/dist/browser/viewer/dist/atlas-state.js +269 -0
- package/dist/browser/viewer/dist/atlas-viewer.d.ts +2 -0
- package/dist/browser/viewer/dist/atlas-viewer.js +495 -0
- package/dist/browser/viewer/dist/custom-element.d.ts +1 -0
- package/dist/browser/viewer/dist/custom-element.js +78 -0
- package/dist/browser/viewer/dist/embed.d.ts +24 -0
- package/dist/browser/viewer/dist/embed.js +172 -0
- package/dist/browser/viewer/dist/errors.d.ts +6 -0
- package/dist/browser/viewer/dist/errors.js +12 -0
- package/dist/browser/viewer/dist/index.d.ts +10 -0
- package/dist/browser/viewer/dist/index.js +9 -7901
- package/dist/browser/viewer/dist/minimap.d.ts +3 -0
- package/dist/browser/viewer/dist/minimap.js +63 -0
- package/dist/browser/viewer/dist/render.d.ts +6 -0
- package/dist/browser/viewer/dist/render.js +670 -0
- package/dist/browser/viewer/dist/runtime-3d.d.ts +19 -0
- package/dist/browser/viewer/dist/runtime-3d.js +494 -0
- package/dist/browser/viewer/dist/theme.d.ts +4 -0
- package/dist/browser/viewer/dist/theme.js +103 -0
- package/dist/browser/viewer/dist/tooltip.d.ts +3 -0
- package/dist/browser/viewer/dist/tooltip.js +198 -0
- package/dist/browser/viewer/dist/types.d.ts +292 -0
- package/dist/browser/viewer/dist/types.js +1 -0
- package/dist/browser/viewer/dist/vendor/three.module.js +53032 -0
- package/dist/browser/viewer/dist/viewer-state.d.ts +19 -0
- package/dist/browser/viewer/dist/viewer-state.js +162 -0
- package/dist/browser/viewer/dist/viewer.d.ts +2 -0
- package/dist/browser/viewer/dist/viewer.js +1662 -0
- package/dist/unpkg/core/dist/atlas-edit.d.ts +11 -0
- package/dist/unpkg/core/dist/atlas-edit.js +347 -0
- package/dist/unpkg/core/dist/atlas-utils.d.ts +22 -0
- package/dist/unpkg/core/dist/atlas-utils.js +189 -0
- package/dist/unpkg/core/dist/atlas-validate.d.ts +2 -0
- package/dist/unpkg/core/dist/atlas-validate.js +488 -0
- package/dist/unpkg/core/dist/diagnostics.d.ts +10 -0
- package/dist/unpkg/core/dist/diagnostics.js +109 -0
- package/dist/unpkg/core/dist/draft-parse.d.ts +3 -0
- package/dist/unpkg/core/dist/draft-parse.js +1654 -0
- package/dist/unpkg/core/dist/draft.d.ts +21 -0
- package/dist/unpkg/core/dist/draft.js +482 -0
- package/dist/unpkg/core/dist/errors.d.ts +7 -0
- package/dist/unpkg/core/dist/errors.js +16 -0
- package/dist/unpkg/core/dist/format.d.ts +4 -0
- package/dist/unpkg/core/dist/format.js +613 -0
- package/dist/unpkg/core/dist/index.d.ts +29 -0
- package/dist/unpkg/core/dist/index.js +35 -6173
- package/dist/unpkg/core/dist/load.d.ts +4 -0
- package/dist/unpkg/core/dist/load.js +182 -0
- package/dist/unpkg/core/dist/markdown.d.ts +2 -0
- package/dist/unpkg/core/dist/markdown.js +37 -0
- package/dist/unpkg/core/dist/normalize.d.ts +2 -0
- package/dist/unpkg/core/dist/normalize.js +312 -0
- package/dist/unpkg/core/dist/parse.d.ts +2 -0
- package/dist/unpkg/core/dist/parse.js +133 -0
- package/dist/unpkg/core/dist/scene.d.ts +3 -0
- package/dist/unpkg/core/dist/scene.js +1901 -0
- package/dist/unpkg/core/dist/schema.d.ts +8 -0
- package/dist/unpkg/core/dist/schema.js +298 -0
- package/dist/unpkg/core/dist/spatial-scene.d.ts +3 -0
- package/dist/unpkg/core/dist/spatial-scene.js +420 -0
- package/dist/unpkg/core/dist/tokenize.d.ts +4 -0
- package/dist/unpkg/core/dist/tokenize.js +68 -0
- package/dist/unpkg/core/dist/types.d.ts +637 -0
- package/dist/unpkg/core/dist/types.js +1 -0
- package/dist/unpkg/core/dist/validate.d.ts +2 -0
- package/dist/unpkg/core/dist/validate.js +56 -0
- package/dist/unpkg/editor/dist/editor.d.ts +2 -0
- package/dist/unpkg/editor/dist/editor.js +3700 -0
- package/dist/unpkg/editor/dist/index.d.ts +2 -0
- package/dist/unpkg/editor/dist/index.js +1 -11727
- package/dist/unpkg/editor/dist/types.d.ts +59 -0
- package/dist/unpkg/editor/dist/types.js +1 -0
- package/dist/unpkg/markdown/dist/html.d.ts +3 -0
- package/dist/unpkg/markdown/dist/html.js +64 -0
- package/dist/unpkg/markdown/dist/index.d.ts +4 -0
- package/dist/unpkg/markdown/dist/index.js +3 -5794
- package/dist/unpkg/markdown/dist/rehype.d.ts +10 -0
- package/dist/unpkg/markdown/dist/rehype.js +49 -0
- package/dist/unpkg/markdown/dist/remark.d.ts +9 -0
- package/dist/unpkg/markdown/dist/remark.js +28 -0
- package/dist/unpkg/markdown/dist/types.d.ts +11 -0
- package/dist/unpkg/markdown/dist/types.js +1 -0
- package/dist/unpkg/viewer/dist/atlas-state.d.ts +12 -0
- package/dist/unpkg/viewer/dist/atlas-state.js +269 -0
- package/dist/unpkg/viewer/dist/atlas-viewer.d.ts +2 -0
- package/dist/unpkg/viewer/dist/atlas-viewer.js +495 -0
- package/dist/unpkg/viewer/dist/custom-element.d.ts +1 -0
- package/dist/unpkg/viewer/dist/custom-element.js +78 -0
- package/dist/unpkg/viewer/dist/embed.d.ts +24 -0
- package/dist/unpkg/viewer/dist/embed.js +172 -0
- package/dist/unpkg/viewer/dist/errors.d.ts +6 -0
- package/dist/unpkg/viewer/dist/errors.js +12 -0
- package/dist/unpkg/viewer/dist/index.d.ts +10 -0
- package/dist/unpkg/viewer/dist/index.js +9 -7958
- package/dist/unpkg/viewer/dist/minimap.d.ts +3 -0
- package/dist/unpkg/viewer/dist/minimap.js +63 -0
- package/dist/unpkg/viewer/dist/render.d.ts +6 -0
- package/dist/unpkg/viewer/dist/render.js +670 -0
- package/dist/unpkg/viewer/dist/runtime-3d.d.ts +19 -0
- package/dist/unpkg/viewer/dist/runtime-3d.js +494 -0
- package/dist/unpkg/viewer/dist/theme.d.ts +4 -0
- package/dist/unpkg/viewer/dist/theme.js +103 -0
- package/dist/unpkg/viewer/dist/tooltip.d.ts +3 -0
- package/dist/unpkg/viewer/dist/tooltip.js +198 -0
- package/dist/unpkg/viewer/dist/types.d.ts +292 -0
- package/dist/unpkg/viewer/dist/types.js +1 -0
- package/dist/unpkg/viewer/dist/vendor/three.module.js +53032 -0
- package/dist/unpkg/viewer/dist/viewer-state.d.ts +19 -0
- package/dist/unpkg/viewer/dist/viewer-state.js +162 -0
- package/dist/unpkg/viewer/dist/viewer.d.ts +2 -0
- package/dist/unpkg/viewer/dist/viewer.js +1662 -0
- package/dist/unpkg/worldorbit-core.min.js +1 -12
- package/dist/unpkg/worldorbit-editor.min.js +1 -894
- package/dist/unpkg/worldorbit-markdown.min.js +1 -103
- package/dist/unpkg/worldorbit-viewer.min.js +1 -259
- package/dist/unpkg/worldorbit.js +2 -9243
- package/dist/unpkg/worldorbit.min.js +2 -263
- package/package.json +1 -1
- package/packages/core/dist/atlas-edit.js +1 -1
- package/packages/core/dist/atlas-validate.js +99 -10
- package/packages/core/dist/draft-parse.js +190 -15
- package/packages/core/dist/draft.js +50 -11
- package/packages/core/dist/format.js +36 -5
- package/packages/core/dist/index.d.ts +1 -0
- package/packages/core/dist/index.js +1 -0
- package/packages/core/dist/load.js +9 -2
- package/packages/core/dist/scene.js +158 -24
- package/packages/core/dist/spatial-scene.d.ts +3 -0
- package/packages/core/dist/spatial-scene.js +420 -0
- package/packages/core/dist/types.d.ts +124 -2
- package/packages/editor/dist/editor.js +130 -8
- package/packages/editor/dist/types.d.ts +4 -0
- package/packages/markdown/dist/html.js +10 -3
- package/packages/viewer/dist/atlas-state.js +8 -2
- package/packages/viewer/dist/atlas-viewer.js +20 -8
- package/packages/viewer/dist/custom-element.js +18 -4
- package/packages/viewer/dist/embed.d.ts +5 -1
- package/packages/viewer/dist/embed.js +58 -24
- package/packages/viewer/dist/errors.d.ts +6 -0
- package/packages/viewer/dist/errors.js +12 -0
- package/packages/viewer/dist/index.d.ts +1 -0
- package/packages/viewer/dist/index.js +1 -0
- package/packages/viewer/dist/runtime-3d.d.ts +19 -0
- package/packages/viewer/dist/runtime-3d.js +494 -0
- package/packages/viewer/dist/types.d.ts +25 -3
- package/packages/viewer/dist/vendor/three.module.js +53032 -0
- package/packages/viewer/dist/viewer.js +517 -41
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CoordinatePoint, type RenderBounds, type RenderScene } from "@worldorbit/core";
|
|
2
|
+
import type { ViewerState } from "./types.js";
|
|
3
|
+
export interface ViewerConstraints {
|
|
4
|
+
minScale: number;
|
|
5
|
+
maxScale: number;
|
|
6
|
+
fitPadding: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_VIEWER_STATE: ViewerState;
|
|
9
|
+
export declare function normalizeRotation(rotationDeg: number): number;
|
|
10
|
+
export declare function clampScale(scale: number, constraints: ViewerConstraints): number;
|
|
11
|
+
export declare function panViewerState(state: ViewerState, dx: number, dy: number): ViewerState;
|
|
12
|
+
export declare function rotateViewerState(state: ViewerState, deltaDeg: number): ViewerState;
|
|
13
|
+
export declare function zoomViewerStateAt(scene: RenderScene, state: ViewerState, factor: number, anchor: CoordinatePoint, constraints: ViewerConstraints): ViewerState;
|
|
14
|
+
export declare function fitViewerState(scene: RenderScene, state: ViewerState, constraints: ViewerConstraints): ViewerState;
|
|
15
|
+
export declare function focusViewerState(scene: RenderScene, state: ViewerState, objectId: string, constraints: ViewerConstraints): ViewerState;
|
|
16
|
+
export declare function composeViewerTransform(scene: RenderScene, state: ViewerState): string;
|
|
17
|
+
export declare function invertViewerPoint(scene: RenderScene, state: ViewerState, point: CoordinatePoint): CoordinatePoint;
|
|
18
|
+
export declare function getViewerVisibleBounds(scene: RenderScene, state: ViewerState): RenderBounds;
|
|
19
|
+
export declare function getSceneCenter(scene: RenderScene): CoordinatePoint;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { rotatePoint, } from "@worldorbit/core";
|
|
2
|
+
export const DEFAULT_VIEWER_STATE = {
|
|
3
|
+
scale: 1,
|
|
4
|
+
rotationDeg: 0,
|
|
5
|
+
translateX: 0,
|
|
6
|
+
translateY: 0,
|
|
7
|
+
selectedObjectId: null,
|
|
8
|
+
};
|
|
9
|
+
export function normalizeRotation(rotationDeg) {
|
|
10
|
+
let normalized = rotationDeg % 360;
|
|
11
|
+
if (normalized > 180) {
|
|
12
|
+
normalized -= 360;
|
|
13
|
+
}
|
|
14
|
+
if (normalized <= -180) {
|
|
15
|
+
normalized += 360;
|
|
16
|
+
}
|
|
17
|
+
return normalized;
|
|
18
|
+
}
|
|
19
|
+
export function clampScale(scale, constraints) {
|
|
20
|
+
return Math.min(Math.max(scale, constraints.minScale), constraints.maxScale);
|
|
21
|
+
}
|
|
22
|
+
export function panViewerState(state, dx, dy) {
|
|
23
|
+
return {
|
|
24
|
+
...state,
|
|
25
|
+
translateX: state.translateX + dx,
|
|
26
|
+
translateY: state.translateY + dy,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function rotateViewerState(state, deltaDeg) {
|
|
30
|
+
return {
|
|
31
|
+
...state,
|
|
32
|
+
rotationDeg: normalizeRotation(state.rotationDeg + deltaDeg),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function zoomViewerStateAt(scene, state, factor, anchor, constraints) {
|
|
36
|
+
if (!Number.isFinite(factor) || factor <= 0) {
|
|
37
|
+
return state;
|
|
38
|
+
}
|
|
39
|
+
const center = getSceneCenter(scene);
|
|
40
|
+
const nextScale = clampScale(state.scale * factor, constraints);
|
|
41
|
+
if (nextScale === state.scale) {
|
|
42
|
+
return state;
|
|
43
|
+
}
|
|
44
|
+
const zoomRatio = nextScale / state.scale;
|
|
45
|
+
const anchorDx = anchor.x - center.x;
|
|
46
|
+
const anchorDy = anchor.y - center.y;
|
|
47
|
+
return {
|
|
48
|
+
...state,
|
|
49
|
+
scale: nextScale,
|
|
50
|
+
translateX: (1 - zoomRatio) * anchorDx + zoomRatio * state.translateX,
|
|
51
|
+
translateY: (1 - zoomRatio) * anchorDy + zoomRatio * state.translateY,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function fitViewerState(scene, state, constraints) {
|
|
55
|
+
const center = getSceneCenter(scene);
|
|
56
|
+
const rotatedBounds = rotateBounds(scene.contentBounds, center, state.rotationDeg);
|
|
57
|
+
const availableWidth = Math.max(scene.width - constraints.fitPadding * 2, 1);
|
|
58
|
+
const availableHeight = Math.max(scene.height - constraints.fitPadding * 2, 1);
|
|
59
|
+
const safeWidth = Math.max(rotatedBounds.width, 1);
|
|
60
|
+
const safeHeight = Math.max(rotatedBounds.height, 1);
|
|
61
|
+
const nextScale = clampScale(Math.min(availableWidth / safeWidth, availableHeight / safeHeight), constraints);
|
|
62
|
+
const rotatedCenter = rotatePoint({
|
|
63
|
+
x: scene.contentBounds.centerX,
|
|
64
|
+
y: scene.contentBounds.centerY,
|
|
65
|
+
}, center, state.rotationDeg);
|
|
66
|
+
return {
|
|
67
|
+
...state,
|
|
68
|
+
scale: nextScale,
|
|
69
|
+
translateX: center.x - (center.x + (rotatedCenter.x - center.x) * nextScale),
|
|
70
|
+
translateY: center.y - (center.y + (rotatedCenter.y - center.y) * nextScale),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function focusViewerState(scene, state, objectId, constraints) {
|
|
74
|
+
const target = scene.objects.find((object) => object.objectId === objectId && !object.hidden);
|
|
75
|
+
if (!target) {
|
|
76
|
+
return state;
|
|
77
|
+
}
|
|
78
|
+
const center = getSceneCenter(scene);
|
|
79
|
+
const nextScale = clampScale(Math.max(state.scale, 1.8), constraints);
|
|
80
|
+
const rotatedPoint = rotatePoint({ x: target.x, y: target.y }, center, state.rotationDeg);
|
|
81
|
+
return {
|
|
82
|
+
...state,
|
|
83
|
+
scale: nextScale,
|
|
84
|
+
translateX: center.x - (center.x + (rotatedPoint.x - center.x) * nextScale),
|
|
85
|
+
translateY: center.y - (center.y + (rotatedPoint.y - center.y) * nextScale),
|
|
86
|
+
selectedObjectId: objectId,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function composeViewerTransform(scene, state) {
|
|
90
|
+
const center = getSceneCenter(scene);
|
|
91
|
+
return `translate(${state.translateX} ${state.translateY}) translate(${center.x} ${center.y}) rotate(${state.rotationDeg}) scale(${state.scale}) translate(${-center.x} ${-center.y})`;
|
|
92
|
+
}
|
|
93
|
+
export function invertViewerPoint(scene, state, point) {
|
|
94
|
+
const center = getSceneCenter(scene);
|
|
95
|
+
const translated = {
|
|
96
|
+
x: point.x - state.translateX,
|
|
97
|
+
y: point.y - state.translateY,
|
|
98
|
+
};
|
|
99
|
+
const centered = {
|
|
100
|
+
x: translated.x - center.x,
|
|
101
|
+
y: translated.y - center.y,
|
|
102
|
+
};
|
|
103
|
+
const scaled = {
|
|
104
|
+
x: centered.x / Math.max(state.scale, 0.0001),
|
|
105
|
+
y: centered.y / Math.max(state.scale, 0.0001),
|
|
106
|
+
};
|
|
107
|
+
const unrotated = rotatePoint({ x: scaled.x, y: scaled.y }, { x: 0, y: 0 }, -state.rotationDeg);
|
|
108
|
+
return {
|
|
109
|
+
x: center.x + unrotated.x,
|
|
110
|
+
y: center.y + unrotated.y,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function getViewerVisibleBounds(scene, state) {
|
|
114
|
+
const corners = [
|
|
115
|
+
{ x: 0, y: 0 },
|
|
116
|
+
{ x: scene.width, y: 0 },
|
|
117
|
+
{ x: scene.width, y: scene.height },
|
|
118
|
+
{ x: 0, y: scene.height },
|
|
119
|
+
].map((point) => invertViewerPoint(scene, state, point));
|
|
120
|
+
const minX = Math.min(...corners.map((corner) => corner.x));
|
|
121
|
+
const minY = Math.min(...corners.map((corner) => corner.y));
|
|
122
|
+
const maxX = Math.max(...corners.map((corner) => corner.x));
|
|
123
|
+
const maxY = Math.max(...corners.map((corner) => corner.y));
|
|
124
|
+
return {
|
|
125
|
+
minX,
|
|
126
|
+
minY,
|
|
127
|
+
maxX,
|
|
128
|
+
maxY,
|
|
129
|
+
width: maxX - minX,
|
|
130
|
+
height: maxY - minY,
|
|
131
|
+
centerX: minX + (maxX - minX) / 2,
|
|
132
|
+
centerY: minY + (maxY - minY) / 2,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export function getSceneCenter(scene) {
|
|
136
|
+
return {
|
|
137
|
+
x: scene.width / 2,
|
|
138
|
+
y: scene.height / 2,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function rotateBounds(bounds, center, rotationDeg) {
|
|
142
|
+
const corners = [
|
|
143
|
+
{ x: bounds.minX, y: bounds.minY },
|
|
144
|
+
{ x: bounds.maxX, y: bounds.minY },
|
|
145
|
+
{ x: bounds.maxX, y: bounds.maxY },
|
|
146
|
+
{ x: bounds.minX, y: bounds.maxY },
|
|
147
|
+
].map((corner) => rotatePoint(corner, center, rotationDeg));
|
|
148
|
+
const minX = Math.min(...corners.map((corner) => corner.x));
|
|
149
|
+
const minY = Math.min(...corners.map((corner) => corner.y));
|
|
150
|
+
const maxX = Math.max(...corners.map((corner) => corner.x));
|
|
151
|
+
const maxY = Math.max(...corners.map((corner) => corner.y));
|
|
152
|
+
return {
|
|
153
|
+
minX,
|
|
154
|
+
minY,
|
|
155
|
+
maxX,
|
|
156
|
+
maxY,
|
|
157
|
+
width: maxX - minX,
|
|
158
|
+
height: maxY - minY,
|
|
159
|
+
centerX: minX + (maxX - minX) / 2,
|
|
160
|
+
centerY: minY + (maxY - minY) / 2,
|
|
161
|
+
};
|
|
162
|
+
}
|