endset_three_editor 0.3.9 → 0.4.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.
@@ -1583,6 +1583,7 @@ function _t() {
1583
1583
  I.selectedObject && (Jt(), I.transformControls.detach(), I.selectedObject = null, Te == null || Te(null));
1584
1584
  }
1585
1585
  function Ei(r) {
1586
+ Hi(r);
1586
1587
  let e;
1587
1588
  if (st.forEach((t) => {
1588
1589
  t.userData.id == r && (e = t), t.children && t.children.forEach((s) => {
@@ -1591,7 +1592,7 @@ function Ei(r) {
1591
1592
  }), !e) return Jt();
1592
1593
  e.children.forEach((t) => {
1593
1594
  t.name && t.name.startsWith("DataPanel_") && (t.visible = !0);
1594
- }), Un(e), Hi(e);
1595
+ }), Un(e);
1595
1596
  }
1596
1597
  function Ri(r) {
1597
1598
  if (Oe) {
@@ -1627,33 +1628,38 @@ function Si(r) {
1627
1628
  return r;
1628
1629
  }
1629
1630
  function Hi(r, e = 500) {
1631
+ var d;
1630
1632
  if (!I.camera || !I.orbitControls) return;
1631
- let t = null;
1632
- r.userData.closeUpView && typeof r.userData.closeUpView.x == "number" && typeof r.userData.closeUpView.y == "number" && typeof r.userData.closeUpView.z == "number" && (t = r.userData.closeUpView);
1633
- const s = new P.Vector3();
1634
- r.getWorldPosition(s);
1635
- const i = new P.Box3().setFromObject(r).getSize(new P.Vector3()), o = Math.max(i.x, i.y, i.z) * 0.5, a = Math.max(o * 3.5, 5), l = new P.Vector3().copy(I.camera.position).sub(s).normalize();
1636
- l.lengthSq() < 1e-3 && l.set(0, 0, 1);
1637
- const c = s.clone().add(l.multiplyScalar(a)), A = I.camera.position.clone(), u = I.orbitControls.target.clone();
1633
+ let t;
1634
+ (d = I.scene) == null || d.traverse((m) => {
1635
+ m.userData.id == r && (t = m);
1636
+ });
1637
+ let s = null;
1638
+ t.userData.closeUpView && typeof t.userData.closeUpView.x == "number" && typeof t.userData.closeUpView.y == "number" && typeof t.userData.closeUpView.z == "number" && (s = t.userData.closeUpView);
1639
+ const n = new P.Vector3();
1640
+ t.getWorldPosition(n);
1641
+ const o = new P.Box3().setFromObject(t).getSize(new P.Vector3()), a = Math.max(o.x, o.y, o.z) * 0.5, l = Math.max(a * 3.5, 5), c = new P.Vector3().copy(I.camera.position).sub(n).normalize();
1642
+ c.lengthSq() < 1e-3 && c.set(0, 0, 1);
1643
+ const A = n.clone().add(c.multiplyScalar(l)), u = I.camera.position.clone(), h = I.orbitControls.target.clone();
1638
1644
  new nt.Tween({
1639
- x: A.x,
1640
- y: A.y,
1641
- z: A.z,
1642
- tx: u.x,
1643
- ty: u.y,
1644
- tz: u.z
1645
+ x: u.x,
1646
+ y: u.y,
1647
+ z: u.z,
1648
+ tx: h.x,
1649
+ ty: h.y,
1650
+ tz: h.z
1645
1651
  }).to(
1646
1652
  {
1647
- x: t ? t.x : c.x,
1648
- y: t ? t.y : c.y,
1649
- z: t ? t.z : c.z,
1650
- tx: s.x,
1651
- ty: s.y,
1652
- tz: s.z
1653
+ x: s ? s.x : A.x,
1654
+ y: s ? s.y : A.y,
1655
+ z: s ? s.z : A.z,
1656
+ tx: n.x,
1657
+ ty: n.y,
1658
+ tz: n.z
1653
1659
  },
1654
1660
  e
1655
- ).easing(nt.Easing.Quadratic.InOut).onUpdate((h) => {
1656
- I.camera.position.set(h.x, h.y, h.z), I.orbitControls.target.set(h.tx, h.ty, h.tz), I.orbitControls.update();
1661
+ ).easing(nt.Easing.Quadratic.InOut).onUpdate((m) => {
1662
+ I.camera.position.set(m.x, m.y, m.z), I.orbitControls.target.set(m.tx, m.ty, m.tz), I.orbitControls.update();
1657
1663
  }).start();
1658
1664
  }
1659
1665
  function Li(r) {