@things-factory/figure-ui 10.1.126 → 10.1.127
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/client/modeller/canvas.ts +6 -1
- package/client/modeller/editor.ts +7 -2
- package/client/modeller/figure-preview.ts +38 -16
- package/dist-client/modeller/canvas.js +8 -1
- package/dist-client/modeller/canvas.js.map +1 -1
- package/dist-client/modeller/clips.d.ts +1 -1
- package/dist-client/modeller/editor.js +9 -4
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/modeller/figure-preview.js +38 -16
- package/dist-client/modeller/figure-preview.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/test/mode-switch.test.ts +41 -0
- package/dist-client/tsconfig.scratch.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/figure-ui",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.127",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"@things-factory:registry": "https://registry.npmjs.org"
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@operato/shell": "^10.0.0",
|
|
41
41
|
"@operato/styles": "^10.0.0",
|
|
42
42
|
"@operato/utils": "^10.0.0",
|
|
43
|
-
"@things-factory/ai-assistant": "^10.1.
|
|
43
|
+
"@things-factory/ai-assistant": "^10.1.127",
|
|
44
44
|
"@things-factory/figure-service": "^10.1.123",
|
|
45
45
|
"three": "^0.185.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1a224d9f1cbf56697a739e505b97333dd090d473"
|
|
48
48
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Going from the preview back to editing does not build the edit canvas again: a 3D scene costs about a third of a
|
|
3
|
+
* second to make, and the canvas keeps its selection, gizmo and camera while the preview is in front. The preview is the
|
|
4
|
+
* other way round -- it is taken down when it is left, because a preview left standing behind the canvas made every edit
|
|
5
|
+
* dearer (a box added went from 240 ms to over a second, 2026-10-08).
|
|
6
|
+
*/
|
|
7
|
+
import { test } from 'node:test'
|
|
8
|
+
import assert from 'node:assert/strict'
|
|
9
|
+
import { readFileSync } from 'node:fs'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
|
+
|
|
12
|
+
const read = (path: string) => readFileSync(fileURLToPath(new URL(path, import.meta.url)), 'utf-8')
|
|
13
|
+
|
|
14
|
+
test('the edit canvas stays standing, out of sight, while the preview is in front', () => {
|
|
15
|
+
const editor = read('../client/modeller/editor.ts')
|
|
16
|
+
assert.ok(editor.includes("<div middle ?hidden=${this.middle === 'preview'}>"), 'the edit area is hidden, not removed')
|
|
17
|
+
assert.ok(/div\[middle\]\[hidden\]\s*\{\s*display: none;/.test(editor), 'and hidden by the stylesheet, which `display: flex` would otherwise override')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('the preview is only there while it is in front', () => {
|
|
21
|
+
const editor = read('../client/modeller/editor.ts')
|
|
22
|
+
assert.ok(editor.includes("${this.middle === 'preview'\n ? html`<figure-preview"), 'it is made when asked for and taken down when left')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('a canvas out of sight is not resized to nothing and takes no picture', () => {
|
|
26
|
+
const canvas = read('../client/modeller/canvas.ts')
|
|
27
|
+
assert.ok(canvas.includes('this.checkVisibility?.() !== false') && canvas.includes('this.scene?.resize?.()'), 'resize only when visible')
|
|
28
|
+
assert.ok(canvas.includes('if (this.checkVisibility?.() === false) return undefined'), 'no picture while hidden, as when there was no canvas')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* A value typed beside the preview changes the figure; the preview used to take its 3D scene down and make another, and
|
|
33
|
+
* the new scene's first drawing compiled the shaders again: five frames of 570 to 960 ms for one number (2026-10-09). The
|
|
34
|
+
* content is made again inside the scene that stands, keeping the renderer and the camera, as undo does.
|
|
35
|
+
*/
|
|
36
|
+
test('the preview makes its content again inside the scene that stands, and makes a new scene only when it cannot', () => {
|
|
37
|
+
const preview = read('../client/modeller/figure-preview.ts')
|
|
38
|
+
assert.ok(preview.includes('rebuildContentModel!(model, { preserveThreeD: true })'), 'rebuilt in place, keeping the 3D runtime')
|
|
39
|
+
assert.ok(preview.includes('this.registered === type'), 'only for the same figure')
|
|
40
|
+
assert.ok(/catch \{\s*this\.teardown\(\)/.test(preview), 'and a scene made anew when the content cannot be made again in place')
|
|
41
|
+
})
|