@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.umd.cjs
CHANGED
|
@@ -8631,9 +8631,6 @@ function indicatesTouchDevice(e2) {
|
|
|
8631
8631
|
return false;
|
|
8632
8632
|
}
|
|
8633
8633
|
const data = e2.data;
|
|
8634
|
-
if (data.source === IncrementalSource.TouchMove) {
|
|
8635
|
-
return true;
|
|
8636
|
-
}
|
|
8637
8634
|
if (data.source === IncrementalSource.MouseInteraction && data.type === MouseInteractions.TouchStart) {
|
|
8638
8635
|
const mouseData = data;
|
|
8639
8636
|
return mouseData.pointerType === PointerTypes.Touch;
|
|
@@ -8658,7 +8655,6 @@ class Replayer {
|
|
|
8658
8655
|
this.firstFullSnapshot = null;
|
|
8659
8656
|
this.newDocumentQueue = [];
|
|
8660
8657
|
this.pointers = {};
|
|
8661
|
-
this.mouseTailAnimationFrame = null;
|
|
8662
8658
|
this.lastMouseDownEvent = null;
|
|
8663
8659
|
this.lastSelectionData = null;
|
|
8664
8660
|
this.constructedStyleMutations = [];
|
|
@@ -8797,53 +8793,6 @@ class Replayer {
|
|
|
8797
8793
|
};
|
|
8798
8794
|
return wrappedCastFn;
|
|
8799
8795
|
};
|
|
8800
|
-
this.stepMouseTails = (timestamp) => {
|
|
8801
|
-
const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);
|
|
8802
|
-
const maxAge = duration / this.speedService.state.context.timer.speed;
|
|
8803
|
-
let hasAnyTail = false;
|
|
8804
|
-
Object.values(this.pointers).forEach((pointer) => {
|
|
8805
|
-
if (!pointer.mouseTail) {
|
|
8806
|
-
return;
|
|
8807
|
-
}
|
|
8808
|
-
const mouseTail = pointer.mouseTail;
|
|
8809
|
-
const ctx = mouseTail.getContext("2d");
|
|
8810
|
-
if (!ctx) {
|
|
8811
|
-
return;
|
|
8812
|
-
}
|
|
8813
|
-
pointer.tailPositions = pointer.tailPositions.filter(
|
|
8814
|
-
(p) => timestamp - p.t <= maxAge
|
|
8815
|
-
);
|
|
8816
|
-
ctx.clearRect(0, 0, mouseTail.width, mouseTail.height);
|
|
8817
|
-
if (pointer.tailPositions.length > 1) {
|
|
8818
|
-
hasAnyTail = true;
|
|
8819
|
-
ctx.lineWidth = lineWidth;
|
|
8820
|
-
ctx.lineCap = lineCap;
|
|
8821
|
-
ctx.strokeStyle = strokeStyle;
|
|
8822
|
-
for (let i2 = 1; i2 < pointer.tailPositions.length; i2++) {
|
|
8823
|
-
const prev = pointer.tailPositions[i2 - 1];
|
|
8824
|
-
const curr = pointer.tailPositions[i2];
|
|
8825
|
-
const age = (timestamp - curr.t) / maxAge;
|
|
8826
|
-
const alpha = Math.max(0, 1 - age);
|
|
8827
|
-
if (alpha <= 0) {
|
|
8828
|
-
continue;
|
|
8829
|
-
}
|
|
8830
|
-
ctx.globalAlpha = alpha;
|
|
8831
|
-
ctx.beginPath();
|
|
8832
|
-
ctx.moveTo(prev.x, prev.y);
|
|
8833
|
-
ctx.lineTo(curr.x, curr.y);
|
|
8834
|
-
ctx.stroke();
|
|
8835
|
-
}
|
|
8836
|
-
ctx.globalAlpha = 1;
|
|
8837
|
-
}
|
|
8838
|
-
});
|
|
8839
|
-
if (hasAnyTail) {
|
|
8840
|
-
this.mouseTailAnimationFrame = requestAnimationFrame(
|
|
8841
|
-
this.stepMouseTails
|
|
8842
|
-
);
|
|
8843
|
-
} else {
|
|
8844
|
-
this.mouseTailAnimationFrame = null;
|
|
8845
|
-
}
|
|
8846
|
-
};
|
|
8847
8796
|
if (!config?.liveMode && events.length < 2) {
|
|
8848
8797
|
throw new Error("Replayer need at least 2 events.");
|
|
8849
8798
|
}
|
|
@@ -10385,12 +10334,38 @@ class Replayer {
|
|
|
10385
10334
|
if (!pointer || !pointer.mouseTail) {
|
|
10386
10335
|
return;
|
|
10387
10336
|
}
|
|
10337
|
+
const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);
|
|
10388
10338
|
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
10339
|
+
const maxAge = duration / this.speedService.state.context.timer.speed;
|
|
10389
10340
|
pointer.tailPositions.push({ x: position.x, y: position.y, t: now });
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10341
|
+
pointer.tailPositions = pointer.tailPositions.filter(
|
|
10342
|
+
(p) => now - p.t <= maxAge
|
|
10343
|
+
);
|
|
10344
|
+
const mouseTail = pointer.mouseTail;
|
|
10345
|
+
const ctx = mouseTail.getContext("2d");
|
|
10346
|
+
if (!ctx) {
|
|
10347
|
+
return;
|
|
10348
|
+
}
|
|
10349
|
+
ctx.clearRect(0, 0, mouseTail.width, mouseTail.height);
|
|
10350
|
+
if (pointer.tailPositions.length > 1) {
|
|
10351
|
+
ctx.lineWidth = lineWidth;
|
|
10352
|
+
ctx.lineCap = lineCap;
|
|
10353
|
+
ctx.strokeStyle = strokeStyle;
|
|
10354
|
+
for (let i2 = 1; i2 < pointer.tailPositions.length; i2++) {
|
|
10355
|
+
const prev = pointer.tailPositions[i2 - 1];
|
|
10356
|
+
const curr = pointer.tailPositions[i2];
|
|
10357
|
+
const age = (now - curr.t) / maxAge;
|
|
10358
|
+
const alpha = Math.max(0, 1 - age);
|
|
10359
|
+
if (alpha <= 0) {
|
|
10360
|
+
continue;
|
|
10361
|
+
}
|
|
10362
|
+
ctx.globalAlpha = alpha;
|
|
10363
|
+
ctx.beginPath();
|
|
10364
|
+
ctx.moveTo(prev.x, prev.y);
|
|
10365
|
+
ctx.lineTo(curr.x, curr.y);
|
|
10366
|
+
ctx.stroke();
|
|
10367
|
+
}
|
|
10368
|
+
ctx.globalAlpha = 1;
|
|
10394
10369
|
}
|
|
10395
10370
|
}
|
|
10396
10371
|
hoverElements(el) {
|