@geekybones/canvas-kit 1.2.0 → 1.2.1

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.
@@ -13188,17 +13188,18 @@ var vf = class {
13188
13188
  return r.x >= n.x && r.x <= n.x + n.width && r.y >= n.y && r.y <= n.y + n.height;
13189
13189
  }
13190
13190
  update(e) {
13191
- if (e.length === 0) {
13191
+ let t = e.filter((e) => e.getOptions().visible !== !1);
13192
+ if (t.length === 0) {
13192
13193
  this.selectionRect = null, this.container.visible = !1;
13193
13194
  return;
13194
13195
  }
13195
- if (this.container.visible = this.isVisible, e.length === 1) {
13196
- let [t] = e;
13197
- t && this.updateSingle(t);
13196
+ if (this.container.visible = this.isVisible, t.length === 1) {
13197
+ let [e] = t;
13198
+ e && this.updateSingle(e);
13198
13199
  } else {
13199
13200
  this.container.position.set(0, 0), this.container.rotation = 0;
13200
- let t = this.padRect(cf.getCombinedBoundingRect(e));
13201
- this.selectionRect = t, this.drawRect(t), this.positionHandles(t);
13201
+ let e = this.padRect(cf.getCombinedBoundingRect(t));
13202
+ this.selectionRect = e, this.drawRect(e), this.positionHandles(e);
13202
13203
  }
13203
13204
  }
13204
13205
  hide() {
@@ -13211,10 +13212,28 @@ var vf = class {
13211
13212
  this.container.destroy({ children: !0 });
13212
13213
  }
13213
13214
  updateSingle(e) {
13214
- let t = e.getDisplayObject(), n = t.getLocalBounds(), r = t.worldTransform, i = n.x + n.width / 2, a = n.y + n.height / 2, o = r.a * i + r.c * a + r.tx, s = r.b * i + r.d * a + r.ty, c = Math.sqrt(r.a * r.a + r.b * r.b), l = Math.sqrt(r.c * r.c + r.d * r.d), u = Math.atan2(r.b, r.a), d = n.width * c, f = n.height * l;
13215
- this.container.position.set(o, s), this.container.rotation = u;
13216
- let p = this.padRect(new h(-d / 2, -f / 2, d, f));
13217
- this.selectionRect = p, this.drawRect(p), this.positionHandles(p);
13215
+ let t = e.getDisplayObject(), n = e.getOptions().rotationDeg ?? 0;
13216
+ if (Math.abs(n) < 1e-6) {
13217
+ this.updateSingleAxisAligned(t);
13218
+ return;
13219
+ }
13220
+ this.updateSingleRotated(t);
13221
+ }
13222
+ updateSingleAxisAligned(e) {
13223
+ this.container.position.set(0, 0), this.container.rotation = 0;
13224
+ let t = e.getBounds(), n = this.container.parent;
13225
+ if (!n) return;
13226
+ let r = n.toLocal({
13227
+ x: t.x,
13228
+ y: t.y
13229
+ }), i = this.padRect(new h(r.x, r.y, t.width, t.height));
13230
+ this.selectionRect = i, this.drawRect(i), this.positionHandles(i);
13231
+ }
13232
+ updateSingleRotated(e) {
13233
+ let t = e.getLocalBounds(), n = e.worldTransform, r = t.x + t.width / 2, i = t.y + t.height / 2, a = n.a * r + n.c * i + n.tx, o = n.b * r + n.d * i + n.ty, s = Math.sqrt(n.a * n.a + n.b * n.b), c = Math.sqrt(n.c * n.c + n.d * n.d), l = Math.atan2(n.b, n.a), u = t.width * s, d = t.height * c;
13234
+ this.container.position.set(a, o), this.container.rotation = l;
13235
+ let f = this.padRect(new h(-u / 2, -d / 2, u, d));
13236
+ this.selectionRect = f, this.drawRect(f), this.positionHandles(f);
13218
13237
  }
13219
13238
  padRect(e) {
13220
13239
  let t = this.theme.boundingBox?.padding ?? Sf;