@nakednous/host 0.0.10 → 0.0.11

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.js CHANGED
@@ -760,7 +760,7 @@ class Handle {
760
760
  c.s = this._savedS;
761
761
  c._dialPoint();
762
762
  } else {
763
- c.seed(this._saved[0], this._saved[1], this._saved[2]);
763
+ c.seed(this._saved[0], this._saved[1], this._saved[2], POINT);
764
764
  }
765
765
  if (this._binder) this._binder.set(this.value(this._bindVal));
766
766
  this._grabbed = false;
@@ -854,7 +854,7 @@ class Handle {
854
854
  _v3[1] = gy > 0 ? Math.round(c.pt[1] / gy) * gy : c.pt[1];
855
855
  _v3[2] = gz > 0 ? Math.round(c.pt[2] / gz) * gz : c.pt[2];
856
856
  if (this._isView) { c.pt[0] = _v3[0]; c.pt[1] = _v3[1]; c.pt[2] = _v3[2]; }
857
- else c.seed(_v3[0], _v3[1], _v3[2]);
857
+ else c.seed(_v3[0], _v3[1], _v3[2], POINT);
858
858
  } else if (c.kind === AXIS || c.kind === DIAL) {
859
859
  const step = Array.isArray(sn) ? sn[0] : sn;
860
860
  if (!(step > 0)) return;
@@ -901,6 +901,11 @@ class Handle {
901
901
  * accessor, or a vec3 array mutated in place (a camera state's eye or
902
902
  * center is one). get() seeds the constraint now; each solve calls
903
903
  * set(value) with the reused value array, then fires onChange. Chainable.
904
+ *
905
+ * The array lives in the handle's `report` space, both ways: a SPHERE handle
906
+ * (DIRECTION by default) binds and receives a **unit heading**, not a point on
907
+ * its sphere; a PLANE / AXIS handle binds and receives a world point. Construct
908
+ * the handle with `report: POINT` to bind a point to a sphere instead.
904
909
  * @param {number[]|{ get:Function, set:Function }} target
905
910
  * @returns {Handle} this
906
911
  */
@@ -920,7 +925,9 @@ class Handle {
920
925
  return this;
921
926
  }
922
927
 
923
- /** Re-seed the constraint from the bound target after it changed externally. Chainable. */
928
+ /** Re-seed the constraint from the bound target after it changed externally —
929
+ * the target holds the handle's own `report` space, as the write-back does, so
930
+ * seed → solve → write never changes what the array means. Chainable. */
924
931
  sync() {
925
932
  if (this._binder) this._seedFromBinding();
926
933
  return this;
@@ -931,7 +938,7 @@ class Handle {
931
938
  if (g == null) return;
932
939
  const x = _vx$1(g, 0, 0), y = _vx$1(g, 1, 0), z = _vx$1(g, 2, 0);
933
940
  if (this._isView) { const pt = this._constraint.pt; pt[0] = x; pt[1] = y; pt[2] = z; }
934
- else this._constraint.seed(x, y, z);
941
+ else this._constraint.seed(x, y, z, this._constraint.report);
935
942
  }
936
943
 
937
944
  // Push the freshly solved value to the binding and fire onChange, once per solve.
@@ -982,7 +989,7 @@ class Handle {
982
989
  c.pt[0] = c.anchor[0] + c.s * c.u[0];
983
990
  c.pt[1] = c.anchor[1] + c.s * c.u[1];
984
991
  c.pt[2] = c.anchor[2] + c.s * c.u[2];
985
- } else if (c.kind === PLANE) c.seed(c.pt[0], c.pt[1], c.pt[2]);
992
+ } else if (c.kind === PLANE) c.seed(c.pt[0], c.pt[1], c.pt[2], POINT);
986
993
  }
987
994
  return this;
988
995
  }