mce 0.23.0 → 0.24.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/dist/index.css +7 -0
- package/dist/index.js +34 -9
- package/dist/typed-global.d.ts +2 -1
- package/package.json +2 -2
package/dist/index.css
CHANGED
|
@@ -842,6 +842,13 @@
|
|
|
842
842
|
height: 1px;
|
|
843
843
|
width: 1px;
|
|
844
844
|
}
|
|
845
|
+
.m-smart-guides__dashed {
|
|
846
|
+
position: absolute;
|
|
847
|
+
background-image: repeating-linear-gradient(to right, rgba(var(--m-theme-secondary), 0.6) 0 4px, transparent 4px 7px);
|
|
848
|
+
}
|
|
849
|
+
.m-smart-guides__dashed--vertical {
|
|
850
|
+
background-image: repeating-linear-gradient(to bottom, rgba(var(--m-theme-secondary), 0.6) 0 4px, transparent 4px 7px);
|
|
851
|
+
}
|
|
845
852
|
.m-smart-guides__distance {
|
|
846
853
|
position: absolute;
|
|
847
854
|
display: flex;
|
package/dist/index.js
CHANGED
|
@@ -5767,7 +5767,7 @@ var _0_context_default = defineMixin((editor, options) => {
|
|
|
5767
5767
|
const textSelection = ref();
|
|
5768
5768
|
const hoverElement = ref();
|
|
5769
5769
|
const state = ref();
|
|
5770
|
-
const mode = ref("canvas");
|
|
5770
|
+
const mode = ref(options.mode ?? "canvas");
|
|
5771
5771
|
function setCursor(mode) {
|
|
5772
5772
|
renderEngine.value.input.setCursor(mode);
|
|
5773
5773
|
}
|
|
@@ -15332,7 +15332,7 @@ var smartGuides_default = definePlugin((editor) => {
|
|
|
15332
15332
|
const { zoom, position } = camera.value;
|
|
15333
15333
|
const scaleX = (v) => v * zoom.x;
|
|
15334
15334
|
const scaleY = (v) => v * zoom.y;
|
|
15335
|
-
return linePairs.value.
|
|
15335
|
+
return linePairs.value.flatMap((linePair) => {
|
|
15336
15336
|
const { target, source, type } = linePair;
|
|
15337
15337
|
const boxSource = source.box;
|
|
15338
15338
|
const boxTarget = target.box;
|
|
@@ -15342,6 +15342,7 @@ var smartGuides_default = definePlugin((editor) => {
|
|
|
15342
15342
|
"vb"
|
|
15343
15343
|
].includes(target.type);
|
|
15344
15344
|
const itemProps = {};
|
|
15345
|
+
const extra = [];
|
|
15345
15346
|
switch (type) {
|
|
15346
15347
|
case "alignment":
|
|
15347
15348
|
itemProps.class = ["alignment"];
|
|
@@ -15404,16 +15405,40 @@ var smartGuides_default = definePlugin((editor) => {
|
|
|
15404
15405
|
width: 1,
|
|
15405
15406
|
height: scaleY(linePair.distance)
|
|
15406
15407
|
};
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15408
|
+
const auxLeft = Math.min(boxSource.hl.pos, boxTarget.hl.pos);
|
|
15409
|
+
const auxRight = Math.max(boxSource.hr.pos, boxTarget.hr.pos);
|
|
15410
|
+
extra.push({
|
|
15411
|
+
class: ["dashed"],
|
|
15412
|
+
style: {
|
|
15413
|
+
left: scaleX(auxLeft) - position.left,
|
|
15414
|
+
top: scaleY(target.pos) - position.top,
|
|
15415
|
+
width: scaleX(auxRight - auxLeft),
|
|
15416
|
+
height: 1
|
|
15417
|
+
}
|
|
15418
|
+
});
|
|
15419
|
+
} else {
|
|
15420
|
+
itemProps.style = {
|
|
15421
|
+
left: scaleX(Math.min(source.pos, target.pos)) - position.left,
|
|
15422
|
+
top: scaleY(boxSource.vm.pos) - position.top,
|
|
15423
|
+
width: scaleX(linePair.distance),
|
|
15424
|
+
height: 1
|
|
15425
|
+
};
|
|
15426
|
+
const auxTop = Math.min(boxSource.vt.pos, boxTarget.vt.pos);
|
|
15427
|
+
const auxBottom = Math.max(boxSource.vb.pos, boxTarget.vb.pos);
|
|
15428
|
+
extra.push({
|
|
15429
|
+
class: ["dashed", "dashed--vertical"],
|
|
15430
|
+
style: {
|
|
15431
|
+
left: scaleX(target.pos) - position.left,
|
|
15432
|
+
top: scaleY(auxTop) - position.top,
|
|
15433
|
+
width: 1,
|
|
15434
|
+
height: scaleY(auxBottom - auxTop)
|
|
15435
|
+
}
|
|
15436
|
+
});
|
|
15437
|
+
}
|
|
15413
15438
|
itemProps.label = String(Math.round(linePair.distance));
|
|
15414
15439
|
break;
|
|
15415
15440
|
}
|
|
15416
|
-
return itemProps;
|
|
15441
|
+
return [itemProps, ...extra];
|
|
15417
15442
|
});
|
|
15418
15443
|
});
|
|
15419
15444
|
function getSnapPoints() {
|
package/dist/typed-global.d.ts
CHANGED
|
@@ -28,7 +28,8 @@ declare global {
|
|
|
28
28
|
interface Exporters {}
|
|
29
29
|
interface Config {}
|
|
30
30
|
interface Options extends DeepMaybe<Config> {
|
|
31
|
-
|
|
31
|
+
/** 编辑器初始模式,默认 'canvas'。见 {@link Mode}。 */
|
|
32
|
+
mode?: Mode
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
// Persistent editor mode, orthogonal to the transient `State`. 'canvas' is
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0",
|
|
5
5
|
"description": "A headless infinite canvas editor framework built on WebGL rendering, supports exporting to image, video, and PPT. Only the ESM.",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@vueuse/core": "^14.3.0",
|
|
61
61
|
"diff": "^9.0.0",
|
|
62
62
|
"lodash-es": "^4.18.1",
|
|
63
|
-
"modern-canvas": "^0.
|
|
63
|
+
"modern-canvas": "^0.22.0",
|
|
64
64
|
"modern-font": "^0.6.0",
|
|
65
65
|
"modern-idoc": "^0.11.8",
|
|
66
66
|
"modern-text": "^2.0.3",
|