@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.d.mts CHANGED
@@ -2531,6 +2531,7 @@ declare class Draw {
2531
2531
  setPageDevicePixel(): void;
2532
2532
  setPaperSize(width: number, height: number): void;
2533
2533
  setPaperDirection(payload: PaperDirection): void;
2534
+ refreshPageSize(): void;
2534
2535
  setPaperMargin(payload: IMargin): void;
2535
2536
  getOriginValue(options?: IGetOriginValueOption): Required<IEditorData>;
2536
2537
  getValue(options?: IGetValueOption): IEditorResult;
package/dist/index.d.ts CHANGED
@@ -2531,6 +2531,7 @@ declare class Draw {
2531
2531
  setPageDevicePixel(): void;
2532
2532
  setPaperSize(width: number, height: number): void;
2533
2533
  setPaperDirection(payload: PaperDirection): void;
2534
+ refreshPageSize(): void;
2534
2535
  setPaperMargin(payload: IMargin): void;
2535
2536
  getOriginValue(options?: IGetOriginValueOption): Required<IEditorData>;
2536
2537
  getValue(options?: IGetValueOption): IEditorResult;
package/dist/index.js CHANGED
@@ -78,7 +78,7 @@ __export(index_exports, {
78
78
  module.exports = __toCommonJS(index_exports);
79
79
 
80
80
  // src/version.ts
81
- var version = "0.3.19";
81
+ var version = "0.3.20";
82
82
 
83
83
  // src/dataset/enum/Common.ts
84
84
  var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
@@ -21185,25 +21185,14 @@ var Draw = class {
21185
21185
  setPaperSize(width, height) {
21186
21186
  this.options.width = width;
21187
21187
  this.options.height = height;
21188
- const dpr = this.getPagePixelRatio();
21189
- const realWidth = this.getWidth();
21190
- const realHeight = this.getHeight();
21191
- this.container.style.width = `${realWidth}px`;
21192
- this.pageList.forEach((p, i) => {
21193
- p.width = realWidth * dpr;
21194
- p.height = realHeight * dpr;
21195
- p.style.width = `${realWidth}px`;
21196
- p.style.height = `${realHeight}px`;
21197
- this._initPageContext(this.ctxList[i]);
21198
- });
21199
- this.render({
21200
- isSubmitHistory: false,
21201
- isSetCursor: false
21202
- });
21188
+ this.refreshPageSize();
21203
21189
  }
21204
21190
  setPaperDirection(payload) {
21205
- const dpr = this.getPagePixelRatio();
21206
21191
  this.options.paperDirection = payload;
21192
+ this.refreshPageSize();
21193
+ }
21194
+ refreshPageSize() {
21195
+ const dpr = this.getPagePixelRatio();
21207
21196
  const width = this.getWidth();
21208
21197
  const height = this.getHeight();
21209
21198
  this.container.style.width = `${width}px`;
@@ -24866,7 +24855,12 @@ var CommandAdapt = class {
24866
24855
  Object.keys(payload).forEach((key) => {
24867
24856
  Reflect.set(this.options, key, newOption[key]);
24868
24857
  });
24869
- this.forceUpdate();
24858
+ const layoutKeys = ["paperDirection", "width", "height"];
24859
+ if (layoutKeys.some((k) => k in payload)) {
24860
+ this.draw.refreshPageSize();
24861
+ } else {
24862
+ this.forceUpdate();
24863
+ }
24870
24864
  const { scale, paperDirection, width, height } = this.options;
24871
24865
  this.draw.getListener().optionsChange?.({ scale, paperDirection, width, height });
24872
24866
  }