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