Bin
2025-12-17 d616898802dfe7e5dd648bcf53c6d1f86b6d3642
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { BoundingBox } from "./BoundingBox";
 
/* eslint-disable no-unused-expressions */
export class RelationShape {
  params = {};
 
  _onUpdated = null;
 
  constructor(params) {
    Object.assign(this.params, params);
 
    if (this.params.watcher) {
      this._watcher = new this.params.watcher(this.params.root, this.params.element, this.onChanged);
    }
  }
 
  boundingBox() {
    return BoundingBox.bbox(this.params.element);
  }
 
  onUpdate(callback) {
    this.onUpdated = callback;
  }
 
  onChanged = () => {
    this.onUpdated?.();
  };
 
  destroy() {
    this.onUpdated = null;
  }
}