@things-factory/figure-ui 10.1.202 → 10.1.204

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/figure-ui",
3
- "version": "10.1.202",
3
+ "version": "10.1.204",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "@things-factory:registry": "https://registry.npmjs.org"
@@ -27,7 +27,7 @@
27
27
  "clean": "npm run clean:server && npm run clean:client"
28
28
  },
29
29
  "dependencies": {
30
- "@hatiolab/figure-model": "^0.9.3",
30
+ "@hatiolab/figure-model": "^0.9.4",
31
31
  "@hatiolab/things-scene": "^10.1.95",
32
32
  "@material/web": "^2.0.0",
33
33
  "@operato/data-grist": "^10.29.43",
@@ -42,11 +42,11 @@
42
42
  "@operato/slot-layout-editor": "^10.29.43",
43
43
  "@operato/styles": "^10.0.0",
44
44
  "@operato/utils": "^10.29.43",
45
- "@things-factory/ai-assistant": "^10.1.202",
46
- "@things-factory/figure-service": "^10.1.202",
47
- "@things-factory/figure-viewer": "^10.1.201",
48
- "@things-factory/setting-base": "^10.1.202",
45
+ "@things-factory/ai-assistant": "^10.1.203",
46
+ "@things-factory/figure-service": "^10.1.204",
47
+ "@things-factory/figure-viewer": "^10.1.204",
48
+ "@things-factory/setting-base": "^10.1.203",
49
49
  "three": "^0.185.1"
50
50
  },
51
- "gitHead": "3243b81eb1a4d3d903a01929f3a85d5b8df438dd"
51
+ "gitHead": "b85c845b52c08389413c0038b2b3b4b4f952ada1"
52
52
  }
@@ -6,7 +6,7 @@
6
6
  import { test } from 'node:test'
7
7
  import assert from 'node:assert/strict'
8
8
 
9
- import { addFigureBox, applyFigureAuthoring, createFigureAsset } from '@hatiolab/figure-model'
9
+ import { addFigureBox, applyFigureAuthoring, compileFigureAsset, createFigureAsset } from '@hatiolab/figure-model'
10
10
  import type { FigureAsset } from '@hatiolab/figure-model'
11
11
 
12
12
  import { aimFasten, fastenChanged, fastenDetailWordsOf, fastenFormOf, fastenPlanOf, fastenSentenceOf, fastenTargetsOf, freshFasten } from '../client/modeller/fasten-form.ts'
@@ -40,6 +40,25 @@ test('on the plane: a floor takes a part standing on it or hanging below it, a w
40
40
  assert.equal((fastenPlanOf(revisionOf(wall), 'lamp', hung).action as { facing?: string }).facing, undefined, 'a wall: standing out of it')
41
41
  })
42
42
 
43
+ test('aimed at the plane, the way starts toward the side the placement uses: below a ceiling, on a floor, out of a wall', () => {
44
+ const lamp = (placement?: 'ceiling' | 'wall') => {
45
+ const loose = addFigureBox(createFigureAsset('Lamp'), { id: 'lamp', size: { x: 100, y: 100, z: 100 }, position: { x: 0, y: 0, z: 0 } })
46
+ return revisionOf(placement ? applyFigureAuthoring(loose, { kind: 'set-placement', placement }) : loose)
47
+ }
48
+ const aimed = (r: ReturnType<typeof lamp>) => aimFasten(r, 'lamp', fastenFormOf(r, 'lamp'), { plane: true })
49
+ const ceiling = lamp('ceiling')
50
+ const form = aimed(ceiling)
51
+ assert.equal(form.facing, 'flush', 'a ceiling: hung below it')
52
+ const applied = applyFigureAuthoring(ceiling.asset, fastenPlanOf(ceiling, 'lamp', form).action!)
53
+ const at = (compileFigureAsset(applied).evaluate().geometry as Array<{ id: string; pose?: { t: number[] } }>).find(g => g.id === 'lamp')!.pose!.t
54
+ assert.equal(at[1], -50, 'at -h/2, below the ceiling')
55
+ assert.equal(aimed(lamp()).facing, 'meet', 'a floor: standing on it')
56
+ assert.equal(aimed(lamp('wall')).facing, 'meet', 'a wall: standing out of it')
57
+ /* Only where it starts: set on the ceiling plane when the author says so. */
58
+ const set = fastenChanged(ceiling, 'lamp', form, { mode: 'meet' })
59
+ assert.equal((fastenPlanOf(ceiling, 'lamp', set).action as { facing?: string }).facing, 'meet')
60
+ })
61
+
43
62
  test('the one it has, unchanged, comes to the attach that replaces it with the same place across the face', () => {
44
63
  const r = conveyor()
45
64
  const plan = fastenPlanOf(r, 'roller', fastenFormOf(r, 'roller'))