@meta2d/core 1.1.13 → 1.1.14
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.js +20 -4
- package/src/canvas/canvas.js.map +1 -1
- package/src/diagrams/video.js +2 -0
- package/src/diagrams/video.js.map +1 -1
- package/src/dialog/dialog.js +2 -0
- package/src/dialog/dialog.js.map +1 -1
- package/src/utils/math.d.ts +1 -0
- package/src/utils/math.js +16 -0
- package/src/utils/math.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -3,7 +3,7 @@ import { addLineAnchor, calcIconRect, calcTextRect, calcWorldAnchors, calcWorldR
|
|
|
3
3
|
import { calcRotate, distance, getDistance, hitPoint, PointType, PrevNextType, rotatePoint, samePoint, scalePoint, translatePoint, TwoWay, } from '../point';
|
|
4
4
|
import { calcCenter, calcRightBottom, calcRelativePoint, getRect, getRectOfPoints, pointInRect, pointInSimpleRect, rectInRect, rectToPoints, resizeRect, translateRect, pointInPolygon } from '../rect';
|
|
5
5
|
import { EditType, globalStore, } from '../store';
|
|
6
|
-
import { deepClone, fileToBase64, uploadFile, formatPadding, rgba, s8, } from '../utils';
|
|
6
|
+
import { deepClone, fileToBase64, uploadFile, formatPadding, rgba, s8, toNumber, } from '../utils';
|
|
7
7
|
import { inheritanceProps, defaultCursors, defaultDrawLineFns, HotkeyType, HoverType, MouseRight, rotatedCursors, } from '../data';
|
|
8
8
|
import { createOffscreen } from './offscreen';
|
|
9
9
|
import { curve, mind, getLineLength, getLineRect, pointInLine, simplify, smoothLine, lineSegment, getLineR, lineInRect, } from '../diagrams';
|
|
@@ -3914,6 +3914,16 @@ export class Canvas {
|
|
|
3914
3914
|
}
|
|
3915
3915
|
}
|
|
3916
3916
|
}
|
|
3917
|
+
if (this.drawingLine.lineName === 'polyline' &&
|
|
3918
|
+
!to.connectTo &&
|
|
3919
|
+
this.drawingLine.calculative.worldAnchors.length > 2) {
|
|
3920
|
+
//拐出一点
|
|
3921
|
+
let toLast = this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length - 2];
|
|
3922
|
+
if (Math.abs(toLast.x - to.x) / this.store.data.scale < 5 &&
|
|
3923
|
+
Math.abs(toLast.y - to.y) / this.store.data.scale < 5) {
|
|
3924
|
+
this.drawingLine.calculative.worldAnchors.pop();
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3917
3927
|
const rect = getLineRect(this.drawingLine);
|
|
3918
3928
|
Object.assign(this.drawingLine, rect);
|
|
3919
3929
|
this.drawingLine.calculative.worldRect = rect;
|
|
@@ -4271,7 +4281,7 @@ export class Canvas {
|
|
|
4271
4281
|
});
|
|
4272
4282
|
}
|
|
4273
4283
|
pen.type && this.initLineRect(pen);
|
|
4274
|
-
if (pen.gradientColors || pen.lineGradientColors) {
|
|
4284
|
+
if ((pen.bkType && pen.gradientColors) || (pen.strokeType && pen.lineGradientColors)) {
|
|
4275
4285
|
if (pen.calculative.gradientTimer) {
|
|
4276
4286
|
clearTimeout(pen.calculative.gradientTimer);
|
|
4277
4287
|
}
|
|
@@ -4313,7 +4323,13 @@ export class Canvas {
|
|
|
4313
4323
|
}
|
|
4314
4324
|
});
|
|
4315
4325
|
this.store.styles = {};
|
|
4316
|
-
|
|
4326
|
+
let defaultTheme = '';
|
|
4327
|
+
const width = this.store.data.width || this.store.options.width;
|
|
4328
|
+
const height = this.store.data.height || this.store.options.height;
|
|
4329
|
+
if (!width && !height) {
|
|
4330
|
+
defaultTheme = 'default'; // 认为2d 默认没有主题
|
|
4331
|
+
}
|
|
4332
|
+
const themeObj = le5leTheme.getThemeObj(this.store.data.theme || defaultTheme);
|
|
4317
4333
|
Object.assign(this.store.styles, options, data, theme, themeObj);
|
|
4318
4334
|
}
|
|
4319
4335
|
render = (patchFlags) => {
|
|
@@ -7018,7 +7034,7 @@ export class Canvas {
|
|
|
7018
7034
|
const pen = this.store.pens[this.inputDiv.dataset.penId];
|
|
7019
7035
|
if (pen && pen.inputType === 'number') {
|
|
7020
7036
|
const value = e.target.innerText;
|
|
7021
|
-
const numericValue = value
|
|
7037
|
+
const numericValue = toNumber(value); // 移除非数字字符
|
|
7022
7038
|
// 如果输入的值不是纯数字,则替换为纯数字
|
|
7023
7039
|
if (value !== numericValue) {
|
|
7024
7040
|
e.preventDefault();
|