@dtducas/wh-forge-viewer 3.0.0-beta.2 → 3.0.0-beta.3
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.d.ts +1 -2
- package/dist/index.esm.js +40 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +40 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -582,8 +582,7 @@ declare module '@dtducas/wh-forge-viewer' {
|
|
|
582
582
|
*/
|
|
583
583
|
export type OnLocalCursorMoveCallback = (payload: {
|
|
584
584
|
position: { x: number; y: number };
|
|
585
|
-
|
|
586
|
-
timestamp: number;
|
|
585
|
+
coordSystem: 'markup' | 'percent';
|
|
587
586
|
}) => void;
|
|
588
587
|
|
|
589
588
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -95927,6 +95927,7 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
95927
95927
|
}, [onPublish]);
|
|
95928
95928
|
var collabSessionRef = useRef(null);
|
|
95929
95929
|
var canvasExportServiceRef = useRef(null);
|
|
95930
|
+
var cursorCleanupRef = useRef(null);
|
|
95930
95931
|
var getExportViewablePagesRef = useRef(getExportViewablePages);
|
|
95931
95932
|
useEffect(function () {
|
|
95932
95933
|
getExportViewablePagesRef.current = getExportViewablePages;
|
|
@@ -96039,7 +96040,7 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96039
96040
|
onSuccess: function () {
|
|
96040
96041
|
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
96041
96042
|
var _sceneBuilderService$, _sceneBuilderService;
|
|
96042
|
-
var engine, _engine$stamps, _engine$stamps2, _engine$stamps3, capabilities, enhancedViewer, _engine$markup;
|
|
96043
|
+
var engine, _engine$stamps, _engine$stamps2, _engine$stamps3, capabilities, enhancedViewer, _engine$markup, _cursorCallbacks, _cursorContainer, _onPointerMove;
|
|
96043
96044
|
return _regenerator().w(function (_context) {
|
|
96044
96045
|
while (1) switch (_context.n) {
|
|
96045
96046
|
case 0:
|
|
@@ -96111,6 +96112,41 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96111
96112
|
|
|
96112
96113
|
// Viewer presets
|
|
96113
96114
|
enhancedViewer.presetManager = presetManager;
|
|
96115
|
+
|
|
96116
|
+
// ─── World-space cursor tracking ──────────────────────────
|
|
96117
|
+
// Emit pointer-move events in Forge world space so remote cursors
|
|
96118
|
+
// are zoom-invariant and screen-size-invariant on all receivers.
|
|
96119
|
+
_cursorCallbacks = new Set();
|
|
96120
|
+
enhancedViewer.onLocalCursorMove = function (cb) {
|
|
96121
|
+
_cursorCallbacks.add(cb);
|
|
96122
|
+
return function () {
|
|
96123
|
+
return _cursorCallbacks["delete"](cb);
|
|
96124
|
+
};
|
|
96125
|
+
};
|
|
96126
|
+
_cursorContainer = viewer.container;
|
|
96127
|
+
_onPointerMove = function _onPointerMove(e) {
|
|
96128
|
+
if (!_cursorCallbacks.size) return;
|
|
96129
|
+
var rect = _cursorContainer.getBoundingClientRect();
|
|
96130
|
+
var hit = viewer.clientToWorld(e.clientX - rect.left, e.clientY - rect.top, true);
|
|
96131
|
+
if (!(hit !== null && hit !== void 0 && hit.point)) return;
|
|
96132
|
+
var payload = {
|
|
96133
|
+
position: {
|
|
96134
|
+
x: hit.point.x,
|
|
96135
|
+
y: hit.point.y
|
|
96136
|
+
},
|
|
96137
|
+
coordSystem: 'markup'
|
|
96138
|
+
};
|
|
96139
|
+
_cursorCallbacks.forEach(function (cb) {
|
|
96140
|
+
return cb(payload);
|
|
96141
|
+
});
|
|
96142
|
+
};
|
|
96143
|
+
_cursorContainer.addEventListener('pointermove', _onPointerMove, {
|
|
96144
|
+
passive: true
|
|
96145
|
+
});
|
|
96146
|
+
cursorCleanupRef.current = function () {
|
|
96147
|
+
_cursorContainer.removeEventListener('pointermove', _onPointerMove);
|
|
96148
|
+
delete enhancedViewer.onLocalCursorMove;
|
|
96149
|
+
};
|
|
96114
96150
|
setViewer(enhancedViewer);
|
|
96115
96151
|
}
|
|
96116
96152
|
case 4:
|
|
@@ -96151,7 +96187,9 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96151
96187
|
}();
|
|
96152
96188
|
initializeViewer();
|
|
96153
96189
|
return function () {
|
|
96154
|
-
var _canvasExportServiceR, _markupMgrRef$current, _overlayManagerRef$cu, _sceneBuilderRef$curr;
|
|
96190
|
+
var _cursorCleanupRef$cur, _canvasExportServiceR, _markupMgrRef$current, _overlayManagerRef$cu, _sceneBuilderRef$curr;
|
|
96191
|
+
(_cursorCleanupRef$cur = cursorCleanupRef.current) === null || _cursorCleanupRef$cur === void 0 || _cursorCleanupRef$cur.call(cursorCleanupRef);
|
|
96192
|
+
cursorCleanupRef.current = null;
|
|
96155
96193
|
(_canvasExportServiceR = canvasExportServiceRef.current) === null || _canvasExportServiceR === void 0 || _canvasExportServiceR.destroy();
|
|
96156
96194
|
canvasExportServiceRef.current = null;
|
|
96157
96195
|
(_markupMgrRef$current = markupMgrRef.current) === null || _markupMgrRef$current === void 0 || _markupMgrRef$current.destroy();
|