@windoc/core 0.3.19 → 0.3.20

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var version = "0.3.19";
2
+ var version = "0.3.20";
3
3
 
4
4
  // src/dataset/enum/Common.ts
5
5
  var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
@@ -21106,25 +21106,14 @@ var Draw = class {
21106
21106
  setPaperSize(width, height) {
21107
21107
  this.options.width = width;
21108
21108
  this.options.height = height;
21109
- const dpr = this.getPagePixelRatio();
21110
- const realWidth = this.getWidth();
21111
- const realHeight = this.getHeight();
21112
- this.container.style.width = `${realWidth}px`;
21113
- this.pageList.forEach((p, i) => {
21114
- p.width = realWidth * dpr;
21115
- p.height = realHeight * dpr;
21116
- p.style.width = `${realWidth}px`;
21117
- p.style.height = `${realHeight}px`;
21118
- this._initPageContext(this.ctxList[i]);
21119
- });
21120
- this.render({
21121
- isSubmitHistory: false,
21122
- isSetCursor: false
21123
- });
21109
+ this.refreshPageSize();
21124
21110
  }
21125
21111
  setPaperDirection(payload) {
21126
- const dpr = this.getPagePixelRatio();
21127
21112
  this.options.paperDirection = payload;
21113
+ this.refreshPageSize();
21114
+ }
21115
+ refreshPageSize() {
21116
+ const dpr = this.getPagePixelRatio();
21128
21117
  const width = this.getWidth();
21129
21118
  const height = this.getHeight();
21130
21119
  this.container.style.width = `${width}px`;
@@ -24787,7 +24776,12 @@ var CommandAdapt = class {
24787
24776
  Object.keys(payload).forEach((key) => {
24788
24777
  Reflect.set(this.options, key, newOption[key]);
24789
24778
  });
24790
- this.forceUpdate();
24779
+ const layoutKeys = ["paperDirection", "width", "height"];
24780
+ if (layoutKeys.some((k) => k in payload)) {
24781
+ this.draw.refreshPageSize();
24782
+ } else {
24783
+ this.forceUpdate();
24784
+ }
24791
24785
  const { scale, paperDirection, width, height } = this.options;
24792
24786
  this.draw.getListener().optionsChange?.({ scale, paperDirection, width, height });
24793
24787
  }