@meta2d/core 1.0.57 → 1.0.58
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 +2 -2
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +23 -4
- package/src/core.js.map +1 -1
- package/src/diagrams/line/line.js +6 -1
- package/src/diagrams/line/line.js.map +1 -1
- package/src/diagrams/rectangle.js +1 -0
- package/src/diagrams/rectangle.js.map +1 -1
- package/src/pen/render.js +36 -36
- package/src/pen/render.js.map +1 -1
- package/src/pen/text.js +2 -4
- package/src/pen/text.js.map +1 -1
package/src/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { commonAnchors, commonPens, cube } from './diagrams';
|
|
2
2
|
import { Canvas } from './canvas';
|
|
3
|
-
import { calcInView, calcTextDrawRect, calcTextLines, calcTextRect, facePen, formatAttrs, getAllChildren, getFromAnchor, getParent, getToAnchor, getWords, LockState, PenType, renderPenRaw, setElemPosition, connectLine, nearestAnchor, setChildValue, isAncestor, isShowChild, CanvasLayer, validationPlugin, setLifeCycleFunc, getAllFollowers, isInteraction } from './pen';
|
|
3
|
+
import { calcInView, calcTextDrawRect, calcTextLines, calcTextRect, facePen, formatAttrs, getAllChildren, getFromAnchor, getParent, getToAnchor, getWords, LockState, PenType, renderPenRaw, setElemPosition, connectLine, nearestAnchor, setChildValue, isAncestor, isShowChild, CanvasLayer, validationPlugin, setLifeCycleFunc, getAllFollowers, isInteraction, calcWorldAnchors } from './pen';
|
|
4
4
|
import { rotatePoint } from './point';
|
|
5
5
|
import { clearStore, EditType, globalStore, register, registerAnchors, registerCanvasDraw, useStore, } from './store';
|
|
6
6
|
import { formatPadding, loadCss, s8, valueInArray, valueInRange, } from './utils';
|
|
@@ -144,7 +144,7 @@ export class Meta2d {
|
|
|
144
144
|
this.render();
|
|
145
145
|
}
|
|
146
146
|
setDatabyOptions(options = {}) {
|
|
147
|
-
const { color, activeColor, activeBackground, grid, gridColor, gridSize, fromArrow, toArrow, rule, ruleColor, textColor, } = options;
|
|
147
|
+
const { color, activeColor, activeBackground, grid, gridColor, gridSize, fromArrow, toArrow, rule, ruleColor, textColor, x = 0, y = 0, } = options;
|
|
148
148
|
this.setRule({ rule, ruleColor });
|
|
149
149
|
this.setGrid({
|
|
150
150
|
grid,
|
|
@@ -158,6 +158,8 @@ export class Meta2d {
|
|
|
158
158
|
activeBackground,
|
|
159
159
|
fromArrow,
|
|
160
160
|
toArrow,
|
|
161
|
+
x,
|
|
162
|
+
y
|
|
161
163
|
});
|
|
162
164
|
}
|
|
163
165
|
init(parent) {
|
|
@@ -1328,9 +1330,26 @@ export class Meta2d {
|
|
|
1328
1330
|
const pIdx = pens.findIndex(pen => pen.name === 'combine' && pen.showChild !== undefined);
|
|
1329
1331
|
if (pIdx !== -1) {
|
|
1330
1332
|
let parent = pens[pIdx];
|
|
1331
|
-
this.pushChildren(parent,
|
|
1333
|
+
// this.pushChildren(parent,[...pens.slice(0, pIdx), ...pens.slice(pIdx + 1)]);
|
|
1334
|
+
const rect = getRect(pens);
|
|
1335
|
+
Object.assign(parent, rect);
|
|
1336
|
+
Object.assign(parent.calculative.worldRect, rect);
|
|
1337
|
+
calcWorldAnchors(parent);
|
|
1338
|
+
parent.children.forEach(penId => {
|
|
1339
|
+
const pen = this.store.pens[penId];
|
|
1340
|
+
const childRect = calcRelativeRect(pen.calculative.worldRect, rect);
|
|
1341
|
+
Object.assign(pen, childRect);
|
|
1342
|
+
});
|
|
1332
1343
|
pens.forEach((pen) => {
|
|
1333
|
-
|
|
1344
|
+
if (pen.id !== parent.id) {
|
|
1345
|
+
parent.children.push(pen.id);
|
|
1346
|
+
pen.parentId = parent.id;
|
|
1347
|
+
const childRect = calcRelativeRect(pen.calculative.worldRect, rect);
|
|
1348
|
+
Object.assign(pen, childRect);
|
|
1349
|
+
pen.locked = pen.lockedOnCombine ?? LockState.DisableMove;
|
|
1350
|
+
pen.locked = (pen.interaction || isInteraction.includes(pen.name)) ? 0 : pen.locked;
|
|
1351
|
+
calcInView(pen, true);
|
|
1352
|
+
}
|
|
1334
1353
|
});
|
|
1335
1354
|
this.initImageCanvas(pens);
|
|
1336
1355
|
this.render();
|