@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.cjs
CHANGED
|
@@ -8509,7 +8509,15 @@ const defaultMouseTailConfig = {
|
|
|
8509
8509
|
strokeStyle: "red"
|
|
8510
8510
|
};
|
|
8511
8511
|
function indicatesTouchDevice(e2) {
|
|
8512
|
-
|
|
8512
|
+
if (e2.type !== EventType.IncrementalSnapshot) {
|
|
8513
|
+
return false;
|
|
8514
|
+
}
|
|
8515
|
+
const data = e2.data;
|
|
8516
|
+
if (data.source === IncrementalSource.MouseInteraction && data.type === MouseInteractions.TouchStart) {
|
|
8517
|
+
const mouseData = data;
|
|
8518
|
+
return mouseData.pointerType === PointerTypes.Touch;
|
|
8519
|
+
}
|
|
8520
|
+
return false;
|
|
8513
8521
|
}
|
|
8514
8522
|
function getPointerId(d) {
|
|
8515
8523
|
const pointerId = "pointerId" in d && typeof d.pointerId === "number" ? d.pointerId : -1;
|
|
@@ -10191,34 +10199,38 @@ class Replayer {
|
|
|
10191
10199
|
return;
|
|
10192
10200
|
}
|
|
10193
10201
|
const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);
|
|
10194
|
-
const
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10202
|
+
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
10203
|
+
const maxAge = duration / this.speedService.state.context.timer.speed;
|
|
10204
|
+
pointer.tailPositions.push({ x: position.x, y: position.y, t: now });
|
|
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) {
|
|
10205
10215
|
ctx.lineWidth = lineWidth;
|
|
10206
10216
|
ctx.lineCap = lineCap;
|
|
10207
10217
|
ctx.strokeStyle = strokeStyle;
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
);
|
|
10219
|
-
|
|
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();
|
|
10220
10231
|
}
|
|
10221
|
-
|
|
10232
|
+
ctx.globalAlpha = 1;
|
|
10233
|
+
}
|
|
10222
10234
|
}
|
|
10223
10235
|
hoverElements(el) {
|
|
10224
10236
|
const iframeDoc = getIFrameContentDocument(this.iframe);
|