@meta2d/core 1.0.40 → 1.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta2d/core",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1036,7 +1036,7 @@ var Canvas = /** @class */ (function () {
1036
1036
  ((_b = _this.drawingLine) === null || _b === void 0 ? void 0 : _b.calculative.worldAnchors.length) >
1037
1037
  _this.store.options.drawingLineLength)) {
1038
1038
  _this.finishDrawline(true);
1039
- if ((_c = _this.store.active[0]) === null || _c === void 0 ? void 0 : _c.anchors[0].connectTo) {
1039
+ if (((_c = _this.store.active[0]) === null || _c === void 0 ? void 0 : _c.anchors[0].connectTo) || _this.store.active.length == 0) {
1040
1040
  _this.drawingLineName = '';
1041
1041
  }
1042
1042
  else {
@@ -3921,11 +3921,18 @@ var Canvas = /** @class */ (function () {
3921
3921
  .getContext('2d')
3922
3922
  .scale(this.store.dpiRatio, this.store.dpiRatio);
3923
3923
  this.offscreen.getContext('2d').textBaseline = 'middle';
3924
- this.render();
3925
3924
  try {
3926
3925
  // TODO 窗口大小变化没有刷新图纸
3927
3926
  for (var _b = __values(this.store.data.pens), _c = _b.next(); !_c.done; _c = _b.next()) {
3928
3927
  var pen = _c.value;
3928
+ if (pen.isRuleLine) {
3929
+ if (!pen.width) {
3930
+ pen.height = this.height;
3931
+ }
3932
+ else if (!pen.height) {
3933
+ pen.width = this.width;
3934
+ }
3935
+ }
3929
3936
  calcInView(pen);
3930
3937
  }
3931
3938
  }
@@ -3936,6 +3943,7 @@ var Canvas = /** @class */ (function () {
3936
3943
  }
3937
3944
  finally { if (e_15) throw e_15.error; }
3938
3945
  }
3946
+ this.render();
3939
3947
  };
3940
3948
  Canvas.prototype.clearCanvas = function () {
3941
3949
  this.activeRect = undefined;
@@ -4410,7 +4418,9 @@ var Canvas = /** @class */ (function () {
4410
4418
  if (!from.connectTo || !to.connectTo) {
4411
4419
  if (this.store.options.disableEmptyLine) {
4412
4420
  // 有一端未连线,且 禁止创建空线条
4413
- this.store.pens[from.connectTo].connectedLines = this.store.pens[from.connectTo].connectedLines.filter(function (item) { return item.lineId !== _this.drawingLine.id; });
4421
+ if (from.connectTo) {
4422
+ this.store.pens[from.connectTo].connectedLines = this.store.pens[from.connectTo].connectedLines.filter(function (item) { return item.lineId !== _this.drawingLine.id; });
4423
+ }
4414
4424
  this.drawingLine = undefined;
4415
4425
  this.render();
4416
4426
  return [2 /*return*/];
@@ -4897,7 +4907,7 @@ var Canvas = /** @class */ (function () {
4897
4907
  pen.onScale && pen.onScale(pen);
4898
4908
  if (pen.isRuleLine) {
4899
4909
  // 扩大线的比例,若是放大,即不缩小,若是缩小,会放大
4900
- var lineScale = s > 1 ? 1 : 1 / s / s;
4910
+ var lineScale = 1 / s; //s > 1 ? 1 : 1 / s / s;
4901
4911
  // 中心点即为线的中心
4902
4912
  var lineCenter = pen.calculative.worldRect.center;
4903
4913
  if (!pen.width) {
@@ -4912,6 +4922,7 @@ var Canvas = /** @class */ (function () {
4912
4922
  _this.updatePenRect(pen, { worldRectIsReady: true });
4913
4923
  _this.execPenResize(pen);
4914
4924
  });
4925
+ this.onMovePens();
4915
4926
  this.calcActiveRect();
4916
4927
  // setTimeout(() => {
4917
4928
  this.canvasTemplate.init();
@@ -6853,7 +6864,7 @@ var Canvas = /** @class */ (function () {
6853
6864
  if (needCalcTextRectProps.includes(k)) {
6854
6865
  willCalcTextRect = true;
6855
6866
  }
6856
- if (['name', 'borderRadius'].includes(k)) {
6867
+ if (['name', 'borderRadius', 'lineSmooth'].includes(k)) {
6857
6868
  willUpdatePath = true;
6858
6869
  }
6859
6870
  if (needSetPenProps.includes(k)) {