@meta2d/core 1.0.39 → 1.0.40

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.39",
3
+ "version": "1.0.40",
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",
@@ -2157,7 +2157,7 @@ var Canvas = /** @class */ (function () {
2157
2157
  ctx.translate(-_this.activeRect.center.x, -_this.activeRect.center.y);
2158
2158
  }
2159
2159
  ctx.strokeStyle = _this.store.options.activeColor;
2160
- ctx.globalAlpha = _this.store.options.activeGlobalAlpha || 0.3;
2160
+ ctx.globalAlpha = _this.store.options.activeGlobalAlpha === undefined ? 0.3 : _this.store.options.activeGlobalAlpha;
2161
2161
  ctx.beginPath();
2162
2162
  ctx.lineWidth = _this.store.options.activeLineWidth || 1;
2163
2163
  ctx.setLineDash(_this.store.options.activeLineDash || []);
@@ -2712,6 +2712,9 @@ var Canvas = /** @class */ (function () {
2712
2712
  });
2713
2713
  _this.store.emitter.emit('valueUpdate', pen);
2714
2714
  }
2715
+ else if (pen.text === _this.inputDiv.dataset.value && pen.calculative.textLines.length == 0) {
2716
+ calcTextRect(pen);
2717
+ }
2715
2718
  _this.initTemplateCanvas([pen]);
2716
2719
  }
2717
2720
  _this.inputDiv.dataset.penId = undefined;
@@ -4382,6 +4385,7 @@ var Canvas = /** @class */ (function () {
4382
4385
  Canvas.prototype.finishDrawline = function (end) {
4383
4386
  return __awaiter(this, void 0, void 0, function () {
4384
4387
  var from, to, line, rect, allowAdd, _a;
4388
+ var _this = this;
4385
4389
  return __generator(this, function (_b) {
4386
4390
  switch (_b.label) {
4387
4391
  case 0:
@@ -4406,6 +4410,7 @@ var Canvas = /** @class */ (function () {
4406
4410
  if (!from.connectTo || !to.connectTo) {
4407
4411
  if (this.store.options.disableEmptyLine) {
4408
4412
  // 有一端未连线,且 禁止创建空线条
4413
+ this.store.pens[from.connectTo].connectedLines = this.store.pens[from.connectTo].connectedLines.filter(function (item) { return item.lineId !== _this.drawingLine.id; });
4409
4414
  this.drawingLine = undefined;
4410
4415
  this.render();
4411
4416
  return [2 /*return*/];
@@ -4768,7 +4773,6 @@ var Canvas = /** @class */ (function () {
4768
4773
  }, 50);
4769
4774
  };
4770
4775
  Canvas.prototype.translate = function (x, y) {
4771
- var _this = this;
4772
4776
  if (x === void 0) { x = 0; }
4773
4777
  if (y === void 0) { y = 0; }
4774
4778
  this.store.data.x += x * this.store.data.scale;
@@ -4812,12 +4816,13 @@ var Canvas = /** @class */ (function () {
4812
4816
  }
4813
4817
  }
4814
4818
  }
4815
- setTimeout(function () {
4816
- _this.canvasTemplate.init();
4817
- _this.canvasImage.init();
4818
- _this.canvasImageBottom.init();
4819
- _this.render();
4820
- });
4819
+ //TODO 当初为什么加异步
4820
+ // setTimeout(() => {
4821
+ this.canvasTemplate.init();
4822
+ this.canvasImage.init();
4823
+ this.canvasImageBottom.init();
4824
+ this.render();
4825
+ // });
4821
4826
  this.store.emitter.emit('translate', {
4822
4827
  x: this.store.data.x,
4823
4828
  y: this.store.data.y,
@@ -4908,17 +4913,17 @@ var Canvas = /** @class */ (function () {
4908
4913
  _this.execPenResize(pen);
4909
4914
  });
4910
4915
  this.calcActiveRect();
4911
- setTimeout(function () {
4912
- _this.canvasTemplate.init();
4913
- _this.canvasImage.init();
4914
- _this.canvasImageBottom.init();
4915
- var map = _this.parent.map;
4916
- if (map && map.isShow) {
4917
- map.setView();
4918
- }
4919
- _this.render();
4920
- _this.store.emitter.emit('scale', _this.store.data.scale);
4921
- });
4916
+ // setTimeout(() => {
4917
+ this.canvasTemplate.init();
4918
+ this.canvasImage.init();
4919
+ this.canvasImageBottom.init();
4920
+ var map = this.parent.map;
4921
+ if (map && map.isShow) {
4922
+ map.setView();
4923
+ }
4924
+ this.render();
4925
+ this.store.emitter.emit('scale', this.store.data.scale);
4926
+ // });
4922
4927
  };
4923
4928
  Canvas.prototype.templateScale = function (scale, center) {
4924
4929
  var _this = this;