@hailin-zheng/editor-core 1.1.1 → 1.1.2

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.
@@ -1,5 +1,6 @@
1
1
  export declare const ViewConfig: {
2
2
  surfaceBgColor: string;
3
+ showMousePositionLine: boolean;
3
4
  primaryColor: string;
4
5
  onPrimaryColor: string;
5
6
  themeSecondaryColor: string;
@@ -26,6 +26,7 @@ export declare class SurfaceView extends NodeItems {
26
26
  measureOverride(e: IMeasureEvent, availableSize: Size): Size;
27
27
  protected arrangeOverride(e: IArrangeEvent, finalSize: Size): Size;
28
28
  render(e: IRenderData): void;
29
+ private drawMouseLinePosition;
29
30
  start(): void;
30
31
  popNodes: Array<NodeCore>;
31
32
  registerPopNode(node: NodeCore): void;
package/index-cjs.js CHANGED
@@ -4483,7 +4483,7 @@ class PSymbolElement extends LeafElement {
4483
4483
  super('psym');
4484
4484
  this.textProps = new TextProps();
4485
4485
  this.textProps.fontSize = this.defaultHeight;
4486
- this.textProps.fontName = '楷体';
4486
+ this.textProps.fontName = 'sans-serif';
4487
4487
  this.textProps.color = '#8c8c8c';
4488
4488
  }
4489
4489
  createRenderObject() {
@@ -4510,7 +4510,7 @@ class PSymbolRenderObject extends LeafRenderObject {
4510
4510
  if (render.drawMode === 'print') {
4511
4511
  return;
4512
4512
  }
4513
- render.contentContext.drawText('', this.element.textProps, position.x, position.y, 20, this.rect.height);
4513
+ render.contentContext.drawText('', this.element.textProps, position.x, position.y, 20, this.rect.height);
4514
4514
  }
4515
4515
  //绘制段落符号
4516
4516
  clone() {
@@ -12105,7 +12105,6 @@ class ParagraphMeasure {
12105
12105
  */
12106
12106
  setParaTextAlign(counter, paraLineIndex, paraElement, limitWidth, paraLineRender) {
12107
12107
  let indent = paraLineRender.startX;
12108
- paraLineRender.line.rect.width = limitWidth;
12109
12108
  if (paraElement.props.textAlign === 'center') {
12110
12109
  const remainSpace = limitWidth - paraLineRender.line.rect.width;
12111
12110
  const startX = Math.ceil(remainSpace / 2) + indent;
@@ -12129,6 +12128,7 @@ class ParagraphMeasure {
12129
12128
  //return indent;
12130
12129
  }
12131
12130
  else ;
12131
+ paraLineRender.line.rect.width = limitWidth;
12132
12132
  }
12133
12133
  /**
12134
12134
  * 设置两端对齐
@@ -14247,7 +14247,7 @@ class PageBreakRenderObject extends LeafRenderObject {
14247
14247
  if (render.drawMode === 'print') {
14248
14248
  return;
14249
14249
  }
14250
- render.contentContext.drawText('', this.element.textProps, position.x, position.y, 20, this.rect.height);
14250
+ render.contentContext.drawText('', this.element.textProps, position.x, position.y, 20, this.rect.height);
14251
14251
  }
14252
14252
  clone() {
14253
14253
  const render = new PageBreakRenderObject(this.element);
@@ -14770,7 +14770,8 @@ class DocumentEvent {
14770
14770
  };
14771
14771
  }
14772
14772
  }
14773
- if (!this.ismousedown) {
14773
+ //只有设计模式时,才需要进行边界判断,方可调整表格列宽等
14774
+ if (!this.ismousedown && this.viewOptions.docMode === exports.DocMode.Design) {
14774
14775
  this.edgeRenderInfo = edgeRenderInfo;
14775
14776
  }
14776
14777
  //存在边界元素,并且当前边界处于鼠标按下状态
@@ -18630,6 +18631,7 @@ class ButtonBase extends TextBase {
18630
18631
 
18631
18632
  const ViewConfig = {
18632
18633
  surfaceBgColor: '#f0f0f0',
18634
+ showMousePositionLine: false,
18633
18635
  primaryColor: '#6750A4',
18634
18636
  onPrimaryColor: '#FFFFFF',
18635
18637
  themeSecondaryColor: '#2b88d8',
@@ -19451,8 +19453,8 @@ class ViewPaint {
19451
19453
  let { x, y } = lines[i];
19452
19454
  x = Math.ceil(x);
19453
19455
  y = Math.ceil(y);
19454
- x += 0.5;
19455
- y += 0.5;
19456
+ // x += 0.5;
19457
+ // y += 0.5;
19456
19458
  if (i === 0) {
19457
19459
  this.ctx.moveTo(x, y);
19458
19460
  }
@@ -19475,8 +19477,8 @@ class ViewPaint {
19475
19477
  }
19476
19478
  }
19477
19479
  drawRadioBox(x, y, width, height, isChecked) {
19478
- x = x + Math.floor(width / 2);
19479
- y = y + Math.floor(height / 2);
19480
+ // x = x + Math.floor(width / 2);
19481
+ // y = y + Math.floor(height / 2);
19480
19482
  width = Math.floor(width / 2);
19481
19483
  this.ctx.save();
19482
19484
  this.ctx.strokeStyle = 'black';
@@ -19620,6 +19622,13 @@ class SurfaceView extends NodeItems {
19620
19622
  this.reLayout = false;
19621
19623
  }
19622
19624
  e.render.fillRect(0, 0, this.finalRect.width, this.finalRect.height, ViewConfig.surfaceBgColor);
19625
+ e.next(e.render);
19626
+ this.drawMouseLinePosition(e);
19627
+ }
19628
+ drawMouseLinePosition(e) {
19629
+ {
19630
+ return;
19631
+ }
19623
19632
  }
19624
19633
  start() {
19625
19634
  this.renderSchedule = renderApp(this, this.renderCtx, this.nodeEvent);
@@ -20904,8 +20913,6 @@ class CanvasTextEditor extends NodeItems {
20904
20913
  pagePL = left;
20905
20914
  pagePR = right;
20906
20915
  }
20907
- // this.docRule.setRuleOptions({width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft});
20908
- // this.docRule.refreshRule();
20909
20916
  this.rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
20910
20917
  }
20911
20918
  createDocViewer() {
@@ -21004,12 +21011,17 @@ class CanvasTextEditor extends NodeItems {
21004
21011
  this.documentPaint.rePages();
21005
21012
  });
21006
21013
  this.updateDocSize();
21007
- //页面高度
21008
- // this.documentSelection.updateSelectionState();
21009
- // this.selectionOverlays.getSelectionTreeData();
21010
- // this.beforeRenderSubject.next();
21011
21014
  }
21012
- //生成选区内容对象
21015
+ this.updateSelection();
21016
+ this.refreshDocRule();
21017
+ this.onChanged();
21018
+ //this.refreshView();
21019
+ }
21020
+ /**
21021
+ * 计算选区内容对象
21022
+ * @private
21023
+ */
21024
+ updateSelection() {
21013
21025
  let ssChanged = false;
21014
21026
  try {
21015
21027
  //防止由于选区不正确导致的错误,导致后续的当前任务无法释放
@@ -21020,18 +21032,12 @@ class CanvasTextEditor extends NodeItems {
21020
21032
  }
21021
21033
  this.selectionOverlays.getSelectionTreeData();
21022
21034
  ssChanged && this.selectionChanged.next(this.documentSelection.selectionState);
21023
- this.refreshDocRule();
21024
- this.onChanged();
21025
- //this.refreshView();
21026
21035
  }
21027
21036
  /**
21028
21037
  * 刷新绘制文档
21029
21038
  * @param rePaint
21030
21039
  */
21031
21040
  refreshView() {
21032
- // const ssChanged = this.documentSelection.updateSelectionState();
21033
- // this.selectionOverlays.getSelectionTreeData();
21034
- // ssChanged && this.selectionChanged.next(this.documentSelection.selectionState);
21035
21041
  this.documentPaint.refreshView();
21036
21042
  this.setCursor();
21037
21043
  }
@@ -21223,8 +21229,6 @@ class CanvasTextEditor extends NodeItems {
21223
21229
  let minDocViewWidth = pageWidth + this.viewOptions.docSpace * 2;
21224
21230
  let maxDocViewWidth = this.surfaceView.width;
21225
21231
  this.width = Math.max(minDocViewWidth, maxDocViewWidth) - ScrollBarSize;
21226
- // this.viewOptions.viewSettings.width = this.width;
21227
- // this.viewOptions.viewSettings.height = this.scrollView.height as number;
21228
21232
  const docSize = this.documentPaint.getDocumentContainerHeight();
21229
21233
  this.height = docSize.height;
21230
21234
  this.updateRenderCtx();
@@ -21237,6 +21241,7 @@ class CanvasTextEditor extends NodeItems {
21237
21241
  this.updateRenderCtx();
21238
21242
  this.documentPaint.layoutPages();
21239
21243
  this.refreshDocument();
21244
+ this.updateLayout();
21240
21245
  }
21241
21246
  /**
21242
21247
  * 缩放视图
@@ -21725,7 +21730,6 @@ class CanvasTextEditor extends NodeItems {
21725
21730
  this.viewOptions.viewSettings.height = data.height;
21726
21731
  this.updateDocSize();
21727
21732
  this.resetViewer();
21728
- this.updateLayout();
21729
21733
  });
21730
21734
  surface.addChild(scrollView);
21731
21735
  const rule2 = new RuleControl(this.docCtx);
@@ -21735,6 +21739,7 @@ class CanvasTextEditor extends NodeItems {
21735
21739
  rule2.x = 20;
21736
21740
  rule2.y = 500;
21737
21741
  surface.addChild(rule2);
21742
+ //surface.addChild(win);
21738
21743
  surface.start();
21739
21744
  }
21740
21745
  /**