@hailin-zheng/editor-core 2.0.29 → 2.0.30

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/index-cjs.js CHANGED
@@ -2403,7 +2403,7 @@ class DataEleCheckProps extends DataEleBaseProps {
2403
2403
  if (this.falseChar !== falseChar) {
2404
2404
  props.falseChar = this.falseChar;
2405
2405
  }
2406
- if (this.border) {
2406
+ if (!this.border) {
2407
2407
  props.border = this.border;
2408
2408
  }
2409
2409
  if (this.trueStateColor !== '#f00000') {
@@ -12413,14 +12413,14 @@ class ElementUtil {
12413
12413
  }
12414
12414
  };
12415
12415
  }
12416
- static getMousePos(e) {
12416
+ static getMousePos(e, scale = 1) {
12417
12417
  const svgContainer = e.currentTarget;
12418
12418
  const parentRect = svgContainer.getBoundingClientRect();
12419
12419
  const localX = e.clientX - parentRect.x; //+ this.viewOptions.pageOffset.x;
12420
12420
  const localY = e.clientY - parentRect.y; //+ this.viewOptions.pageOffset.y;
12421
12421
  return {
12422
- x: localX,
12423
- y: localY
12422
+ x: localX / scale,
12423
+ y: localY / scale
12424
12424
  };
12425
12425
  }
12426
12426
  static createClipPath(id, width, height, x = 0, y = 0) {
@@ -16159,8 +16159,8 @@ class DocumentPaint {
16159
16159
  getDocumentContainerHeight() {
16160
16160
  if (this.docPages.length > 0) {
16161
16161
  return {
16162
- width: this.docContainer.rect.width * this.viewOptions.scale,
16163
- height: this.docContainer.rect.height * this.viewOptions.scale
16162
+ width: this.docContainer.rect.width,
16163
+ height: this.docContainer.rect.height
16164
16164
  };
16165
16165
  }
16166
16166
  else {
@@ -16916,21 +16916,22 @@ class DocumentEvent {
16916
16916
  this.bindEvent();
16917
16917
  }
16918
16918
  getEventListener() {
16919
+ const scale = this.viewOptions.scale;
16919
16920
  return {
16920
16921
  mousedown: (evt) => {
16921
- this.mousedown(evt, ElementUtil.getMousePos(evt));
16922
+ this.mousedown(evt, ElementUtil.getMousePos(evt, scale));
16922
16923
  },
16923
16924
  mouseup: (evt) => {
16924
- this.mouseup(evt, ElementUtil.getMousePos(evt));
16925
+ this.mouseup(evt, ElementUtil.getMousePos(evt, scale));
16925
16926
  },
16926
16927
  click: (evt) => {
16927
16928
  this.mouseClickHandle(evt);
16928
16929
  },
16929
16930
  mousemove: (evt) => {
16930
- this.mousemove(evt, ElementUtil.getMousePos(evt));
16931
+ this.mousemove(evt, ElementUtil.getMousePos(evt, scale));
16931
16932
  },
16932
16933
  dblclick: (evt) => {
16933
- this.mouseDblClickHandle(evt, ElementUtil.getMousePos(evt));
16934
+ this.mouseDblClickHandle(evt, ElementUtil.getMousePos(evt, scale));
16934
16935
  },
16935
16936
  contextmenu: (evt) => {
16936
16937
  this.contextMenu.next(evt);
@@ -27086,7 +27087,15 @@ class DocEditor {
27086
27087
  }
27087
27088
  },
27088
27089
  children: [
27089
- docContentVNode, inputVNode, dropContainer
27090
+ {
27091
+ sel: 'div.scale-container', data: {
27092
+ style: {
27093
+ transform: 'scale(' + this.viewOptions.scale + ')',
27094
+ transformOrigin: 'left top'
27095
+ }
27096
+ },
27097
+ children: [docContentVNode, inputVNode, dropContainer]
27098
+ }
27090
27099
  ]
27091
27100
  }, ruleFunc.refreshRuleSvg().render()
27092
27101
  ]
@@ -27451,6 +27460,11 @@ class DocEditor {
27451
27460
  this.updateRenderCtx();
27452
27461
  this.flushToSchedule();
27453
27462
  this.documentPaint.layoutPages();
27463
+ const sub = this.afterNodePatch.subscribe(() => {
27464
+ sub.unsubscribe();
27465
+ const scrollDOM = this.svgContainer.querySelector('.scroll-container');
27466
+ scrollDOM.scrollLeft = (scrollDOM.scrollWidth - scrollDOM.getBoundingClientRect().width) / 2;
27467
+ });
27454
27468
  return scale;
27455
27469
  }
27456
27470
  updateRenderCtx() {