@tnkrai/tnkr-editor 0.2.5 → 0.2.6
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/dist/index.cjs
CHANGED
|
@@ -75436,6 +75436,12 @@ function AssemblyAnnotationOverlay({ annotations, setAnnotations, currentAnnotat
|
|
|
75436
75436
|
// Update line positions state
|
|
75437
75437
|
setLinePositions(newLinePositions);
|
|
75438
75438
|
}, [runtimeRef, isDragging]);
|
|
75439
|
+
// Trigger positioning when runtime becomes available
|
|
75440
|
+
React.useEffect(() => {
|
|
75441
|
+
if (runtimeRef.current && annotations.length > 0) {
|
|
75442
|
+
updateAnnotationPositions();
|
|
75443
|
+
}
|
|
75444
|
+
}, [runtimeRef.current, annotations.length, updateAnnotationPositions]);
|
|
75439
75445
|
// Create annotation from 3D model click
|
|
75440
75446
|
const createAnnotation = React.useCallback((event) => {
|
|
75441
75447
|
if (!isPlacingAnnotation || !currentAnnotation)
|
|
@@ -76579,15 +76585,24 @@ const AssemblyViewMode = ({ phases, htmlContent, className = '', productTitle, p
|
|
|
76579
76585
|
if (containerRef.current) {
|
|
76580
76586
|
resizeObserver.observe(containerRef.current);
|
|
76581
76587
|
}
|
|
76582
|
-
// Set up runtime reference for assembly annotations - same as Editor3D
|
|
76583
|
-
|
|
76588
|
+
// Set up runtime reference for assembly annotations with smart polling - same as Editor3D.tsx in tnkr-app-dashboard
|
|
76589
|
+
let runtimePollCount = 0;
|
|
76590
|
+
const maxRuntimePolls = 60; // 3 seconds (60 * 50ms)
|
|
76591
|
+
const waitForAssemblyRuntime = () => {
|
|
76584
76592
|
var _a;
|
|
76585
76593
|
const x3dElement = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('x3d');
|
|
76586
|
-
|
|
76587
|
-
|
|
76588
|
-
|
|
76594
|
+
const runtime = x3dElement && x3dElement.runtime;
|
|
76595
|
+
if (runtime && runtime.calcCanvasPos) {
|
|
76596
|
+
// Runtime is ready for annotation positioning
|
|
76597
|
+
runtimeRef.current = runtime;
|
|
76598
|
+
return;
|
|
76599
|
+
}
|
|
76600
|
+
runtimePollCount++;
|
|
76601
|
+
if (runtimePollCount < maxRuntimePolls) {
|
|
76602
|
+
setTimeout(waitForAssemblyRuntime, 50);
|
|
76589
76603
|
}
|
|
76590
|
-
}
|
|
76604
|
+
};
|
|
76605
|
+
waitForAssemblyRuntime();
|
|
76591
76606
|
return () => {
|
|
76592
76607
|
clearTimeout(resizeTimeout);
|
|
76593
76608
|
resizeObserver.disconnect();
|