@anyreplay/browser 0.1.3 → 0.1.4

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/index.js CHANGED
@@ -4233,17 +4233,17 @@ function createRecorder(rawOptions) {
4233
4233
  const noteInteraction = (event, channel) => {
4234
4234
  var _a;
4235
4235
  const data = event.data;
4236
- if (event.type !== 3 || (data == null ? void 0 : data.source) !== 2 || typeof data.x !== "number") return;
4236
+ if (event.type !== 3 || (data == null ? void 0 : data.source) !== 2 || data.type !== 2 || typeof data.x !== "number") return;
4237
4237
  const now = event.timestamp;
4238
4238
  recentClicks.push({ x: data.x, y: (_a = data.y) != null ? _a : 0, t: now });
4239
4239
  while (recentClicks.length > 0 && now - recentClicks[0].t > RAGE_CLICK_WINDOW_MS) recentClicks.shift();
4240
- if (recentClicks.length >= RAGE_CLICK_COUNT) {
4241
- const first = recentClicks[0];
4242
- const clustered = recentClicks.every(
4243
- (c) => Math.abs(c.x - first.x) < RAGE_CLICK_RADIUS_PX && Math.abs(c.y - first.y) < RAGE_CLICK_RADIUS_PX
4244
- );
4245
- if (clustered) channel.mergeFlags({ hasRageClick: true });
4246
- }
4240
+ const near = recentClicks.filter(
4241
+ (c) => {
4242
+ var _a2;
4243
+ return Math.abs(c.x - data.x) < RAGE_CLICK_RADIUS_PX && Math.abs(c.y - ((_a2 = data.y) != null ? _a2 : 0)) < RAGE_CLICK_RADIUS_PX;
4244
+ }
4245
+ );
4246
+ if (near.length >= RAGE_CLICK_COUNT) channel.mergeFlags({ hasRageClick: true });
4247
4247
  };
4248
4248
  const pending = [];
4249
4249
  let draining = false;