@volter/editor-blender 0.1.116 → 0.1.117
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.
|
@@ -53,7 +53,7 @@ import type {
|
|
|
53
53
|
BlenderRnaRow,
|
|
54
54
|
BlenderRnaView,
|
|
55
55
|
} from '@volter/blender-engine/browser/rna';
|
|
56
|
-
import { useEffect, useState, useSyncExternalStore } from 'react';
|
|
56
|
+
import { useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
57
57
|
import { ColorPicker, hexToRgb, parseAlpha, toHex } from '@volter/editor-sdk/widgets';
|
|
58
58
|
import {
|
|
59
59
|
type BlenderSubject,
|
|
@@ -353,6 +353,15 @@ function Numeric({
|
|
|
353
353
|
readonly onWrite: (next: number, index?: number) => void;
|
|
354
354
|
}) {
|
|
355
355
|
const [draft, setDraft] = useState<string | null>(null);
|
|
356
|
+
const pendingDraft = useRef<string | null>(null);
|
|
357
|
+
const commit = () => {
|
|
358
|
+
const typed = pendingDraft.current;
|
|
359
|
+
// Enter can also cause blur. Consume the edit before writing, once.
|
|
360
|
+
pendingDraft.current = null;
|
|
361
|
+
setDraft(null);
|
|
362
|
+
const next = Number(typed);
|
|
363
|
+
if (typed !== null && Number.isFinite(next) && next !== value) onWrite(next, index);
|
|
364
|
+
};
|
|
356
365
|
const decimals = row.type === 'FLOAT' ? (row.precision ?? 3) : 0;
|
|
357
366
|
const shown = draft ?? (row.type === 'FLOAT' ? value.toFixed(decimals) : String(value));
|
|
358
367
|
if (row.readonly) return <StaticValue>{shown}</StaticValue>;
|
|
@@ -369,15 +378,20 @@ function Numeric({
|
|
|
369
378
|
{...(row.softMin === undefined ? {} : { min: row.softMin })}
|
|
370
379
|
{...(row.softMax === undefined ? {} : { max: row.softMax })}
|
|
371
380
|
{...(row.step === undefined ? {} : { step: row.type === 'FLOAT' ? row.step / 100 : 1 })}
|
|
372
|
-
onChange={(event) =>
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
setDraft(null);
|
|
376
|
-
if (draft !== null && Number.isFinite(next) && next !== value) onWrite(next, index);
|
|
381
|
+
onChange={(event) => {
|
|
382
|
+
pendingDraft.current = event.target.value;
|
|
383
|
+
setDraft(event.target.value);
|
|
377
384
|
}}
|
|
385
|
+
onBlur={commit}
|
|
378
386
|
onKeyDown={(event) => {
|
|
379
|
-
if (event.key === 'Enter')
|
|
380
|
-
|
|
387
|
+
if (event.key === 'Enter') {
|
|
388
|
+
commit();
|
|
389
|
+
event.currentTarget.blur();
|
|
390
|
+
}
|
|
391
|
+
if (event.key === 'Escape') {
|
|
392
|
+
pendingDraft.current = null;
|
|
393
|
+
setDraft(null);
|
|
394
|
+
}
|
|
381
395
|
}}
|
|
382
396
|
style={fieldStyle}
|
|
383
397
|
/>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@volter/editor-blender",
|
|
3
3
|
"author": "Volter AI, Inc.",
|
|
4
4
|
"license": "AGPL-3.0-only AND GPL-3.0-or-later",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.117",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -70,14 +70,14 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
73
|
-
"@volter/blender-engine": "0.1.
|
|
74
|
-
"@volter/editor-threejs": "0.5.
|
|
73
|
+
"@volter/blender-engine": "0.1.115",
|
|
74
|
+
"@volter/editor-threejs": "0.5.178",
|
|
75
75
|
"zod": "^4.3.6"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@volter/editor-live": "0.5.
|
|
79
|
-
"@volter/editor-project": "0.5.
|
|
80
|
-
"@volter/editor-sdk": "0.5.
|
|
78
|
+
"@volter/editor-live": "0.5.178",
|
|
79
|
+
"@volter/editor-project": "0.5.178",
|
|
80
|
+
"@volter/editor-sdk": "0.5.178",
|
|
81
81
|
"react": "^19.0.0",
|
|
82
82
|
"react-dom": "^19.0.0",
|
|
83
83
|
"three": "^0.180.0",
|