@meta2d/core 1.0.96 → 1.0.97
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 +1 -1
- package/src/canvas/canvas.d.ts +3 -0
- package/src/canvas/canvas.js +120 -2
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +2 -2
- package/src/core.js +19 -7
- package/src/core.js.map +1 -1
- package/src/dialog/dialog.d.ts +6 -0
- package/src/dialog/dialog.js +29 -4
- package/src/dialog/dialog.js.map +1 -1
- package/src/pen/model.d.ts +2 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +17 -0
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +1 -0
- package/src/store/store.js.map +1 -1
package/src/core.d.ts
CHANGED
|
@@ -345,7 +345,7 @@ export declare class Meta2d {
|
|
|
345
345
|
* 放大到屏幕尺寸,并居中
|
|
346
346
|
* @param fit true,填满但完整展示;false,填满,但长边可能截取(即显示不完整)
|
|
347
347
|
*/
|
|
348
|
-
fitView(fit?: boolean, viewPadding?: Padding): void;
|
|
348
|
+
fitView(fit?: boolean, viewPadding?: Padding, fill?: boolean): void;
|
|
349
349
|
fillView(): void;
|
|
350
350
|
trimPens(): void;
|
|
351
351
|
/**
|
|
@@ -353,7 +353,7 @@ export declare class Meta2d {
|
|
|
353
353
|
* @param fit true,填满但完整展示;false,填满,但长边可能截取(即显示不完整)
|
|
354
354
|
*/
|
|
355
355
|
fitTemplateView(fit?: boolean, viewPadding?: Padding): void;
|
|
356
|
-
fitSizeView(fit?: boolean | string, viewPadding?: Padding): void;
|
|
356
|
+
fitSizeView(fit?: boolean | string, viewPadding?: Padding, fill?: boolean): void;
|
|
357
357
|
centerSizeView(): void;
|
|
358
358
|
/**
|
|
359
359
|
* 宽度放大到屏幕尺寸,并滚动到最顶部
|
package/src/core.js
CHANGED
|
@@ -2383,9 +2383,11 @@ export class Meta2d {
|
|
|
2383
2383
|
if (!this.store.data.cancelFirstConnect) {
|
|
2384
2384
|
this.requestHttp(http);
|
|
2385
2385
|
}
|
|
2386
|
-
|
|
2387
|
-
this.
|
|
2388
|
-
|
|
2386
|
+
if (net.interval !== 0) {
|
|
2387
|
+
this.updateTimerList[net.index] = setInterval(async () => {
|
|
2388
|
+
this.requestHttp(http);
|
|
2389
|
+
}, http.interval || 1000);
|
|
2390
|
+
}
|
|
2389
2391
|
}
|
|
2390
2392
|
else if (net.protocol === 'SSE') {
|
|
2391
2393
|
if (this.eventSources) {
|
|
@@ -4265,7 +4267,7 @@ export class Meta2d {
|
|
|
4265
4267
|
* 放大到屏幕尺寸,并居中
|
|
4266
4268
|
* @param fit true,填满但完整展示;false,填满,但长边可能截取(即显示不完整)
|
|
4267
4269
|
*/
|
|
4268
|
-
fitView(fit = true, viewPadding = 10) {
|
|
4270
|
+
fitView(fit = true, viewPadding = 10, fill = true) {
|
|
4269
4271
|
// 默认垂直填充,两边留白
|
|
4270
4272
|
if (!this.hasView())
|
|
4271
4273
|
return;
|
|
@@ -4295,7 +4297,7 @@ export class Meta2d {
|
|
|
4295
4297
|
this.scale(ratio * this.store.data.scale);
|
|
4296
4298
|
// 5. 居中
|
|
4297
4299
|
this.centerView();
|
|
4298
|
-
if (this.store.data.fits?.length) {
|
|
4300
|
+
if (fill && this.store.data.fits?.length) {
|
|
4299
4301
|
this.fillView();
|
|
4300
4302
|
}
|
|
4301
4303
|
}
|
|
@@ -4335,8 +4337,17 @@ export class Meta2d {
|
|
|
4335
4337
|
if (pen.image && pen.imageRatio) {
|
|
4336
4338
|
if (pen.calculative.worldRect.width / this.canvas.width > 0.1) {
|
|
4337
4339
|
pen.imageRatio = false;
|
|
4340
|
+
pen.ratio = false;
|
|
4338
4341
|
}
|
|
4339
4342
|
}
|
|
4343
|
+
if (pen.name === 'tablePlus') {
|
|
4344
|
+
pen.colWidth = (pen.colWidth ?? 150) * ratio;
|
|
4345
|
+
pen.styles.forEach((style) => {
|
|
4346
|
+
if (style.width) {
|
|
4347
|
+
style.width = style.width * ratio;
|
|
4348
|
+
}
|
|
4349
|
+
});
|
|
4350
|
+
}
|
|
4340
4351
|
pen.calculative.worldRect.x =
|
|
4341
4352
|
rect.x -
|
|
4342
4353
|
wGap / 2 +
|
|
@@ -4450,6 +4461,7 @@ export class Meta2d {
|
|
|
4450
4461
|
if (pen.image && pen.imageRatio) {
|
|
4451
4462
|
if (pen.calculative.worldRect.height / this.canvas.height > 0.1) {
|
|
4452
4463
|
pen.imageRatio = false;
|
|
4464
|
+
pen.ratio = false;
|
|
4453
4465
|
}
|
|
4454
4466
|
}
|
|
4455
4467
|
pen.calculative.worldRect.y =
|
|
@@ -4584,7 +4596,7 @@ export class Meta2d {
|
|
|
4584
4596
|
});
|
|
4585
4597
|
this.centerView();
|
|
4586
4598
|
}
|
|
4587
|
-
fitSizeView(fit = true, viewPadding = 10) {
|
|
4599
|
+
fitSizeView(fit = true, viewPadding = 10, fill = true) {
|
|
4588
4600
|
// 默认垂直填充,两边留白
|
|
4589
4601
|
// if (!this.hasView()) return;
|
|
4590
4602
|
// 1. 重置画布尺寸为容器尺寸
|
|
@@ -4623,7 +4635,7 @@ export class Meta2d {
|
|
|
4623
4635
|
this.scale(ratio * this.store.data.scale);
|
|
4624
4636
|
// 5. 居中
|
|
4625
4637
|
this.centerSizeView();
|
|
4626
|
-
if (this.store.data.fits?.length) {
|
|
4638
|
+
if (fill && this.store.data.fits?.length) {
|
|
4627
4639
|
this.fillView();
|
|
4628
4640
|
}
|
|
4629
4641
|
}
|