@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.umd.cjs
CHANGED
|
@@ -8627,7 +8627,15 @@ const defaultMouseTailConfig = {
|
|
|
8627
8627
|
strokeStyle: "red"
|
|
8628
8628
|
};
|
|
8629
8629
|
function indicatesTouchDevice(e2) {
|
|
8630
|
-
|
|
8630
|
+
if (e2.type !== EventType.IncrementalSnapshot) {
|
|
8631
|
+
return false;
|
|
8632
|
+
}
|
|
8633
|
+
const data = e2.data;
|
|
8634
|
+
if (data.source === IncrementalSource.MouseInteraction && data.type === MouseInteractions.TouchStart) {
|
|
8635
|
+
const mouseData = data;
|
|
8636
|
+
return mouseData.pointerType === PointerTypes.Touch;
|
|
8637
|
+
}
|
|
8638
|
+
return false;
|
|
8631
8639
|
}
|
|
8632
8640
|
function getPointerId(d) {
|
|
8633
8641
|
const pointerId = "pointerId" in d && typeof d.pointerId === "number" ? d.pointerId : -1;
|
|
@@ -10327,34 +10335,38 @@ class Replayer {
|
|
|
10327
10335
|
return;
|
|
10328
10336
|
}
|
|
10329
10337
|
const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);
|
|
10330
|
-
const
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10338
|
+
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
10339
|
+
const maxAge = duration / this.speedService.state.context.timer.speed;
|
|
10340
|
+
pointer.tailPositions.push({ x: position.x, y: position.y, t: now });
|
|
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) {
|
|
10341
10351
|
ctx.lineWidth = lineWidth;
|
|
10342
10352
|
ctx.lineCap = lineCap;
|
|
10343
10353
|
ctx.strokeStyle = strokeStyle;
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
);
|
|
10355
|
-
|
|
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();
|
|
10356
10367
|
}
|
|
10357
|
-
|
|
10368
|
+
ctx.globalAlpha = 1;
|
|
10369
|
+
}
|
|
10358
10370
|
}
|
|
10359
10371
|
hoverElements(el) {
|
|
10360
10372
|
const iframeDoc = getIFrameContentDocument(this.iframe);
|