@screeb/rrweb 1.0.17 → 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 +30 -55
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.d.cts +0 -2
- package/dist/rrweb.d.ts +0 -2
- package/dist/rrweb.js +30 -55
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +30 -55
- package/dist/rrweb.umd.cjs.map +2 -2
- package/dist/rrweb.umd.min.cjs +4 -4
- package/dist/rrweb.umd.min.cjs.map +3 -3
- package/dist/ts3.8/rrweb.d.ts +0 -2
- package/package.json +1 -1
package/dist/rrweb.cjs
CHANGED
|
@@ -8513,9 +8513,6 @@ function indicatesTouchDevice(e2) {
|
|
|
8513
8513
|
return false;
|
|
8514
8514
|
}
|
|
8515
8515
|
const data = e2.data;
|
|
8516
|
-
if (data.source === IncrementalSource.TouchMove) {
|
|
8517
|
-
return true;
|
|
8518
|
-
}
|
|
8519
8516
|
if (data.source === IncrementalSource.MouseInteraction && data.type === MouseInteractions.TouchStart) {
|
|
8520
8517
|
const mouseData = data;
|
|
8521
8518
|
return mouseData.pointerType === PointerTypes.Touch;
|
|
@@ -8540,7 +8537,6 @@ class Replayer {
|
|
|
8540
8537
|
this.firstFullSnapshot = null;
|
|
8541
8538
|
this.newDocumentQueue = [];
|
|
8542
8539
|
this.pointers = {};
|
|
8543
|
-
this.mouseTailAnimationFrame = null;
|
|
8544
8540
|
this.lastMouseDownEvent = null;
|
|
8545
8541
|
this.lastSelectionData = null;
|
|
8546
8542
|
this.constructedStyleMutations = [];
|
|
@@ -8678,53 +8674,6 @@ class Replayer {
|
|
|
8678
8674
|
};
|
|
8679
8675
|
return wrappedCastFn;
|
|
8680
8676
|
};
|
|
8681
|
-
this.stepMouseTails = (timestamp) => {
|
|
8682
|
-
const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);
|
|
8683
|
-
const maxAge = duration / this.speedService.state.context.timer.speed;
|
|
8684
|
-
let hasAnyTail = false;
|
|
8685
|
-
Object.values(this.pointers).forEach((pointer) => {
|
|
8686
|
-
if (!pointer.mouseTail) {
|
|
8687
|
-
return;
|
|
8688
|
-
}
|
|
8689
|
-
const mouseTail = pointer.mouseTail;
|
|
8690
|
-
const ctx = mouseTail.getContext("2d");
|
|
8691
|
-
if (!ctx) {
|
|
8692
|
-
return;
|
|
8693
|
-
}
|
|
8694
|
-
pointer.tailPositions = pointer.tailPositions.filter(
|
|
8695
|
-
(p) => timestamp - p.t <= maxAge
|
|
8696
|
-
);
|
|
8697
|
-
ctx.clearRect(0, 0, mouseTail.width, mouseTail.height);
|
|
8698
|
-
if (pointer.tailPositions.length > 1) {
|
|
8699
|
-
hasAnyTail = true;
|
|
8700
|
-
ctx.lineWidth = lineWidth;
|
|
8701
|
-
ctx.lineCap = lineCap;
|
|
8702
|
-
ctx.strokeStyle = strokeStyle;
|
|
8703
|
-
for (let i2 = 1; i2 < pointer.tailPositions.length; i2++) {
|
|
8704
|
-
const prev = pointer.tailPositions[i2 - 1];
|
|
8705
|
-
const curr = pointer.tailPositions[i2];
|
|
8706
|
-
const age = (timestamp - curr.t) / maxAge;
|
|
8707
|
-
const alpha = Math.max(0, 1 - age);
|
|
8708
|
-
if (alpha <= 0) {
|
|
8709
|
-
continue;
|
|
8710
|
-
}
|
|
8711
|
-
ctx.globalAlpha = alpha;
|
|
8712
|
-
ctx.beginPath();
|
|
8713
|
-
ctx.moveTo(prev.x, prev.y);
|
|
8714
|
-
ctx.lineTo(curr.x, curr.y);
|
|
8715
|
-
ctx.stroke();
|
|
8716
|
-
}
|
|
8717
|
-
ctx.globalAlpha = 1;
|
|
8718
|
-
}
|
|
8719
|
-
});
|
|
8720
|
-
if (hasAnyTail) {
|
|
8721
|
-
this.mouseTailAnimationFrame = requestAnimationFrame(
|
|
8722
|
-
this.stepMouseTails
|
|
8723
|
-
);
|
|
8724
|
-
} else {
|
|
8725
|
-
this.mouseTailAnimationFrame = null;
|
|
8726
|
-
}
|
|
8727
|
-
};
|
|
8728
8677
|
if (!config?.liveMode && events.length < 2) {
|
|
8729
8678
|
throw new Error("Replayer need at least 2 events.");
|
|
8730
8679
|
}
|
|
@@ -10249,12 +10198,38 @@ class Replayer {
|
|
|
10249
10198
|
if (!pointer || !pointer.mouseTail) {
|
|
10250
10199
|
return;
|
|
10251
10200
|
}
|
|
10201
|
+
const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);
|
|
10252
10202
|
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
10203
|
+
const maxAge = duration / this.speedService.state.context.timer.speed;
|
|
10253
10204
|
pointer.tailPositions.push({ x: position.x, y: position.y, t: now });
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10205
|
+
pointer.tailPositions = pointer.tailPositions.filter(
|
|
10206
|
+
(p) => now - p.t <= maxAge
|
|
10207
|
+
);
|
|
10208
|
+
const mouseTail = pointer.mouseTail;
|
|
10209
|
+
const ctx = mouseTail.getContext("2d");
|
|
10210
|
+
if (!ctx) {
|
|
10211
|
+
return;
|
|
10212
|
+
}
|
|
10213
|
+
ctx.clearRect(0, 0, mouseTail.width, mouseTail.height);
|
|
10214
|
+
if (pointer.tailPositions.length > 1) {
|
|
10215
|
+
ctx.lineWidth = lineWidth;
|
|
10216
|
+
ctx.lineCap = lineCap;
|
|
10217
|
+
ctx.strokeStyle = strokeStyle;
|
|
10218
|
+
for (let i2 = 1; i2 < pointer.tailPositions.length; i2++) {
|
|
10219
|
+
const prev = pointer.tailPositions[i2 - 1];
|
|
10220
|
+
const curr = pointer.tailPositions[i2];
|
|
10221
|
+
const age = (now - curr.t) / maxAge;
|
|
10222
|
+
const alpha = Math.max(0, 1 - age);
|
|
10223
|
+
if (alpha <= 0) {
|
|
10224
|
+
continue;
|
|
10225
|
+
}
|
|
10226
|
+
ctx.globalAlpha = alpha;
|
|
10227
|
+
ctx.beginPath();
|
|
10228
|
+
ctx.moveTo(prev.x, prev.y);
|
|
10229
|
+
ctx.lineTo(curr.x, curr.y);
|
|
10230
|
+
ctx.stroke();
|
|
10231
|
+
}
|
|
10232
|
+
ctx.globalAlpha = 1;
|
|
10258
10233
|
}
|
|
10259
10234
|
}
|
|
10260
10235
|
hoverElements(el) {
|