@fileverse-dev/fortune-react 1.2.50-patch-6 → 1.2.51-patch-1
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/es/components/ContextMenu/index.js +0 -1
- package/es/components/NotationBoxes/index.js +5 -6
- package/es/components/Sheet/use-smooth-scroll.js +1 -69
- package/lib/components/ContextMenu/index.js +0 -1
- package/lib/components/NotationBoxes/index.js +4 -5
- package/lib/components/Sheet/use-smooth-scroll.js +1 -69
- package/package.json +2 -2
|
@@ -280,7 +280,6 @@ var ContextMenu = function ContextMenu() {
|
|
|
280
280
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
281
281
|
key: name,
|
|
282
282
|
onClick: function onClick() {
|
|
283
|
-
console.log("dataVerification clicked uoow");
|
|
284
283
|
if (context.allowEdit === false) return;
|
|
285
284
|
setContext(function (draftCtx) {
|
|
286
285
|
draftCtx.contextMenu = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from "react";
|
|
2
|
-
import { getFlowdata, onCommentBoxMoveStart, setEditingComment
|
|
2
|
+
import { getFlowdata, onCommentBoxMoveStart, setEditingComment } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import _ from "lodash";
|
|
4
4
|
import WorkbookContext from "../../context";
|
|
5
5
|
var NotationBoxes = function NotationBoxes() {
|
|
@@ -13,22 +13,20 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
13
13
|
useEffect(function () {
|
|
14
14
|
var _a;
|
|
15
15
|
if (flowdata) {
|
|
16
|
-
var
|
|
16
|
+
var psShownCells = [];
|
|
17
17
|
for (var i = 0; i < flowdata.length; i += 1) {
|
|
18
18
|
for (var j = 0; j < flowdata[i].length; j += 1) {
|
|
19
19
|
var cell = flowdata[i][j];
|
|
20
20
|
if (!cell) continue;
|
|
21
21
|
if ((_a = cell.ps) === null || _a === void 0 ? void 0 : _a.isShow) {
|
|
22
|
-
|
|
22
|
+
psShownCells.push({
|
|
23
23
|
r: i,
|
|
24
24
|
c: j
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
setContext(function (ctx) {
|
|
30
|
-
showComments(ctx, psShownCells_1);
|
|
31
|
-
});
|
|
29
|
+
setContext(function (ctx) {});
|
|
32
30
|
}
|
|
33
31
|
}, [flowdata, setContext]);
|
|
34
32
|
var handleMouseDownEvent = function handleMouseDownEvent(r, c, rc, commentId) {
|
|
@@ -54,6 +52,7 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
54
52
|
return (v === null || v === void 0 ? void 0 : v.rc) !== ((_a = context.editingCommentBox) === null || _a === void 0 ? void 0 : _a.rc);
|
|
55
53
|
}), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox, index) {
|
|
56
54
|
var _a, _b;
|
|
55
|
+
console.log("Rendering NotationBox:", commentBox, index);
|
|
57
56
|
if (!commentBox) return null;
|
|
58
57
|
var r = commentBox.r,
|
|
59
58
|
c = commentBox.c,
|
|
@@ -12,7 +12,6 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
|
|
|
12
12
|
return window.devicePixelRatio || 1;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
console.log("handleScroll called 6.2");
|
|
16
15
|
var queuedXPixels = 0;
|
|
17
16
|
var queuedYPixels = 0;
|
|
18
17
|
var animationFrameId = 0;
|
|
@@ -70,104 +69,38 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
|
|
|
70
69
|
var gestureStartClientY = 0;
|
|
71
70
|
var lastPointerClientX = 0;
|
|
72
71
|
var lastPointerClientY = 0;
|
|
73
|
-
var lastMoveTime = 0;
|
|
74
|
-
var velocityX = 0;
|
|
75
|
-
var velocityY = 0;
|
|
76
|
-
var momentumAnimationId = 0;
|
|
77
|
-
var scrollDirection = "none";
|
|
78
72
|
var PAN_DISTANCE_THRESHOLD_PX = 8;
|
|
79
|
-
var FRICTION = 0.95;
|
|
80
|
-
var MIN_VELOCITY = 0.5;
|
|
81
|
-
var VELOCITY_MULTIPLIER = 2.6;
|
|
82
|
-
var DIRECTION_LOCK_THRESHOLD = 1.5;
|
|
83
|
-
function stopMomentum() {
|
|
84
|
-
if (momentumAnimationId) {
|
|
85
|
-
cancelAnimationFrame(momentumAnimationId);
|
|
86
|
-
momentumAnimationId = 0;
|
|
87
|
-
}
|
|
88
|
-
velocityX = 0;
|
|
89
|
-
velocityY = 0;
|
|
90
|
-
}
|
|
91
|
-
function applyMomentum() {
|
|
92
|
-
if (Math.abs(velocityX) < MIN_VELOCITY && Math.abs(velocityY) < MIN_VELOCITY) {
|
|
93
|
-
stopMomentum();
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
var scale = getPixelScale();
|
|
97
|
-
var momentumX = -velocityX * scale;
|
|
98
|
-
var momentumY = -velocityY * scale;
|
|
99
|
-
if (scrollDirection === "vertical") {
|
|
100
|
-
momentumX = 0;
|
|
101
|
-
} else if (scrollDirection === "horizontal") {
|
|
102
|
-
momentumY = 0;
|
|
103
|
-
}
|
|
104
|
-
scrollHandler(momentumX, momentumY);
|
|
105
|
-
velocityX *= FRICTION;
|
|
106
|
-
velocityY *= FRICTION;
|
|
107
|
-
momentumAnimationId = requestAnimationFrame(applyMomentum);
|
|
108
|
-
}
|
|
109
73
|
function onPointerDown(pointerEvent) {
|
|
110
74
|
if (pointerEvent.pointerType !== "touch" && pointerEvent.pointerType !== "pen") return;
|
|
111
|
-
stopMomentum();
|
|
112
75
|
isScrolling = false;
|
|
113
|
-
scrollDirection = "none";
|
|
114
76
|
gestureStartClientX = pointerEvent.clientX;
|
|
115
77
|
lastPointerClientX = pointerEvent.clientX;
|
|
116
78
|
gestureStartClientY = pointerEvent.clientY;
|
|
117
79
|
lastPointerClientY = pointerEvent.clientY;
|
|
118
|
-
lastMoveTime = performance.now();
|
|
119
|
-
velocityX = 0;
|
|
120
|
-
velocityY = 0;
|
|
121
80
|
containerEl.setPointerCapture(pointerEvent.pointerId);
|
|
122
81
|
}
|
|
123
82
|
function onPointerMove(pointerEvent) {
|
|
124
83
|
if (pointerEvent.pointerType !== "touch" && pointerEvent.pointerType !== "pen") return;
|
|
125
|
-
var currentTime = performance.now();
|
|
126
|
-
var deltaTime = Math.max(1, currentTime - lastMoveTime);
|
|
127
84
|
var deltaXSinceLastMove = pointerEvent.clientX - lastPointerClientX;
|
|
128
85
|
var deltaYSinceLastMove = pointerEvent.clientY - lastPointerClientY;
|
|
129
|
-
velocityX = deltaXSinceLastMove / deltaTime * 16;
|
|
130
|
-
velocityY = deltaYSinceLastMove / deltaTime * 16;
|
|
131
86
|
lastPointerClientX = pointerEvent.clientX;
|
|
132
87
|
lastPointerClientY = pointerEvent.clientY;
|
|
133
|
-
lastMoveTime = currentTime;
|
|
134
88
|
if (!isScrolling) {
|
|
135
89
|
var totalXFromGestureStart = lastPointerClientX - gestureStartClientX;
|
|
136
90
|
var totalYFromGestureStart = lastPointerClientY - gestureStartClientY;
|
|
137
91
|
if (totalXFromGestureStart * totalXFromGestureStart + totalYFromGestureStart * totalYFromGestureStart < PAN_DISTANCE_THRESHOLD_PX * PAN_DISTANCE_THRESHOLD_PX) {
|
|
138
92
|
return;
|
|
139
93
|
}
|
|
140
|
-
var absX = Math.abs(totalXFromGestureStart);
|
|
141
|
-
var absY = Math.abs(totalYFromGestureStart);
|
|
142
|
-
if (absX > absY * DIRECTION_LOCK_THRESHOLD) {
|
|
143
|
-
scrollDirection = "horizontal";
|
|
144
|
-
} else if (absY > absX * DIRECTION_LOCK_THRESHOLD) {
|
|
145
|
-
scrollDirection = "vertical";
|
|
146
|
-
} else {
|
|
147
|
-
scrollDirection = "none";
|
|
148
|
-
}
|
|
149
94
|
isScrolling = true;
|
|
150
95
|
}
|
|
151
96
|
pointerEvent.preventDefault();
|
|
152
97
|
var scale = getPixelScale();
|
|
153
|
-
|
|
154
|
-
var scrollY = -deltaYSinceLastMove * scale * VELOCITY_MULTIPLIER;
|
|
155
|
-
if (scrollDirection === "vertical") {
|
|
156
|
-
scrollX = 0;
|
|
157
|
-
} else if (scrollDirection === "horizontal") {
|
|
158
|
-
scrollY = 0;
|
|
159
|
-
}
|
|
160
|
-
scrollHandler(scrollX, scrollY);
|
|
98
|
+
scrollHandler(-deltaXSinceLastMove * scale, -deltaYSinceLastMove * scale);
|
|
161
99
|
}
|
|
162
100
|
function onPointerUp(e) {
|
|
163
101
|
try {
|
|
164
102
|
containerEl.releasePointerCapture(e.pointerId);
|
|
165
103
|
} catch (_a) {}
|
|
166
|
-
if (isScrolling) {
|
|
167
|
-
if (Math.abs(velocityX) > MIN_VELOCITY || Math.abs(velocityY) > MIN_VELOCITY) {
|
|
168
|
-
momentumAnimationId = requestAnimationFrame(applyMomentum);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
104
|
isScrolling = false;
|
|
172
105
|
}
|
|
173
106
|
containerEl.addEventListener("pointerdown", onPointerDown, {
|
|
@@ -179,7 +112,6 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
|
|
|
179
112
|
containerEl.addEventListener("pointerup", onPointerUp);
|
|
180
113
|
containerEl.addEventListener("pointercancel", onPointerUp);
|
|
181
114
|
return function () {
|
|
182
|
-
stopMomentum();
|
|
183
115
|
containerEl.removeEventListener("pointerdown", onPointerDown);
|
|
184
116
|
containerEl.removeEventListener("pointermove", onPointerMove);
|
|
185
117
|
containerEl.removeEventListener("pointerup", onPointerUp);
|
|
@@ -289,7 +289,6 @@ var ContextMenu = function ContextMenu() {
|
|
|
289
289
|
return /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
290
290
|
key: name,
|
|
291
291
|
onClick: function onClick() {
|
|
292
|
-
console.log("dataVerification clicked uoow");
|
|
293
292
|
if (context.allowEdit === false) return;
|
|
294
293
|
setContext(function (draftCtx) {
|
|
295
294
|
draftCtx.contextMenu = {};
|
|
@@ -22,22 +22,20 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
22
22
|
(0, _react.useEffect)(function () {
|
|
23
23
|
var _a;
|
|
24
24
|
if (flowdata) {
|
|
25
|
-
var
|
|
25
|
+
var psShownCells = [];
|
|
26
26
|
for (var i = 0; i < flowdata.length; i += 1) {
|
|
27
27
|
for (var j = 0; j < flowdata[i].length; j += 1) {
|
|
28
28
|
var cell = flowdata[i][j];
|
|
29
29
|
if (!cell) continue;
|
|
30
30
|
if ((_a = cell.ps) === null || _a === void 0 ? void 0 : _a.isShow) {
|
|
31
|
-
|
|
31
|
+
psShownCells.push({
|
|
32
32
|
r: i,
|
|
33
33
|
c: j
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
setContext(function (ctx) {
|
|
39
|
-
(0, _fortuneCore.showComments)(ctx, psShownCells_1);
|
|
40
|
-
});
|
|
38
|
+
setContext(function (ctx) {});
|
|
41
39
|
}
|
|
42
40
|
}, [flowdata, setContext]);
|
|
43
41
|
var handleMouseDownEvent = function handleMouseDownEvent(r, c, rc, commentId) {
|
|
@@ -63,6 +61,7 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
63
61
|
return (v === null || v === void 0 ? void 0 : v.rc) !== ((_a = context.editingCommentBox) === null || _a === void 0 ? void 0 : _a.rc);
|
|
64
62
|
}), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox, index) {
|
|
65
63
|
var _a, _b;
|
|
64
|
+
console.log("Rendering NotationBox:", commentBox, index);
|
|
66
65
|
if (!commentBox) return null;
|
|
67
66
|
var r = commentBox.r,
|
|
68
67
|
c = commentBox.c,
|
|
@@ -19,7 +19,6 @@ var useSmoothScroll = exports.useSmoothScroll = function useSmoothScroll(scrollC
|
|
|
19
19
|
return window.devicePixelRatio || 1;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
console.log("handleScroll called 6.2");
|
|
23
22
|
var queuedXPixels = 0;
|
|
24
23
|
var queuedYPixels = 0;
|
|
25
24
|
var animationFrameId = 0;
|
|
@@ -77,104 +76,38 @@ var useSmoothScroll = exports.useSmoothScroll = function useSmoothScroll(scrollC
|
|
|
77
76
|
var gestureStartClientY = 0;
|
|
78
77
|
var lastPointerClientX = 0;
|
|
79
78
|
var lastPointerClientY = 0;
|
|
80
|
-
var lastMoveTime = 0;
|
|
81
|
-
var velocityX = 0;
|
|
82
|
-
var velocityY = 0;
|
|
83
|
-
var momentumAnimationId = 0;
|
|
84
|
-
var scrollDirection = "none";
|
|
85
79
|
var PAN_DISTANCE_THRESHOLD_PX = 8;
|
|
86
|
-
var FRICTION = 0.95;
|
|
87
|
-
var MIN_VELOCITY = 0.5;
|
|
88
|
-
var VELOCITY_MULTIPLIER = 2.6;
|
|
89
|
-
var DIRECTION_LOCK_THRESHOLD = 1.5;
|
|
90
|
-
function stopMomentum() {
|
|
91
|
-
if (momentumAnimationId) {
|
|
92
|
-
cancelAnimationFrame(momentumAnimationId);
|
|
93
|
-
momentumAnimationId = 0;
|
|
94
|
-
}
|
|
95
|
-
velocityX = 0;
|
|
96
|
-
velocityY = 0;
|
|
97
|
-
}
|
|
98
|
-
function applyMomentum() {
|
|
99
|
-
if (Math.abs(velocityX) < MIN_VELOCITY && Math.abs(velocityY) < MIN_VELOCITY) {
|
|
100
|
-
stopMomentum();
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
var scale = getPixelScale();
|
|
104
|
-
var momentumX = -velocityX * scale;
|
|
105
|
-
var momentumY = -velocityY * scale;
|
|
106
|
-
if (scrollDirection === "vertical") {
|
|
107
|
-
momentumX = 0;
|
|
108
|
-
} else if (scrollDirection === "horizontal") {
|
|
109
|
-
momentumY = 0;
|
|
110
|
-
}
|
|
111
|
-
scrollHandler(momentumX, momentumY);
|
|
112
|
-
velocityX *= FRICTION;
|
|
113
|
-
velocityY *= FRICTION;
|
|
114
|
-
momentumAnimationId = requestAnimationFrame(applyMomentum);
|
|
115
|
-
}
|
|
116
80
|
function onPointerDown(pointerEvent) {
|
|
117
81
|
if (pointerEvent.pointerType !== "touch" && pointerEvent.pointerType !== "pen") return;
|
|
118
|
-
stopMomentum();
|
|
119
82
|
isScrolling = false;
|
|
120
|
-
scrollDirection = "none";
|
|
121
83
|
gestureStartClientX = pointerEvent.clientX;
|
|
122
84
|
lastPointerClientX = pointerEvent.clientX;
|
|
123
85
|
gestureStartClientY = pointerEvent.clientY;
|
|
124
86
|
lastPointerClientY = pointerEvent.clientY;
|
|
125
|
-
lastMoveTime = performance.now();
|
|
126
|
-
velocityX = 0;
|
|
127
|
-
velocityY = 0;
|
|
128
87
|
containerEl.setPointerCapture(pointerEvent.pointerId);
|
|
129
88
|
}
|
|
130
89
|
function onPointerMove(pointerEvent) {
|
|
131
90
|
if (pointerEvent.pointerType !== "touch" && pointerEvent.pointerType !== "pen") return;
|
|
132
|
-
var currentTime = performance.now();
|
|
133
|
-
var deltaTime = Math.max(1, currentTime - lastMoveTime);
|
|
134
91
|
var deltaXSinceLastMove = pointerEvent.clientX - lastPointerClientX;
|
|
135
92
|
var deltaYSinceLastMove = pointerEvent.clientY - lastPointerClientY;
|
|
136
|
-
velocityX = deltaXSinceLastMove / deltaTime * 16;
|
|
137
|
-
velocityY = deltaYSinceLastMove / deltaTime * 16;
|
|
138
93
|
lastPointerClientX = pointerEvent.clientX;
|
|
139
94
|
lastPointerClientY = pointerEvent.clientY;
|
|
140
|
-
lastMoveTime = currentTime;
|
|
141
95
|
if (!isScrolling) {
|
|
142
96
|
var totalXFromGestureStart = lastPointerClientX - gestureStartClientX;
|
|
143
97
|
var totalYFromGestureStart = lastPointerClientY - gestureStartClientY;
|
|
144
98
|
if (totalXFromGestureStart * totalXFromGestureStart + totalYFromGestureStart * totalYFromGestureStart < PAN_DISTANCE_THRESHOLD_PX * PAN_DISTANCE_THRESHOLD_PX) {
|
|
145
99
|
return;
|
|
146
100
|
}
|
|
147
|
-
var absX = Math.abs(totalXFromGestureStart);
|
|
148
|
-
var absY = Math.abs(totalYFromGestureStart);
|
|
149
|
-
if (absX > absY * DIRECTION_LOCK_THRESHOLD) {
|
|
150
|
-
scrollDirection = "horizontal";
|
|
151
|
-
} else if (absY > absX * DIRECTION_LOCK_THRESHOLD) {
|
|
152
|
-
scrollDirection = "vertical";
|
|
153
|
-
} else {
|
|
154
|
-
scrollDirection = "none";
|
|
155
|
-
}
|
|
156
101
|
isScrolling = true;
|
|
157
102
|
}
|
|
158
103
|
pointerEvent.preventDefault();
|
|
159
104
|
var scale = getPixelScale();
|
|
160
|
-
|
|
161
|
-
var scrollY = -deltaYSinceLastMove * scale * VELOCITY_MULTIPLIER;
|
|
162
|
-
if (scrollDirection === "vertical") {
|
|
163
|
-
scrollX = 0;
|
|
164
|
-
} else if (scrollDirection === "horizontal") {
|
|
165
|
-
scrollY = 0;
|
|
166
|
-
}
|
|
167
|
-
scrollHandler(scrollX, scrollY);
|
|
105
|
+
scrollHandler(-deltaXSinceLastMove * scale, -deltaYSinceLastMove * scale);
|
|
168
106
|
}
|
|
169
107
|
function onPointerUp(e) {
|
|
170
108
|
try {
|
|
171
109
|
containerEl.releasePointerCapture(e.pointerId);
|
|
172
110
|
} catch (_a) {}
|
|
173
|
-
if (isScrolling) {
|
|
174
|
-
if (Math.abs(velocityX) > MIN_VELOCITY || Math.abs(velocityY) > MIN_VELOCITY) {
|
|
175
|
-
momentumAnimationId = requestAnimationFrame(applyMomentum);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
111
|
isScrolling = false;
|
|
179
112
|
}
|
|
180
113
|
containerEl.addEventListener("pointerdown", onPointerDown, {
|
|
@@ -186,7 +119,6 @@ var useSmoothScroll = exports.useSmoothScroll = function useSmoothScroll(scrollC
|
|
|
186
119
|
containerEl.addEventListener("pointerup", onPointerUp);
|
|
187
120
|
containerEl.addEventListener("pointercancel", onPointerUp);
|
|
188
121
|
return function () {
|
|
189
|
-
stopMomentum();
|
|
190
122
|
containerEl.removeEventListener("pointerdown", onPointerDown);
|
|
191
123
|
containerEl.removeEventListener("pointermove", onPointerMove);
|
|
192
124
|
containerEl.removeEventListener("pointerup", onPointerUp);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.51-patch-1",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.2.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.51-patch-1",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|