@readium/navigator 2.4.0-alpha.14 → 2.4.0-alpha.16

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
@@ -3629,7 +3629,7 @@ const _t = class _t extends gt {
3629
3629
  ), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
3630
3630
  value: {
3631
3631
  name: "readium-ts-toolkit",
3632
- version: "2.4.0-alpha.14",
3632
+ version: "2.4.0-alpha.15",
3633
3633
  hasFeature: (n, r = "") => {
3634
3634
  switch (n) {
3635
3635
  case "dom-manipulation":
@@ -9572,7 +9572,7 @@ class un extends qi {
9572
9572
  this._keyboardPeripherals
9573
9573
  );
9574
9574
  }
9575
- this.currentLocation === void 0 && (this.currentLocation = this.positions[0]), await this.resizeHandler(), await this.apply();
9575
+ this.currentLocation === void 0 ? this.currentLocation = this.positions[0] : this.currentLocation = this.completeLocator(this.currentLocation), await this.resizeHandler(), await this.apply();
9576
9576
  }
9577
9577
  get settings() {
9578
9578
  if (this._layout === S.fixed)
@@ -9928,23 +9928,27 @@ class un extends qi {
9928
9928
  this._cframes[0].msg.send("go_progression", o, (c) => l(c));
9929
9929
  }) : i = !0, e(i);
9930
9930
  }
9931
- go(t, e, i) {
9931
+ completeLocator(t) {
9932
9932
  if (!t.href) {
9933
- let o = !1;
9933
+ let e = !1;
9934
9934
  if (typeof t.locations.position == "number") {
9935
- const a = this.positions.find((l) => l.locations.position === t.locations.position);
9936
- a && (t = a.copyWithLocations(t.locations), o = !0);
9935
+ const i = this.positions.find((n) => n.locations.position === t.locations.position);
9936
+ i && (t = i.copyWithLocations(t.locations), e = !0);
9937
9937
  }
9938
- if (!o && typeof t.locations?.totalProgression == "number") {
9939
- const a = t.locations.totalProgression;
9940
- let l = 0, h = 1 / 0;
9941
- for (let c = 0; c < this.positions.length; c++) {
9942
- const m = this.positions[c].locations.totalProgression ?? c / this.positions.length, y = Math.abs(m - a);
9943
- y < h && (h = y, l = c);
9938
+ if (!e && typeof t.locations?.totalProgression == "number") {
9939
+ const i = t.locations.totalProgression;
9940
+ let n = 0, r = 1 / 0;
9941
+ for (let o = 0; o < this.positions.length; o++) {
9942
+ const l = this.positions[o].locations.totalProgression ?? o / this.positions.length, h = Math.abs(l - i);
9943
+ h < r && (r = h, n = o);
9944
9944
  }
9945
- t = this.positions[l].copyWithLocations(t.locations);
9945
+ t = this.positions[n].copyWithLocations(t.locations);
9946
9946
  }
9947
9947
  }
9948
+ return t;
9949
+ }
9950
+ go(t, e, i) {
9951
+ t = this.completeLocator(t);
9948
9952
  const n = t.href.split("#")[0];
9949
9953
  let r = this.pub.readingOrder.findWithHref(n);
9950
9954
  if (!r)