@kubohiroya/turbowarp-camera-calibration 0.18.0 → 0.19.1
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.ja.md +2 -2
- package/README.md +2 -2
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/dist/camera-calibration.js +21 -5
- package/package.json +4 -4
- package/src/extension.ts +34 -9
package/README.ja.md
CHANGED
|
@@ -147,7 +147,7 @@ Node.jsやbuild環境を用意する必要はありません。専用buildのOpe
|
|
|
147
147
|
検証済みのversionをexact pinします。
|
|
148
148
|
|
|
149
149
|
```bash
|
|
150
|
-
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.
|
|
150
|
+
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.19.1
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
standalone bundle:
|
|
@@ -159,7 +159,7 @@ node_modules/@kubohiroya/turbowarp-camera-calibration/dist/camera-calibration.js
|
|
|
159
159
|
version固定CDN URL:
|
|
160
160
|
|
|
161
161
|
```text
|
|
162
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.
|
|
162
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.19.1/dist/camera-calibration.js
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
## クイックスタート
|
package/README.md
CHANGED
|
@@ -151,7 +151,7 @@ and is about 3.9 MB (about 1.5 MB gzip).
|
|
|
151
151
|
Install an exact version that you have reviewed:
|
|
152
152
|
|
|
153
153
|
```bash
|
|
154
|
-
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.
|
|
154
|
+
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.19.1
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
Load the standalone bundle from:
|
|
@@ -163,7 +163,7 @@ node_modules/@kubohiroya/turbowarp-camera-calibration/dist/camera-calibration.js
|
|
|
163
163
|
A version-pinned CDN URL is:
|
|
164
164
|
|
|
165
165
|
```text
|
|
166
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.
|
|
166
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.19.1/dist/camera-calibration.js
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
## Quick start
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -35,7 +35,7 @@ version `4.4.2`, distributed under the Apache License 2.0.
|
|
|
35
35
|
|
|
36
36
|
The contract this extension talks to is imported from
|
|
37
37
|
[`@kubohiroya/turbowarp-camera-source`](https://github.com/kubohiroya/turbowarp-camera-source) at the
|
|
38
|
-
exact npm version `0.
|
|
38
|
+
exact npm version `0.23.0`
|
|
39
39
|
(resolved by the committed `pnpm-lock.yaml`), through its `./runtime` sub-entry: the camera lease, the runtime capability,
|
|
40
40
|
and the intrinsic profile document. That runtime entry contains declarations and a few string
|
|
41
41
|
constants; its built form imports nothing, so using this entry adds no camera controller or
|
|
@@ -54,7 +54,7 @@ package's explicit editor entry and optional Source/Form registration.
|
|
|
54
54
|
|
|
55
55
|
The pure Schema engine and diagnostic helpers used by the explicit `./editor-schema` entry
|
|
56
56
|
and optional Source/Form registration
|
|
57
|
-
come from `@kubohiroya/turbowarp-extension-data-editor/schema`, at exact npm version `0.
|
|
57
|
+
come from `@kubohiroya/turbowarp-extension-data-editor/schema`, at exact npm version `0.8.1`
|
|
58
58
|
(resolved by the committed `pnpm-lock.yaml`).
|
|
59
59
|
They do not introduce the RJSF UI into the runtime bundle. Extension Data Editor is distributed
|
|
60
60
|
under the Mozilla Public License 2.0.
|
|
@@ -13983,18 +13983,30 @@ function normalizeId(value, fallback = defaultCameraId) {
|
|
|
13983
13983
|
var CameraCalibrationExtension = class {
|
|
13984
13984
|
constructor(options = {}) {
|
|
13985
13985
|
this.removeFixedEditors = () => {};
|
|
13986
|
+
this.editorsReleased = false;
|
|
13986
13987
|
this.handleProjectBoundary = () => {
|
|
13987
13988
|
this.controller.cancelAll();
|
|
13988
13989
|
};
|
|
13989
|
-
this.
|
|
13990
|
+
this.releaseEditors = () => {
|
|
13990
13991
|
this.removeFixedEditors();
|
|
13991
13992
|
this.removeSourceEditors();
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13993
|
+
this.editorsReleased = true;
|
|
13994
|
+
};
|
|
13995
|
+
this.restoreEditors = () => {
|
|
13996
|
+
if (!this.editorsReleased) return;
|
|
13997
|
+
this.editorsReleased = false;
|
|
13998
|
+
this.removeSourceEditors = registerSourceEditors(Scratch, this.nowMilliseconds);
|
|
13999
|
+
try {
|
|
14000
|
+
this.removeFixedEditors = registerFixedInputEditors(Scratch, fixedInputEditors, this.runtime);
|
|
14001
|
+
} catch (error) {
|
|
14002
|
+
this.releaseEditors();
|
|
14003
|
+
throw error;
|
|
14004
|
+
}
|
|
14005
|
+
};
|
|
14006
|
+
this.handleDisposed = () => {
|
|
13996
14007
|
this.controller.cleanupAll();
|
|
13997
14008
|
};
|
|
14009
|
+
this.nowMilliseconds = options.nowMilliseconds;
|
|
13998
14010
|
this.removeSourceEditors = registerSourceEditors(Scratch, options.nowMilliseconds);
|
|
13999
14011
|
this.runtime = options.runtime ?? Scratch.vm.runtime;
|
|
14000
14012
|
try {
|
|
@@ -14009,9 +14021,13 @@ var CameraCalibrationExtension = class {
|
|
|
14009
14021
|
this.runtime.on?.("PROJECT_STOP_ALL", this.handleProjectBoundary);
|
|
14010
14022
|
this.runtime.on?.("PROJECT_LOADED", this.handleProjectBoundary);
|
|
14011
14023
|
this.runtime.on?.("RUNTIME_DISPOSED", this.handleDisposed);
|
|
14024
|
+
this.runtime.on?.("RUNTIME_DISPOSED", this.releaseEditors);
|
|
14025
|
+
this.runtime.on?.("PROJECT_LOADED", this.restoreEditors);
|
|
14012
14026
|
} catch (error) {
|
|
14013
14027
|
this.removeFixedEditors();
|
|
14014
14028
|
this.removeSourceEditors();
|
|
14029
|
+
this.runtime.off?.("RUNTIME_DISPOSED", this.releaseEditors);
|
|
14030
|
+
this.runtime.off?.("PROJECT_LOADED", this.restoreEditors);
|
|
14015
14031
|
this.runtime.off?.("PROJECT_STOP_ALL", this.handleProjectBoundary);
|
|
14016
14032
|
this.runtime.off?.("PROJECT_LOADED", this.handleProjectBoundary);
|
|
14017
14033
|
this.runtime.off?.("RUNTIME_DISPOSED", this.handleDisposed);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-camera-calibration",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "A TurboWarp extension that calibrates a shared Camera Source camera and publishes its intrinsic calibration profile.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hiroya Kubo",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@eslint/js": "^9.39.5",
|
|
94
94
|
"@kubohiroya/turbowarp-extension-manifest": "^0.5.0",
|
|
95
|
-
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.
|
|
95
|
+
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.11.0",
|
|
96
96
|
"@types/node": "^24.13.3",
|
|
97
97
|
"ajv": "^8.20.0",
|
|
98
98
|
"eslint": "^9.39.5",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"comlink": "4.4.2",
|
|
108
|
-
"@kubohiroya/turbowarp-extension-data-editor": "^0.
|
|
109
|
-
"@kubohiroya/turbowarp-camera-source": "^0.
|
|
108
|
+
"@kubohiroya/turbowarp-extension-data-editor": "^0.8.1",
|
|
109
|
+
"@kubohiroya/turbowarp-camera-source": "^0.23.0"
|
|
110
110
|
},
|
|
111
111
|
"sideEffects": [
|
|
112
112
|
"src/index.ts",
|
package/src/extension.ts
CHANGED
|
@@ -61,10 +61,17 @@ export class CameraCalibrationExtension implements TurboWarpExtension {
|
|
|
61
61
|
private readonly runtime: TurboWarpRuntime;
|
|
62
62
|
private capability: CameraCalibrationCapabilityV1 | undefined;
|
|
63
63
|
|
|
64
|
-
private
|
|
64
|
+
private removeSourceEditors: () => void;
|
|
65
65
|
private removeFixedEditors: () => void = () => {};
|
|
66
|
+
private readonly nowMilliseconds: (() => number) | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Loading a project disposes the runtime, which releases the editor registrations, but the
|
|
69
|
+
* extension stays loaded for the next project. Register them again once that project has loaded.
|
|
70
|
+
*/
|
|
71
|
+
private editorsReleased = false;
|
|
66
72
|
|
|
67
73
|
public constructor(options: CameraCalibrationExtensionOptions = {}) {
|
|
74
|
+
this.nowMilliseconds = options.nowMilliseconds;
|
|
68
75
|
this.removeSourceEditors = registerSourceEditors(Scratch, options.nowMilliseconds);
|
|
69
76
|
this.runtime = options.runtime ?? Scratch.vm.runtime;
|
|
70
77
|
try {
|
|
@@ -79,9 +86,13 @@ export class CameraCalibrationExtension implements TurboWarpExtension {
|
|
|
79
86
|
this.runtime.on?.('PROJECT_STOP_ALL', this.handleProjectBoundary);
|
|
80
87
|
this.runtime.on?.('PROJECT_LOADED', this.handleProjectBoundary);
|
|
81
88
|
this.runtime.on?.('RUNTIME_DISPOSED', this.handleDisposed);
|
|
89
|
+
this.runtime.on?.('RUNTIME_DISPOSED', this.releaseEditors);
|
|
90
|
+
this.runtime.on?.('PROJECT_LOADED', this.restoreEditors);
|
|
82
91
|
} catch (error) {
|
|
83
92
|
this.removeFixedEditors();
|
|
84
93
|
this.removeSourceEditors();
|
|
94
|
+
this.runtime.off?.('RUNTIME_DISPOSED', this.releaseEditors);
|
|
95
|
+
this.runtime.off?.('PROJECT_LOADED', this.restoreEditors);
|
|
85
96
|
this.runtime.off?.('PROJECT_STOP_ALL', this.handleProjectBoundary);
|
|
86
97
|
this.runtime.off?.('PROJECT_LOADED', this.handleProjectBoundary);
|
|
87
98
|
this.runtime.off?.('RUNTIME_DISPOSED', this.handleDisposed);
|
|
@@ -263,17 +274,31 @@ export class CameraCalibrationExtension implements TurboWarpExtension {
|
|
|
263
274
|
void this.controller.cancelAll();
|
|
264
275
|
};
|
|
265
276
|
|
|
266
|
-
|
|
277
|
+
/** Not final for the editors: they register again with the next project. */
|
|
278
|
+
private readonly releaseEditors = (): void => {
|
|
267
279
|
this.removeFixedEditors();
|
|
268
280
|
this.removeSourceEditors();
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
281
|
+
this.editorsReleased = true;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
private readonly restoreEditors = (): void => {
|
|
285
|
+
if (!this.editorsReleased) return;
|
|
286
|
+
this.editorsReleased = false;
|
|
287
|
+
this.removeSourceEditors = registerSourceEditors(Scratch, this.nowMilliseconds);
|
|
288
|
+
try {
|
|
289
|
+
this.removeFixedEditors = registerFixedInputEditors(Scratch, fixedInputEditors, this.runtime);
|
|
290
|
+
} catch (error) {
|
|
291
|
+
this.releaseEditors();
|
|
292
|
+
throw error;
|
|
273
293
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Every project load disposes the runtime while the extension stays loaded,
|
|
298
|
+
* so this ends only the project's sessions. The capability and the listeners
|
|
299
|
+
* stay for the next project; the controller reopens what it needs on demand.
|
|
300
|
+
*/
|
|
301
|
+
private readonly handleDisposed = (): void => {
|
|
277
302
|
void this.controller.cleanupAll();
|
|
278
303
|
};
|
|
279
304
|
|