@screeb/rrweb 1.0.16 → 1.0.18
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/rrweb.cjs +37 -25
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +37 -25
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +37 -25
- package/dist/rrweb.umd.cjs.map +2 -2
- package/dist/rrweb.umd.min.cjs +3 -3
- package/dist/rrweb.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/rrweb.js
CHANGED
|
@@ -8507,7 +8507,15 @@ const defaultMouseTailConfig = {
|
|
|
8507
8507
|
strokeStyle: "red"
|
|
8508
8508
|
};
|
|
8509
8509
|
function indicatesTouchDevice(e2) {
|
|
8510
|
-
|
|
8510
|
+
if (e2.type !== EventType.IncrementalSnapshot) {
|
|
8511
|
+
return false;
|
|
8512
|
+
}
|
|
8513
|
+
const data = e2.data;
|
|
8514
|
+
if (data.source === IncrementalSource.MouseInteraction && data.type === MouseInteractions.TouchStart) {
|
|
8515
|
+
const mouseData = data;
|
|
8516
|
+
return mouseData.pointerType === PointerTypes.Touch;
|
|
8517
|
+
}
|
|
8518
|
+
return false;
|
|
8511
8519
|
}
|
|
8512
8520
|
function getPointerId(d) {
|
|
8513
8521
|
const pointerId = "pointerId" in d && typeof d.pointerId === "number" ? d.pointerId : -1;
|
|
@@ -10189,34 +10197,38 @@ class Replayer {
|
|
|
10189
10197
|
return;
|
|
10190
10198
|
}
|
|
10191
10199
|
const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);
|
|
10192
|
-
const
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10200
|
+
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
10201
|
+
const maxAge = duration / this.speedService.state.context.timer.speed;
|
|
10202
|
+
pointer.tailPositions.push({ x: position.x, y: position.y, t: now });
|
|
10203
|
+
pointer.tailPositions = pointer.tailPositions.filter(
|
|
10204
|
+
(p) => now - p.t <= maxAge
|
|
10205
|
+
);
|
|
10206
|
+
const mouseTail = pointer.mouseTail;
|
|
10207
|
+
const ctx = mouseTail.getContext("2d");
|
|
10208
|
+
if (!ctx) {
|
|
10209
|
+
return;
|
|
10210
|
+
}
|
|
10211
|
+
ctx.clearRect(0, 0, mouseTail.width, mouseTail.height);
|
|
10212
|
+
if (pointer.tailPositions.length > 1) {
|
|
10203
10213
|
ctx.lineWidth = lineWidth;
|
|
10204
10214
|
ctx.lineCap = lineCap;
|
|
10205
10215
|
ctx.strokeStyle = strokeStyle;
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
);
|
|
10217
|
-
|
|
10216
|
+
for (let i2 = 1; i2 < pointer.tailPositions.length; i2++) {
|
|
10217
|
+
const prev = pointer.tailPositions[i2 - 1];
|
|
10218
|
+
const curr = pointer.tailPositions[i2];
|
|
10219
|
+
const age = (now - curr.t) / maxAge;
|
|
10220
|
+
const alpha = Math.max(0, 1 - age);
|
|
10221
|
+
if (alpha <= 0) {
|
|
10222
|
+
continue;
|
|
10223
|
+
}
|
|
10224
|
+
ctx.globalAlpha = alpha;
|
|
10225
|
+
ctx.beginPath();
|
|
10226
|
+
ctx.moveTo(prev.x, prev.y);
|
|
10227
|
+
ctx.lineTo(curr.x, curr.y);
|
|
10228
|
+
ctx.stroke();
|
|
10218
10229
|
}
|
|
10219
|
-
|
|
10230
|
+
ctx.globalAlpha = 1;
|
|
10231
|
+
}
|
|
10220
10232
|
}
|
|
10221
10233
|
hoverElements(el) {
|
|
10222
10234
|
const iframeDoc = getIFrameContentDocument(this.iframe);
|