microboard-temp 0.5.131 → 0.5.133

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.
@@ -4,39 +4,60 @@ var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
- var __moduleCache = /* @__PURE__ */ new WeakMap;
19
32
  var __toCommonJS = (from) => {
20
- var entry = __moduleCache.get(from), desc;
33
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
21
34
  if (entry)
22
35
  return entry;
23
36
  entry = __defProp({}, "__esModule", { value: true });
24
- if (from && typeof from === "object" || typeof from === "function")
25
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
26
- get: () => from[key],
27
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
28
- }));
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (var key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(entry, key))
40
+ __defProp(entry, key, {
41
+ get: __accessProp.bind(from, key),
42
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
43
+ });
44
+ }
29
45
  __moduleCache.set(from, entry);
30
46
  return entry;
31
47
  };
48
+ var __moduleCache;
32
49
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
50
+ var __returnValue = (v) => v;
51
+ function __exportSetter(name, newValue) {
52
+ this[name] = __returnValue.bind(null, newValue);
53
+ }
33
54
  var __export = (target, all) => {
34
55
  for (var name in all)
35
56
  __defProp(target, name, {
36
57
  get: all[name],
37
58
  enumerable: true,
38
59
  configurable: true,
39
- set: (newValue) => all[name] = () => newValue
60
+ set: __exportSetter.bind(all, name)
40
61
  });
41
62
  };
42
63
 
@@ -18930,15 +18951,9 @@ class CommentCommand {
18930
18951
  }
18931
18952
  }
18932
18953
  }
18933
-
18934
- // node_modules/uuid/dist/esm-browser/stringify.js
18935
- var byteToHex = [];
18936
- for (let i = 0;i < 256; ++i) {
18937
- byteToHex.push((i + 256).toString(16).slice(1));
18938
- }
18939
- function unsafeStringify(arr2, offset = 0) {
18940
- return (byteToHex[arr2[offset + 0]] + byteToHex[arr2[offset + 1]] + byteToHex[arr2[offset + 2]] + byteToHex[arr2[offset + 3]] + "-" + byteToHex[arr2[offset + 4]] + byteToHex[arr2[offset + 5]] + "-" + byteToHex[arr2[offset + 6]] + byteToHex[arr2[offset + 7]] + "-" + byteToHex[arr2[offset + 8]] + byteToHex[arr2[offset + 9]] + "-" + byteToHex[arr2[offset + 10]] + byteToHex[arr2[offset + 11]] + byteToHex[arr2[offset + 12]] + byteToHex[arr2[offset + 13]] + byteToHex[arr2[offset + 14]] + byteToHex[arr2[offset + 15]]).toLowerCase();
18941
- }
18954
+ // node_modules/uuid/dist/esm-browser/native.js
18955
+ var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
18956
+ var native_default = { randomUUID };
18942
18957
 
18943
18958
  // node_modules/uuid/dist/esm-browser/rng.js
18944
18959
  var getRandomValues;
@@ -18953,9 +18968,14 @@ function rng() {
18953
18968
  return getRandomValues(rnds8);
18954
18969
  }
18955
18970
 
18956
- // node_modules/uuid/dist/esm-browser/native.js
18957
- var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
18958
- var native_default = { randomUUID };
18971
+ // node_modules/uuid/dist/esm-browser/stringify.js
18972
+ var byteToHex = [];
18973
+ for (let i = 0;i < 256; ++i) {
18974
+ byteToHex.push((i + 256).toString(16).slice(1));
18975
+ }
18976
+ function unsafeStringify(arr2, offset = 0) {
18977
+ return (byteToHex[arr2[offset + 0]] + byteToHex[arr2[offset + 1]] + byteToHex[arr2[offset + 2]] + byteToHex[arr2[offset + 3]] + "-" + byteToHex[arr2[offset + 4]] + byteToHex[arr2[offset + 5]] + "-" + byteToHex[arr2[offset + 6]] + byteToHex[arr2[offset + 7]] + "-" + byteToHex[arr2[offset + 8]] + byteToHex[arr2[offset + 9]] + "-" + byteToHex[arr2[offset + 10]] + byteToHex[arr2[offset + 11]] + byteToHex[arr2[offset + 12]] + byteToHex[arr2[offset + 13]] + byteToHex[arr2[offset + 14]] + byteToHex[arr2[offset + 15]]).toLowerCase();
18978
+ }
18959
18979
 
