@prose-reader/core 1.190.0 → 1.192.0

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.
@@ -1044,7 +1044,7 @@
1044
1044
  layout(params) {
1045
1045
  return rxjs.defer(() => this.onLayout(params)).pipe(
1046
1046
  rxjs.map((dims) => {
1047
- var _a, _b;
1047
+ var _a, _b, _c, _d;
1048
1048
  const { height: defaultHeight, width: defaultWidth } = this.context.getPageSize();
1049
1049
  if (dims) {
1050
1050
  const { height, width } = dims;
@@ -1053,24 +1053,33 @@
1053
1053
  `Your height or width is smaller than the page size. Please check your rendering.`
1054
1054
  );
1055
1055
  }
1056
- this.lastLayoutDims = { height, width };
1056
+ this.lastLayoutDims = {
1057
+ height,
1058
+ width,
1059
+ pageSize: this.context.getPageSize()
1060
+ };
1057
1061
  return this.lastLayoutDims;
1058
1062
  }
1059
- if (this.renditionLayout === `pre-paginated`) {
1063
+ const hasPageSizeChanged = ((_a = this.lastLayoutDims) == null ? void 0 : _a.pageSize.width) !== this.context.getPageSize().width || ((_b = this.lastLayoutDims) == null ? void 0 : _b.pageSize.height) !== this.context.getPageSize().height;
1064
+ if (this.renditionLayout === `pre-paginated` || // in the case the page size change, we cannot use the old size reliably
1065
+ // we have to drop it and use the default one
1066
+ hasPageSizeChanged) {
1060
1067
  this.lastLayoutDims = {
1061
1068
  height: this.context.getPageSize().height,
1062
- width: params.minimumWidth
1069
+ width: params.minimumWidth,
1070
+ pageSize: this.context.getPageSize()
1063
1071
  };
1064
1072
  } else {
1065
1073
  this.lastLayoutDims = {
1066
1074
  height: Math.max(
1067
1075
  defaultHeight,
1068
- ((_a = this.lastLayoutDims) == null ? void 0 : _a.height) ?? defaultHeight
1076
+ ((_c = this.lastLayoutDims) == null ? void 0 : _c.height) ?? defaultHeight
1069
1077
  ),
1070
1078
  width: Math.max(
1071
1079
  defaultWidth,
1072
- ((_b = this.lastLayoutDims) == null ? void 0 : _b.width) ?? defaultWidth
1073
- )
1080
+ ((_d = this.lastLayoutDims) == null ? void 0 : _d.width) ?? defaultWidth
1081
+ ),
1082
+ pageSize: this.context.getPageSize()
1074
1083
  };
1075
1084
  }
1076
1085
  return this.lastLayoutDims;