@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.cjs CHANGED
@@ -4266,17 +4266,17 @@ function createRecorder(rawOptions) {
4266
4266
  const noteInteraction = (event, channel) => {
4267
4267
  var _a;
4268
4268
  const data = event.data;
4269
- if (event.type !== 3 || (data == null ? void 0 : data.source) !== 2 || typeof data.x !== "number") return;
4269
+ if (event.type !== 3 || (data == null ? void 0 : data.source) !== 2 || data.type !== 2 || typeof data.x !== "number") return;
4270
4270
  const now = event.timestamp;
4271
4271
  recentClicks.push({ x: data.x, y: (_a = data.y) != null ? _a : 0, t: now });
4272
4272
  while (recentClicks.length > 0 && now - recentClicks[0].t > RAGE_CLICK_WINDOW_MS) recentClicks.shift();
4273
- if (recentClicks.length >= RAGE_CLICK_COUNT) {
4274
- const first = recentClicks[0];
4275
- const clustered = recentClicks.every(
4276
- (c) => Math.abs(c.x - first.x) < RAGE_CLICK_RADIUS_PX && Math.abs(c.y - first.y) < RAGE_CLICK_RADIUS_PX
4277
- );
4278
- if (clustered) channel.mergeFlags({ hasRageClick: true });
4279
- }
4273
+ const near = recentClicks.filter(
4274
+ (c) => {
4275
+ var _a2;
4276
+ 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;
4277
+ }
4278
+ );
4279
+ if (near.length >= RAGE_CLICK_COUNT) channel.mergeFlags({ hasRageClick: true });
4280
4280
  };
4281
4281
  const pending = [];
4282
4282
  let draining = false;