@meta2d/core 1.0.99 → 1.1.0

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/src/core.js CHANGED
@@ -267,6 +267,16 @@ export class Meta2d {
267
267
  }
268
268
  _value[key] = __value;
269
269
  }
270
+ else if (typeof value[key] === 'string' &&
271
+ ((value[key].startsWith('{') && value[key].endsWith('}')) ||
272
+ (value[key].startsWith('[') && value[key].endsWith(']')))) {
273
+ try {
274
+ _value[key] = JSON.parse(value[key]);
275
+ }
276
+ catch (e) {
277
+ _value[key] = value[key];
278
+ }
279
+ }
270
280
  else {
271
281
  _value[key] = value[key];
272
282
  }
@@ -1851,6 +1861,7 @@ export class Meta2d {
1851
1861
  step,
1852
1862
  });
1853
1863
  initPens = [deepClone(pen)];
1864
+ this.inactive();
1854
1865
  pen.children = undefined;
1855
1866
  // 保存修改 children 的历史记录
1856
1867
  this.pushHistory({
@@ -1864,7 +1875,6 @@ export class Meta2d {
1864
1875
  // delete 会记录 history , 更改 step 即可
1865
1876
  this.store.histories[this.store.histories.length - 1].step = step;
1866
1877
  }
1867
- this.inactive();
1868
1878
  }
1869
1879
  clearCombine(pen) {
1870
1880
  if (!pen && this.store.active) {
@@ -2546,7 +2556,7 @@ export class Meta2d {
2546
2556
  if (!options.hasOwnProperty("keepalive")) {
2547
2557
  Object.assign(options, { keepallive: 30 });
2548
2558
  }
2549
- // clean为false 时,clientId 是必填项
2559
+ // clean为false 时,clientId 是必填项
2550
2560
  // if(options.clientId && !options.hasOwnProperty("clean")){
2551
2561
  // Object.assign(options,{clean: false});
2552
2562
  // }
@@ -4315,6 +4325,9 @@ export class Meta2d {
4315
4325
  }
4316
4326
  }
4317
4327
  fillView() {
4328
+ if (this.store.options.unFill) {
4329
+ return; //不自适应
4330
+ }
4318
4331
  const rect = this.getRect();
4319
4332
  const wGap = this.canvas.width - rect.width;
4320
4333
  const hGap = this.canvas.height - rect.height;
@@ -4373,6 +4386,8 @@ export class Meta2d {
4373
4386
  pen.calculative.x = pen.calculative.worldRect.x;
4374
4387
  pen.width = pen.calculative.worldRect.width;
4375
4388
  pen.x = pen.calculative.worldRect.x;
4389
+ pen.textWidth *= ratio;
4390
+ pen.calculative.textWidth *= ratio;
4376
4391
  this.canvas.updatePenRect(pen, { worldRectIsReady: false });
4377
4392
  if (pen.externElement) {
4378
4393
  pen.onResize?.(pen);