@windoc/core 0.3.18 → 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
@@ -1548,6 +1548,13 @@ type IControlChange = (payload: IControlChangeResult) => void;
1548
1548
  type IControlContentChange = (payload: IControlContentChangeResult) => void;
1549
1549
  type IPageModeChange = (payload: PageMode) => void;
1550
1550
  type IZoneChange = (payload: EditorZone) => void;
1551
+ interface IOptionsChangePayload {
1552
+ scale: number;
1553
+ paperDirection: string;
1554
+ width: number;
1555
+ height: number;
1556
+ }
1557
+ type IOptionsChange = (payload: IOptionsChangePayload) => void;
1551
1558
  type IMouseEventChange = (evt: MouseEvent) => void;
1552
1559
  type IInputEventChange = (evt: Event) => void;
1553
1560
  interface IPositionContextChangePayload {
@@ -1583,6 +1590,7 @@ declare class Listener {
1583
1590
  controlContentChange: IControlContentChange | null;
1584
1591
  pageModeChange: IPageModeChange | null;
1585
1592
  zoneChange: IZoneChange | null;
1593
+ optionsChange: IOptionsChange | null;
1586
1594
  constructor();
1587
1595
  }
1588
1596
 
@@ -2523,6 +2531,7 @@ declare class Draw {
2523
2531
  setPageDevicePixel(): void;
2524
2532
  setPaperSize(width: number, height: number): void;
2525
2533
  setPaperDirection(payload: PaperDirection): void;
2534
+ refreshPageSize(): void;
2526
2535
  setPaperMargin(payload: IMargin): void;
2527
2536
  getOriginValue(options?: IGetOriginValueOption): Required<IEditorData>;
2528
2537
  getValue(options?: IGetValueOption): IEditorResult;
package/dist/index.d.ts CHANGED
@@ -1548,6 +1548,13 @@ type IControlChange = (payload: IControlChangeResult) => void;
1548
1548
  type IControlContentChange = (payload: IControlContentChangeResult) => void;
1549
1549
  type IPageModeChange = (payload: PageMode) => void;
1550
1550
  type IZoneChange = (payload: EditorZone) => void;
1551
+ interface IOptionsChangePayload {
1552
+ scale: number;
1553
+ paperDirection: string;
1554
+ width: number;
1555
+ height: number;
1556
+ }
1557
+ type IOptionsChange = (payload: IOptionsChangePayload) => void;
1551
1558
  type IMouseEventChange = (evt: MouseEvent) => void;
1552
1559
  type IInputEventChange = (evt: Event) => void;
1553
1560
  interface IPositionContextChangePayload {
@@ -1583,6 +1590,7 @@ declare class Listener {
1583
1590
  controlContentChange: IControlContentChange | null;
1584
1591
  pageModeChange: IPageModeChange | null;
1585
1592
  zoneChange: IZoneChange | null;
1593
+ optionsChange: IOptionsChange | null;
1586
1594
  constructor();
1587
1595
  }
1588
1596
 
@@ -2523,6 +2531,7 @@ declare class Draw {
2523
2531
  setPageDevicePixel(): void;
2524
2532
  setPaperSize(width: number, height: number): void;
2525
2533
  setPaperDirection(payload: PaperDirection): void;
2534
+ refreshPageSize(): void;
2526
2535
  setPaperMargin(payload: IMargin): void;
2527
2536
  getOriginValue(options?: IGetOriginValueOption): Required<IEditorData>;
2528
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.18";
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,14 @@ 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
+ }
24864
+ const { scale, paperDirection, width, height } = this.options;
24865
+ this.draw.getListener().optionsChange?.({ scale, paperDirection, width, height });
24870
24866
  }
24871
24867
  getControlList() {
24872
24868
  return this.draw.getControl().getList();
@@ -25242,6 +25238,7 @@ var Listener = class {
25242
25238
  this.controlContentChange = null;
25243
25239
  this.pageModeChange = null;
25244
25240
  this.zoneChange = null;
25241
+ this.optionsChange = null;
25245
25242
  }
25246
25243
  };
25247
25244