18960
18980
  // node_modules/uuid/dist/esm-browser/v4.js
18961
18981
  function v4(options, buf, offset) {
@@ -19001,6 +19021,10 @@ class Comment {
19001
19021
  linkTo;
19002
19022
  transformationRenderBlock = undefined;
19003
19023
  resizeEnabled = true;
19024
+ index = null;
19025
+ canBeNested = false;
19026
+ children = [];
19027
+ onRemoveCallbacks = [];
19004
19028
  constructor(anchor = new Point, events, id = "") {
19005
19029
  this.anchor = anchor;
19006
19030
  this.events = events;
@@ -19305,6 +19329,17 @@ class Comment {
19305
19329
  getSnapAnchorPoints() {
19306
19330
  return null;
19307
19331
  }
19332
+ getChildrenIds() {
19333
+ return null;
19334
+ }
19335
+ addChildItems(_children) {}
19336
+ removeChildItems(_children) {}
19337
+ emitNesting(_children) {}
19338
+ handleNesting(_item) {
19339
+ return false;
19340
+ }
19341
+ addOnRemoveCallback(_cb) {}
19342
+ onRemove() {}
19308
19343
  render(context) {}
19309
19344
  renderHTML(documentFactory) {
19310
19345
  const div = documentFactory.createElement("comment-item");
@@ -34398,10 +34433,10 @@ function zwitch(key, options) {
34398
34433
  const settings = options || {};
34399
34434
  function one4(value, ...parameters) {
34400
34435
  let fn = one4.invalid;
34401
- const handlers2 = one4.handlers;
34436
+ const handlers3 = one4.handlers;
34402
34437
  if (value && own6.call(value, key)) {
34403
34438
  const id = String(value[key]);
34404
- fn = own6.call(handlers2, id) ? handlers2[id] : one4.unknown;
34439
+ fn = own6.call(handlers3, id) ? handlers3[id] : one4.unknown;
34405
34440
  }
34406
34441
  if (fn) {
34407
34442
  return fn.call(this, value, ...parameters);
@@ -49287,6 +49322,8 @@ class Camera {
49287
49322
  observableItem = null;
49288
49323
  throttledZoom;
49289
49324
  isAnimating = false;
49325
+ isTrackingAnimation = false;
49326
+ trackingAnimationId = null;
49290
49327
  constructor(boardPointer = new Pointer) {
49291
49328
  this.boardPointer = boardPointer;
49292
49329
  this.subject.subscribe((_camera) => {
@@ -49440,6 +49477,45 @@ class Camera {
49440
49477
  this.matrix = new Matrix2(matrix.translateX, matrix.translateY, matrix.scaleX, matrix.scaleY, matrix.shearX, matrix.shearY);
49441
49478
  this.subject.publish(this);
49442
49479
  }
49480
+ animateToMatrix(target, duration = 130) {
49481
+ if (this.trackingAnimationId !== null) {
49482
+ cancelAnimationFrame(this.trackingAnimationId);
49483
+ this.trackingAnimationId = null;
49484
+ }
49485
+ const startTranslateX = this.matrix.translateX;
49486
+ const startTranslateY = this.matrix.translateY;
49487
+ const startScaleX = this.matrix.scaleX;
49488
+ const startScaleY = this.matrix.scaleY;
49489
+ const startShearX = this.matrix.shearX;
49490
+ const startShearY = this.matrix.shearY;
49491
+ this.isTrackingAnimation = true;
49492
+ const startTime = performance.now();
49493
+ const animate = () => {
49494
+ const progress = Math.min((performance.now() - startTime) / duration, 1);
49495
+ const t3 = this.easeOutQuad(progress);
49496
+ this.matrix.translateX = this.lerp(startTranslateX, target.translateX, t3);
49497
+ this.matrix.translateY = this.lerp(startTranslateY, target.translateY, t3);
49498
+ this.matrix.scaleX = this.lerp(startScaleX, target.scaleX, t3);
49499
+ this.matrix.scaleY = this.lerp(startScaleY, target.scaleY, t3);
49500
+ this.matrix.shearX = this.lerp(startShearX, target.shearX, t3);
49501
+ this.matrix.shearY = this.lerp(startShearY, target.shearY, t3);
49502
+ this.subject.publish(this);
49503
+ if (progress < 1) {
49504
+ this.trackingAnimationId = safeRequestAnimationFrame(animate) || null;
49505
+ } else {
49506
+ this.trackingAnimationId = null;
49507
+ this.isTrackingAnimation = false;
49508
+ }
49509
+ };
49510
+ this.trackingAnimationId = safeRequestAnimationFrame(animate) || null;
49511
+ }
49512
+ cancelTrackingAnimation() {
49513
+ if (this.trackingAnimationId !== null) {
49514
+ cancelAnimationFrame(this.trackingAnimationId);
49515
+ this.trackingAnimationId = null;
49516
+ }
49517
+ this.isTrackingAnimation = false;
49518
+ }
49443
49519
  useSavedSnapshot(optionalMatrix) {
49444
49520
  if (optionalMatrix) {
49445
49521
  this.applyMatrix(optionalMatrix);
@@ -50714,7 +50790,7 @@ class Presence {
50714
50790
  const checkIsDisableTrackingNeeded = this.getIsDisableTrackingNeeded.bind(this);
50715
50791
  this.board.camera.subject.subscribe((_camera) => {
50716
50792
  throttleCameraEvent(this.board.camera);
50717
- if (checkIsDisableTrackingNeeded()) {
50793
+ if (!this.board.camera.isTrackingAnimation && checkIsDisableTrackingNeeded()) {
50718
50794
  this.disableTracking();
50719
50795
  }
50720
50796
  });
@@ -50975,7 +51051,7 @@ class Presence {
50975
51051
  this.users.set(msg.userId.toString(), userCopy);
50976
51052
  if (this.trackedUser) {
50977
51053
  this.trackedUser.camera = eventData;
50978
- this.board.camera.applyMatrix(new Matrix2(eventData.translateX, eventData.translateY, eventData.scaleX, eventData.scaleY, eventData.shearX, eventData.shearY));
51054
+ this.board.camera.animateToMatrix(new Matrix2(eventData.translateX, eventData.translateY, eventData.scaleX, eventData.scaleY, eventData.shearX, eventData.shearY));
50979
51055
  }
50980
51056
  }
50981
51057
  processDrawSelect(msg) {
@@ -51037,6 +51113,7 @@ class Presence {
51037
51113
  if (!this.trackedUser) {
51038
51114
  return;
51039
51115
  }
51116
+ this.board.camera.cancelTrackingAnimation();
51040
51117
  this.emit({
51041
51118
  method: "StopFollowing",
51042
51119
  timestamp: Date.now(),
@@ -53124,22 +53201,24 @@ class BoardSelection {
53124
53201
  console.warn(`Didnt find frame with id ${val.item.parent}`);
53125
53202
  }
53126
53203
  }
53127
- const childrenIds = val.item.getChildrenIds();
53128
- if (childrenIds && checkFrames) {
53129
- const currGroup = val.item;
53130
- const currMbr = currGroup.getMbr();
53131
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53132
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53133
- const uniqueItems = new Set;
53134
- const toCheck = [...children, ...underGroup].filter((item) => {
53135
- const id = item.getId();
53136
- if (uniqueItems.has(id)) {
53137
- return false;
53138
- }
53139
- uniqueItems.add(id);
53140
- return true;
53141
- });
53142
- currGroup.emitNesting(toCheck);
53204
+ if (checkFrames) {
53205
+ const childrenIds = val.item.getChildrenIds();
53206
+ if (childrenIds) {
53207
+ const currGroup = val.item;
53208
+ const currMbr = currGroup.getMbr();
53209
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53210
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53211
+ const uniqueItems = new Set;
53212
+ const toCheck = [...children, ...underGroup].filter((item) => {
53213
+ const id = item.getId();
53214
+ if (uniqueItems.has(id)) {
53215
+ return false;
53216
+ }
53217
+ uniqueItems.add(id);
53218
+ return true;
53219
+ });
53220
+ currGroup.emitNesting(toCheck);
53221
+ }
53143
53222
  }
53144
53223
  });
53145
53224
  }
@@ -56633,16 +56712,16 @@ function createEvents(board, connection, lastIndex) {
56633
56712
  }
56634
56713
  // src/Events/MessageRouter/createMessageRouter.ts
56635
56714
  function createMessageRouter() {
56636
- const handlers2 = new Map;
56715
+ const handlers3 = new Map;
56637
56716
  function addHandler(type, handler) {
56638
- handlers2.set(type, (message, board) => {
56717
+ handlers3.set(type, (message, board) => {
56639
56718
  if (message.type === type) {
56640
56719
  handler(message, board);
56641
56720
  }
56642
56721
  });
56643
56722
  }
56644
56723
  function handleMessage(message, board) {
56645
- const handler = handlers2.get(message.type);
56724
+ const handler = handlers3.get(message.type);
56646
56725
  if (handler) {
56647
56726
  handler(message, board);
56648
56727
  } else {
package/dist/cjs/index.js CHANGED
@@ -4,39 +4,60 @@ var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
- var __moduleCache = /* @__PURE__ */ new WeakMap;
19
32
  var __toCommonJS = (from) => {
20
- var entry = __moduleCache.get(from), desc;
33
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
21
34
  if (entry)
22
35
  return entry;
23
36
  entry = __defProp({}, "__esModule", { value: true });
24
- if (from && typeof from === "object" || typeof from === "function")
25
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
26
- get: () => from[key],
27
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
28
- }));
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (var key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(entry, key))
40
+ __defProp(entry, key, {
41
+ get: __accessProp.bind(from, key),
42
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
43
+ });
44
+ }
29
45
  __moduleCache.set(from, entry);
30
46
  return entry;
31
47
  };
48
+ var __moduleCache;
32
49
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
50
+ var __returnValue = (v) => v;
51
+ function __exportSetter(name, newValue) {
52
+ this[name] = __returnValue.bind(null, newValue);
53
+ }
33
54
  var __export = (target, all) => {
34
55
  for (var name in all)
35
56
  __defProp(target, name, {
36
57
  get: all[name],
37
58
  enumerable: true,
38
59
  configurable: true,
39
- set: (newValue) => all[name] = () => newValue
60
+ set: __exportSetter.bind(all, name)
40
61
  });
41
62
  };
42
63
 
@@ -18930,15 +18951,9 @@ class CommentCommand {
18930
18951
  }
18931
18952
  }
18932
18953
  }
18933
-
18934
- // node_modules/uuid/dist/esm-browser/stringify.js
18935
- var byteToHex = [];
18936
- for (let i = 0;i < 256; ++i) {
18937
- byteToHex.push((i + 256).toString(16).slice(1));
18938
- }
18939
- function unsafeStringify(arr2, offset = 0) {
18940
- return (byteToHex[arr2[offset + 0]] + byteToHex[arr2[offset + 1]] + byteToHex[arr2[offset + 2]] + byteToHex[arr2[offset + 3]] + "-" + byteToHex[arr2[offset + 4]] + byteToHex[arr2[offset + 5]] + "-" + byteToHex[arr2[offset + 6]] + byteToHex[arr2[offset + 7]] + "-" + byteToHex[arr2[offset + 8]] + byteToHex[arr2[offset + 9]] + "-" + byteToHex[arr2[offset + 10]] + byteToHex[arr2[offset + 11]] + byteToHex[arr2[offset + 12]] + byteToHex[arr2[offset + 13]] + byteToHex[arr2[offset + 14]] + byteToHex[arr2[offset + 15]]).toLowerCase();
18941
- }
18954
+ // node_modules/uuid/dist/esm-browser/native.js
18955
+ var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
18956
+ var native_default = { randomUUID };
18942
18957
 
18943
18958
  // node_modules/uuid/dist/esm-browser/rng.js
18944
18959
  var getRandomValues;
@@ -18953,9 +18968,14 @@ function rng() {
18953
18968
  return getRandomValues(rnds8);
18954
18969
  }
18955
18970
 
18956
- // node_modules/uuid/dist/esm-browser/native.js
18957
- var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
18958
- var native_default = { randomUUID };
18971
+ // node_modules/uuid/dist/esm-browser/stringify.js
18972
+ var byteToHex = [];
18973
+ for (let i = 0;i < 256; ++i) {
18974
+ byteToHex.push((i + 256).toString(16).slice(1));
18975
+ }
18976
+ function unsafeStringify(arr2, offset = 0) {
18977
+ return (byteToHex[arr2[offset + 0]] + byteToHex[arr2[offset + 1]] + byteToHex[arr2[offset + 2]] + byteToHex[arr2[offset + 3]] + "-" + byteToHex[arr2[offset + 4]] + byteToHex[arr2[offset + 5]] + "-" + byteToHex[arr2[offset + 6]] + byteToHex[arr2[offset + 7]] + "-" + byteToHex[arr2[offset + 8]] + byteToHex[arr2[offset + 9]] + "-" + byteToHex[arr2[offset + 10]] + byteToHex[arr2[offset + 11]] + byteToHex[arr2[offset + 12]] + byteToHex[arr2[offset + 13]] + byteToHex[arr2[offset + 14]] + byteToHex[arr2[offset + 15]]).toLowerCase();
18978
+ }
18959
18979
 
18960
18980
  // node_modules/uuid/dist/esm-browser/v4.js
18961
18981
  function v4(options, buf, offset) {
@@ -19001,6 +19021,10 @@ class Comment {
19001
19021
  linkTo;
19002
19022
  transformationRenderBlock = undefined;
19003
19023
  resizeEnabled = true;
19024
+ index = null;
19025
+ canBeNested = false;
19026
+ children = [];
19027
+ onRemoveCallbacks = [];
19004
19028
  constructor(anchor = new Point, events, id = "") {
19005
19029
  this.anchor = anchor;
19006
19030
  this.events = events;
@@ -19305,6 +19329,17 @@ class Comment {
19305
19329
  getSnapAnchorPoints() {
19306
19330
  return null;
19307
19331
  }
19332
+ getChildrenIds() {
19333
+ return null;
19334
+ }
19335
+ addChildItems(_children) {}
19336
+ removeChildItems(_children) {}
19337
+ emitNesting(_children) {}
19338
+ handleNesting(_item) {
19339
+ return false;
19340
+ }
19341
+ addOnRemoveCallback(_cb) {}
19342
+ onRemove() {}
19308
19343
  render(context) {}
19309
19344
  renderHTML(documentFactory) {
19310
19345
  const div = documentFactory.createElement("comment-item");
@@ -34398,10 +34433,10 @@ function zwitch(key, options) {
34398
34433
  const settings = options || {};
34399
34434
  function one4(value, ...parameters) {
34400
34435
  let fn = one4.invalid;
34401
- const handlers2 = one4.handlers;
34436
+ const handlers3 = one4.handlers;
34402
34437
  if (value && own6.call(value, key)) {
34403
34438
  const id = String(value[key]);
34404
- fn = own6.call(handlers2, id) ? handlers2[id] : one4.unknown;
34439
+ fn = own6.call(handlers3, id) ? handlers3[id] : one4.unknown;
34405
34440
  }
34406
34441
  if (fn) {
34407
34442
  return fn.call(this, value, ...parameters);
@@ -49287,6 +49322,8 @@ class Camera {
49287
49322
  observableItem = null;
49288
49323
  throttledZoom;
49289
49324
  isAnimating = false;
49325
+ isTrackingAnimation = false;
49326
+ trackingAnimationId = null;
49290
49327
  constructor(boardPointer = new Pointer) {
49291
49328
  this.boardPointer = boardPointer;
49292
49329
  this.subject.subscribe((_camera) => {
@@ -49440,6 +49477,45 @@ class Camera {
49440
49477
  this.matrix = new Matrix2(matrix.translateX, matrix.translateY, matrix.scaleX, matrix.scaleY, matrix.shearX, matrix.shearY);
49441
49478
  this.subject.publish(this);
49442
49479
  }
49480
+ animateToMatrix(target, duration = 130) {
49481
+ if (this.trackingAnimationId !== null) {
49482
+ cancelAnimationFrame(this.trackingAnimationId);
49483
+ this.trackingAnimationId = null;
49484
+ }
49485
+ const startTranslateX = this.matrix.translateX;
49486
+ const startTranslateY = this.matrix.translateY;
49487
+ const startScaleX = this.matrix.scaleX;
49488
+ const startScaleY = this.matrix.scaleY;
49489
+ const startShearX = this.matrix.shearX;
49490
+ const startShearY = this.matrix.shearY;
49491
+ this.isTrackingAnimation = true;
49492
+ const startTime = performance.now();
49493
+ const animate = () => {
49494
+ const progress = Math.min((performance.now() - startTime) / duration, 1);
49495
+ const t3 = this.easeOutQuad(progress);
49496
+ this.matrix.translateX = this.lerp(startTranslateX, target.translateX, t3);
49497
+ this.matrix.translateY = this.lerp(startTranslateY, target.translateY, t3);
49498
+ this.matrix.scaleX = this.lerp(startScaleX, target.scaleX, t3);
49499
+ this.matrix.scaleY = this.lerp(startScaleY, target.scaleY, t3);
49500
+ this.matrix.shearX = this.lerp(startShearX, target.shearX, t3);
49501
+ this.matrix.shearY = this.lerp(startShearY, target.shearY, t3);
49502
+ this.subject.publish(this);
49503
+ if (progress < 1) {
49504
+ this.trackingAnimationId = safeRequestAnimationFrame(animate) || null;
49505
+ } else {
49506
+ this.trackingAnimationId = null;
49507
+ this.isTrackingAnimation = false;
49508
+ }
49509
+ };
49510
+ this.trackingAnimationId = safeRequestAnimationFrame(animate) || null;
49511
+ }
49512
+ cancelTrackingAnimation() {
49513
+ if (this.trackingAnimationId !== null) {
49514
+ cancelAnimationFrame(this.trackingAnimationId);
49515
+ this.trackingAnimationId = null;
49516
+ }
49517
+ this.isTrackingAnimation = false;
49518
+ }
49443
49519
  useSavedSnapshot(optionalMatrix) {
49444
49520
  if (optionalMatrix) {
49445
49521
  this.applyMatrix(optionalMatrix);
@@ -50714,7 +50790,7 @@ class Presence {
50714
50790
  const checkIsDisableTrackingNeeded = this.getIsDisableTrackingNeeded.bind(this);
50715
50791
  this.board.camera.subject.subscribe((_camera) => {
50716
50792
  throttleCameraEvent(this.board.camera);
50717
- if (checkIsDisableTrackingNeeded()) {
50793
+ if (!this.board.camera.isTrackingAnimation && checkIsDisableTrackingNeeded()) {
50718
50794
  this.disableTracking();
50719
50795
  }
50720
50796
  });
@@ -50975,7 +51051,7 @@ class Presence {
50975
51051
  this.users.set(msg.userId.toString(), userCopy);
50976
51052
  if (this.trackedUser) {
50977
51053
  this.trackedUser.camera = eventData;
50978
- this.board.camera.applyMatrix(new Matrix2(eventData.translateX, eventData.translateY, eventData.scaleX, eventData.scaleY, eventData.shearX, eventData.shearY));
51054
+ this.board.camera.animateToMatrix(new Matrix2(eventData.translateX, eventData.translateY, eventData.scaleX, eventData.scaleY, eventData.shearX, eventData.shearY));
50979
51055
  }
50980
51056
  }
50981
51057
  processDrawSelect(msg) {
@@ -51037,6 +51113,7 @@ class Presence {
51037
51113
  if (!this.trackedUser) {
51038
51114
  return;
51039
51115
  }
51116
+ this.board.camera.cancelTrackingAnimation();
51040
51117
  this.emit({
51041
51118
  method: "StopFollowing",
51042
51119
  timestamp: Date.now(),
@@ -53124,22 +53201,24 @@ class BoardSelection {
53124
53201
  console.warn(`Didnt find frame with id ${val.item.parent}`);
53125
53202
  }
53126
53203
  }
53127
- const childrenIds = val.item.getChildrenIds();
53128
- if (childrenIds && checkFrames) {
53129
- const currGroup = val.item;
53130
- const currMbr = currGroup.getMbr();
53131
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53132
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53133
- const uniqueItems = new Set;
53134
- const toCheck = [...children, ...underGroup].filter((item) => {
53135
- const id = item.getId();
53136
- if (uniqueItems.has(id)) {
53137
- return false;
53138
- }
53139
- uniqueItems.add(id);
53140
- return true;
53141
- });
53142
- currGroup.emitNesting(toCheck);
53204
+ if (checkFrames) {
53205
+ const childrenIds = val.item.getChildrenIds();
53206
+ if (childrenIds) {
53207
+ const currGroup = val.item;
53208
+ const currMbr = currGroup.getMbr();
53209
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
53210
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
53211
+ const uniqueItems = new Set;
53212
+ const toCheck = [...children, ...underGroup].filter((item) => {
53213
+ const id = item.getId();
53214
+ if (uniqueItems.has(id)) {
53215
+ return false;
53216
+ }
53217
+ uniqueItems.add(id);
53218
+ return true;
53219
+ });
53220
+ currGroup.emitNesting(toCheck);
53221
+ }
53143
53222
  }
53144
53223
  });
53145
53224
  }
@@ -56633,16 +56712,16 @@ function createEvents(board, connection, lastIndex) {
56633
56712
  }
56634
56713
  // src/Events/MessageRouter/createMessageRouter.ts
56635
56714
  function createMessageRouter() {
56636
- const handlers2 = new Map;
56715
+ const handlers3 = new Map;
56637
56716
  function addHandler(type, handler) {
56638
- handlers2.set(type, (message, board) => {
56717
+ handlers3.set(type, (message, board) => {
56639
56718
  if (message.type === type) {
56640
56719
  handler(message, board);
56641
56720
  }
56642
56721
  });
56643
56722
  }
56644
56723
  function handleMessage(message, board) {
56645
- const handler = handlers2.get(message.type);
56724
+ const handler = handlers3.get(message.type);
56646
56725
  if (handler) {
56647
56726
  handler(message, board);
56648
56727
  } else {