@univerjs/drawing-ui 0.21.1 → 0.22.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/README.md +30 -15
- package/lib/cjs/index.js +66 -96
- package/lib/es/index.js +66 -96
- package/lib/index.js +66 -96
- package/lib/umd/index.js +1 -1
- package/package.json +19 -13
package/README.md
CHANGED
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
# @univerjs/drawing-ui
|
|
2
2
|
|
|
3
|
+
[](https://npmjs.com/package/@univerjs/drawing-ui)
|
|
4
|
+
[](https://npmjs.com/package/@univerjs/drawing-ui)
|
|
5
|
+
[](https://npmjs.com/package/@univerjs/drawing-ui)
|
|
6
|
+
|
|
7
|
+
`@univerjs/drawing-ui` provides common drawing UI services and components that document- or sheet-specific drawing packages build on.
|
|
8
|
+
|
|
3
9
|
## Package Overview
|
|
4
10
|
|
|
5
|
-
| Package
|
|
6
|
-
| --- | --- |
|
|
7
|
-
| `@univerjs/drawing-ui` | `UniverDrawingUi` |
|
|
11
|
+
| Package | UMD global | CSS | Locales | Facade entry |
|
|
12
|
+
| --- | --- | :---: | :---: | :---: |
|
|
13
|
+
| `@univerjs/drawing-ui` | `UniverDrawingUi` | Yes | Yes | No |
|
|
8
14
|
|
|
9
|
-
##
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pnpm add @univerjs/drawing-ui
|
|
19
|
+
# or
|
|
20
|
+
npm install @univerjs/drawing-ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Keep all `@univerjs/*` packages on the same version.
|
|
10
24
|
|
|
11
25
|
## Usage
|
|
12
26
|
|
|
13
|
-
|
|
27
|
+
```ts
|
|
28
|
+
import '@univerjs/drawing-ui/lib/index.css';
|
|
29
|
+
import EnUS from '@univerjs/drawing-ui/locale/en-US';
|
|
30
|
+
import { UniverDrawingUIPlugin } from '@univerjs/drawing-ui';
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
# Using npm
|
|
17
|
-
npm install @univerjs/drawing
|
|
32
|
+
univer.registerPlugin(UniverDrawingUIPlugin);
|
|
18
33
|
|
|
19
|
-
|
|
20
|
-
pnpm add @univerjs/drawing
|
|
34
|
+
// Merge EnUS into your Univer locale map when this package contributes UI text.
|
|
21
35
|
```
|
|
22
36
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
37
|
+
## Resources
|
|
38
|
+
|
|
39
|
+
- [Documentation](https://docs.univer.ai)
|
|
40
|
+
- [NPM package](https://npmjs.com/package/@univerjs/drawing-ui)
|
|
41
|
+
- [GitHub repository](https://github.com/dream-num/univer)
|
|
42
|
+
|
package/lib/cjs/index.js
CHANGED
|
@@ -10,18 +10,6 @@ let react = require("react");
|
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
|
|
12
12
|
//#region src/commands/operations/drawing-align.operation.ts
|
|
13
|
-
let AlignType = /* @__PURE__ */ function(AlignType) {
|
|
14
|
-
AlignType["default"] = "0";
|
|
15
|
-
AlignType["left"] = "1";
|
|
16
|
-
AlignType["center"] = "2";
|
|
17
|
-
AlignType["right"] = "3";
|
|
18
|
-
AlignType["top"] = "4";
|
|
19
|
-
AlignType["middle"] = "5";
|
|
20
|
-
AlignType["bottom"] = "6";
|
|
21
|
-
AlignType["horizon"] = "7";
|
|
22
|
-
AlignType["vertical"] = "8";
|
|
23
|
-
return AlignType;
|
|
24
|
-
}({});
|
|
25
13
|
/**
|
|
26
14
|
* Set drawing align operation, including left, center, right, top, middle, bottom, horizon and vertical align.
|
|
27
15
|
*/
|
|
@@ -36,56 +24,56 @@ const SetDrawingAlignLeftOperation = {
|
|
|
36
24
|
id: "sheet.operation.set-drawing-align-left",
|
|
37
25
|
type: _univerjs_core.CommandType.OPERATION,
|
|
38
26
|
handler: (accessor) => {
|
|
39
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
27
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "1" });
|
|
40
28
|
}
|
|
41
29
|
};
|
|
42
30
|
const SetDrawingAlignCenterOperation = {
|
|
43
31
|
id: "sheet.operation.set-drawing-align-center",
|
|
44
32
|
type: _univerjs_core.CommandType.OPERATION,
|
|
45
33
|
handler: (accessor) => {
|
|
46
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
34
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "2" });
|
|
47
35
|
}
|
|
48
36
|
};
|
|
49
37
|
const SetDrawingAlignRightOperation = {
|
|
50
38
|
id: "sheet.operation.set-drawing-align-right",
|
|
51
39
|
type: _univerjs_core.CommandType.OPERATION,
|
|
52
40
|
handler: (accessor) => {
|
|
53
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
41
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "3" });
|
|
54
42
|
}
|
|
55
43
|
};
|
|
56
44
|
const SetDrawingAlignTopOperation = {
|
|
57
45
|
id: "sheet.operation.set-drawing-align-top",
|
|
58
46
|
type: _univerjs_core.CommandType.OPERATION,
|
|
59
47
|
handler: (accessor) => {
|
|
60
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
48
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "4" });
|
|
61
49
|
}
|
|
62
50
|
};
|
|
63
51
|
const SetDrawingAlignMiddleOperation = {
|
|
64
52
|
id: "sheet.operation.set-drawing-align-middle",
|
|
65
53
|
type: _univerjs_core.CommandType.OPERATION,
|
|
66
54
|
handler: (accessor) => {
|
|
67
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
55
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "5" });
|
|
68
56
|
}
|
|
69
57
|
};
|
|
70
58
|
const SetDrawingAlignBottomOperation = {
|
|
71
59
|
id: "sheet.operation.set-drawing-align-bottom",
|
|
72
60
|
type: _univerjs_core.CommandType.OPERATION,
|
|
73
61
|
handler: (accessor) => {
|
|
74
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
62
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "6" });
|
|
75
63
|
}
|
|
76
64
|
};
|
|
77
65
|
const SetDrawingAlignHorizonOperation = {
|
|
78
66
|
id: "sheet.operation.set-drawing-align-horizon",
|
|
79
67
|
type: _univerjs_core.CommandType.OPERATION,
|
|
80
68
|
handler: (accessor) => {
|
|
81
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
69
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "7" });
|
|
82
70
|
}
|
|
83
71
|
};
|
|
84
72
|
const SetDrawingAlignVerticalOperation = {
|
|
85
73
|
id: "sheet.operation.set-drawing-align-vertical",
|
|
86
74
|
type: _univerjs_core.CommandType.OPERATION,
|
|
87
75
|
handler: (accessor) => {
|
|
88
|
-
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType:
|
|
76
|
+
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetDrawingAlignOperation.id, { alignType: "8" });
|
|
89
77
|
}
|
|
90
78
|
};
|
|
91
79
|
|
|
@@ -261,19 +249,6 @@ const CloseImageCropOperation = {
|
|
|
261
249
|
return true;
|
|
262
250
|
}
|
|
263
251
|
};
|
|
264
|
-
let CropType = /* @__PURE__ */ function(CropType) {
|
|
265
|
-
CropType["FREE"] = "0";
|
|
266
|
-
CropType["R1_1"] = "1";
|
|
267
|
-
CropType["R16_9"] = "2";
|
|
268
|
-
CropType["R9_16"] = "3";
|
|
269
|
-
CropType["R5_4"] = "4";
|
|
270
|
-
CropType["R4_5"] = "5";
|
|
271
|
-
CropType["R4_3"] = "6";
|
|
272
|
-
CropType["R3_4"] = "7";
|
|
273
|
-
CropType["R3_2"] = "8";
|
|
274
|
-
CropType["R2_3"] = "9";
|
|
275
|
-
return CropType;
|
|
276
|
-
}({});
|
|
277
252
|
const AutoImageCropOperation = {
|
|
278
253
|
id: "sheet.operation.Auto-image-crop",
|
|
279
254
|
type: _univerjs_core.CommandType.OPERATION,
|
|
@@ -347,7 +322,7 @@ function getCurrentUnitInfo(currentUniverService, propUnitId) {
|
|
|
347
322
|
//#endregion
|
|
348
323
|
//#region package.json
|
|
349
324
|
var name = "@univerjs/drawing-ui";
|
|
350
|
-
var version = "0.
|
|
325
|
+
var version = "0.22.0";
|
|
351
326
|
|
|
352
327
|
//#endregion
|
|
353
328
|
//#region src/config/config.ts
|
|
@@ -686,7 +661,7 @@ function ImagePopupMenu(props) {
|
|
|
686
661
|
}
|
|
687
662
|
|
|
688
663
|
//#endregion
|
|
689
|
-
//#region \0@oxc-project+runtime@0.
|
|
664
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
690
665
|
function __decorateParam(paramIndex, decorator) {
|
|
691
666
|
return function(target, key) {
|
|
692
667
|
decorator(target, key, paramIndex);
|
|
@@ -694,7 +669,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
694
669
|
}
|
|
695
670
|
|
|
696
671
|
//#endregion
|
|
697
|
-
//#region \0@oxc-project+runtime@0.
|
|
672
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
698
673
|
function __decorate(decorators, target, key, desc) {
|
|
699
674
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
700
675
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -811,7 +786,7 @@ function getUpdateParams(objects, drawingManagerService) {
|
|
|
811
786
|
}
|
|
812
787
|
|
|
813
788
|
//#endregion
|
|
814
|
-
//#region \0@oxc-project+runtime@0.
|
|
789
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
815
790
|
function _typeof(o) {
|
|
816
791
|
"@babel/helpers - typeof";
|
|
817
792
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -822,7 +797,7 @@ function _typeof(o) {
|
|
|
822
797
|
}
|
|
823
798
|
|
|
824
799
|
//#endregion
|
|
825
|
-
//#region \0@oxc-project+runtime@0.
|
|
800
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
826
801
|
function toPrimitive(t, r) {
|
|
827
802
|
if ("object" != _typeof(t) || !t) return t;
|
|
828
803
|
var e = t[Symbol.toPrimitive];
|
|
@@ -835,14 +810,14 @@ function toPrimitive(t, r) {
|
|
|
835
810
|
}
|
|
836
811
|
|
|
837
812
|
//#endregion
|
|
838
|
-
//#region \0@oxc-project+runtime@0.
|
|
813
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
839
814
|
function toPropertyKey(t) {
|
|
840
815
|
var i = toPrimitive(t, "string");
|
|
841
816
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
842
817
|
}
|
|
843
818
|
|
|
844
819
|
//#endregion
|
|
845
|
-
//#region \0@oxc-project+runtime@0.
|
|
820
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
846
821
|
function _defineProperty(e, r, t) {
|
|
847
822
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
848
823
|
value: t,
|
|
@@ -1012,7 +987,7 @@ let DrawingUpdateController = class DrawingUpdateController extends _univerjs_co
|
|
|
1012
987
|
_drawingAlign(params) {
|
|
1013
988
|
const { alignType } = params;
|
|
1014
989
|
const drawings = params.drawings || this._drawingManagerService.getFocusDrawings();
|
|
1015
|
-
if (alignType ===
|
|
990
|
+
if (alignType === "0") return;
|
|
1016
991
|
const drawingTransformCaches = [];
|
|
1017
992
|
let minLeft = Number.POSITIVE_INFINITY;
|
|
1018
993
|
let minTop = Number.POSITIVE_INFINITY;
|
|
@@ -1058,28 +1033,28 @@ let DrawingUpdateController = class DrawingUpdateController extends _univerjs_co
|
|
|
1058
1033
|
let newLeft = left;
|
|
1059
1034
|
let newTop = top;
|
|
1060
1035
|
switch (alignType) {
|
|
1061
|
-
case
|
|
1036
|
+
case "1":
|
|
1062
1037
|
newLeft = minLeft;
|
|
1063
1038
|
break;
|
|
1064
|
-
case
|
|
1039
|
+
case "2":
|
|
1065
1040
|
newLeft = minLeft + (maxRight - minLeft) / 2 - width / 2;
|
|
1066
1041
|
break;
|
|
1067
|
-
case
|
|
1042
|
+
case "3":
|
|
1068
1043
|
newLeft = maxRight - width;
|
|
1069
1044
|
break;
|
|
1070
|
-
case
|
|
1045
|
+
case "4":
|
|
1071
1046
|
newTop = minTop;
|
|
1072
1047
|
break;
|
|
1073
|
-
case
|
|
1048
|
+
case "5":
|
|
1074
1049
|
newTop = minTop + (maxBottom - minTop) / 2 - height / 2;
|
|
1075
1050
|
break;
|
|
1076
|
-
case
|
|
1051
|
+
case "6":
|
|
1077
1052
|
newTop = maxBottom - height;
|
|
1078
1053
|
break;
|
|
1079
|
-
case
|
|
1054
|
+
case "7":
|
|
1080
1055
|
newLeft = minLeft + averageHorizon * index;
|
|
1081
1056
|
break;
|
|
1082
|
-
case
|
|
1057
|
+
case "8":
|
|
1083
1058
|
newTop = minTop + averageVertical * index;
|
|
1084
1059
|
break;
|
|
1085
1060
|
default: break;
|
|
@@ -1105,14 +1080,14 @@ let DrawingUpdateController = class DrawingUpdateController extends _univerjs_co
|
|
|
1105
1080
|
const { left: aLeft = 0, top: aTop = 0, width: aWidth = 0, height: aHeight = 0 } = aTransform;
|
|
1106
1081
|
const { left: bLeft = 0, top: bTop = 0, width: bWidth = 0, height: bHeight = 0 } = bTransform;
|
|
1107
1082
|
switch (alignType) {
|
|
1108
|
-
case
|
|
1109
|
-
case
|
|
1110
|
-
case
|
|
1111
|
-
case
|
|
1112
|
-
case
|
|
1113
|
-
case
|
|
1114
|
-
case
|
|
1115
|
-
case
|
|
1083
|
+
case "1": return aLeft - bLeft;
|
|
1084
|
+
case "2": return aLeft + aWidth / 2 - (bLeft + bWidth / 2);
|
|
1085
|
+
case "3": return aLeft + aWidth - (bLeft + bWidth);
|
|
1086
|
+
case "4": return aTop - bTop;
|
|
1087
|
+
case "5": return aTop + aHeight / 2 - (bTop + bHeight / 2);
|
|
1088
|
+
case "6": return aTop + aHeight - (bTop + bHeight);
|
|
1089
|
+
case "7": return aLeft + aWidth / 2 - (bLeft + bWidth / 2);
|
|
1090
|
+
case "8": return aTop + aHeight / 2 - (bTop + bHeight / 2);
|
|
1116
1091
|
default: return 0;
|
|
1117
1092
|
}
|
|
1118
1093
|
});
|
|
@@ -1344,11 +1319,6 @@ DrawingUpdateController = __decorate([
|
|
|
1344
1319
|
|
|
1345
1320
|
//#endregion
|
|
1346
1321
|
//#region src/views/crop/image-cropper-object.ts
|
|
1347
|
-
var ImageCropperObjectType = /* @__PURE__ */ function(ImageCropperObjectType) {
|
|
1348
|
-
ImageCropperObjectType[ImageCropperObjectType["RECT"] = 0] = "RECT";
|
|
1349
|
-
ImageCropperObjectType[ImageCropperObjectType["PATH"] = 1] = "PATH";
|
|
1350
|
-
return ImageCropperObjectType;
|
|
1351
|
-
}(ImageCropperObjectType || {});
|
|
1352
1322
|
var ImageCropperObject = class extends _univerjs_engine_render.Shape {
|
|
1353
1323
|
constructor(key, props) {
|
|
1354
1324
|
if (props == null) props = {};
|
|
@@ -1427,11 +1397,11 @@ var ImageCropperObject = class extends _univerjs_engine_render.Shape {
|
|
|
1427
1397
|
cacheCtx.restore();
|
|
1428
1398
|
}
|
|
1429
1399
|
_clipForApplyObject(cacheCtx) {
|
|
1430
|
-
let objectType =
|
|
1431
|
-
if (this._prstGeom != null) objectType =
|
|
1400
|
+
let objectType = 0;
|
|
1401
|
+
if (this._prstGeom != null) objectType = 1;
|
|
1432
1402
|
cacheCtx.globalCompositeOperation = "destination-out";
|
|
1433
1403
|
cacheCtx.beginPath();
|
|
1434
|
-
if (objectType ===
|
|
1404
|
+
if (objectType === 0) {
|
|
1435
1405
|
const m = this.transform.getMatrix();
|
|
1436
1406
|
cacheCtx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
1437
1407
|
cacheCtx.rect(0, 0, this.width, this.height);
|
|
@@ -1562,34 +1532,34 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
|
|
|
1562
1532
|
const { left, top, width, height } = imageShape.calculateTransformWithSrcRect();
|
|
1563
1533
|
let newSrcRect;
|
|
1564
1534
|
switch (cropType) {
|
|
1565
|
-
case
|
|
1535
|
+
case "1":
|
|
1566
1536
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 1, 1);
|
|
1567
1537
|
break;
|
|
1568
|
-
case
|
|
1538
|
+
case "2":
|
|
1569
1539
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 16, 9);
|
|
1570
1540
|
break;
|
|
1571
|
-
case
|
|
1541
|
+
case "3":
|
|
1572
1542
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 9, 16);
|
|
1573
1543
|
break;
|
|
1574
|
-
case
|
|
1544
|
+
case "4":
|
|
1575
1545
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 5, 4);
|
|
1576
1546
|
break;
|
|
1577
|
-
case
|
|
1547
|
+
case "5":
|
|
1578
1548
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 4, 5);
|
|
1579
1549
|
break;
|
|
1580
|
-
case
|
|
1550
|
+
case "6":
|
|
1581
1551
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 4, 3);
|
|
1582
1552
|
break;
|
|
1583
|
-
case
|
|
1553
|
+
case "7":
|
|
1584
1554
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 3, 4);
|
|
1585
1555
|
break;
|
|
1586
|
-
case
|
|
1556
|
+
case "8":
|
|
1587
1557
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 3, 2);
|
|
1588
1558
|
break;
|
|
1589
|
-
case
|
|
1559
|
+
case "9":
|
|
1590
1560
|
newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 2, 3);
|
|
1591
1561
|
break;
|
|
1592
|
-
case
|
|
1562
|
+
case "0":
|
|
1593
1563
|
default: break;
|
|
1594
1564
|
}
|
|
1595
1565
|
if (newSrcRect == null) return;
|
|
@@ -2226,46 +2196,46 @@ const DrawingAlign = (props) => {
|
|
|
2226
2196
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
2227
2197
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
2228
2198
|
const { drawings, alignShow } = props;
|
|
2229
|
-
const [alignValue, setAlignValue] = (0, react.useState)(
|
|
2199
|
+
const [alignValue, setAlignValue] = (0, react.useState)("0");
|
|
2230
2200
|
const alignOptions = [
|
|
2231
2201
|
{
|
|
2232
2202
|
label: localeService.t("image-panel.align.default"),
|
|
2233
|
-
value:
|
|
2203
|
+
value: "0"
|
|
2234
2204
|
},
|
|
2235
2205
|
{ options: [
|
|
2236
2206
|
{
|
|
2237
2207
|
label: localeService.t("image-panel.align.left"),
|
|
2238
|
-
value:
|
|
2208
|
+
value: "1"
|
|
2239
2209
|
},
|
|
2240
2210
|
{
|
|
2241
2211
|
label: localeService.t("image-panel.align.center"),
|
|
2242
|
-
value:
|
|
2212
|
+
value: "2"
|
|
2243
2213
|
},
|
|
2244
2214
|
{
|
|
2245
2215
|
label: localeService.t("image-panel.align.right"),
|
|
2246
|
-
value:
|
|
2216
|
+
value: "3"
|
|
2247
2217
|
}
|
|
2248
2218
|
] },
|
|
2249
2219
|
{ options: [
|
|
2250
2220
|
{
|
|
2251
2221
|
label: localeService.t("image-panel.align.top"),
|
|
2252
|
-
value:
|
|
2222
|
+
value: "4"
|
|
2253
2223
|
},
|
|
2254
2224
|
{
|
|
2255
2225
|
label: localeService.t("image-panel.align.middle"),
|
|
2256
|
-
value:
|
|
2226
|
+
value: "5"
|
|
2257
2227
|
},
|
|
2258
2228
|
{
|
|
2259
2229
|
label: localeService.t("image-panel.align.bottom"),
|
|
2260
|
-
value:
|
|
2230
|
+
value: "6"
|
|
2261
2231
|
}
|
|
2262
2232
|
] },
|
|
2263
2233
|
{ options: [{
|
|
2264
2234
|
label: localeService.t("image-panel.align.horizon"),
|
|
2265
|
-
value:
|
|
2235
|
+
value: "7"
|
|
2266
2236
|
}, {
|
|
2267
2237
|
label: localeService.t("image-panel.align.vertical"),
|
|
2268
|
-
value:
|
|
2238
|
+
value: "8"
|
|
2269
2239
|
}] }
|
|
2270
2240
|
];
|
|
2271
2241
|
function handleAlignChange(value) {
|
|
@@ -2689,48 +2659,48 @@ const ImageCropper = (props) => {
|
|
|
2689
2659
|
const canUseShapeClip = (0, _univerjs_ui.useObservable)(clipService.canUseShapeClip$, false);
|
|
2690
2660
|
const { drawings, cropperShow } = props;
|
|
2691
2661
|
if (drawings[0] == null) return;
|
|
2692
|
-
const [cropValue, setCropValue] = (0, react.useState)(
|
|
2662
|
+
const [cropValue, setCropValue] = (0, react.useState)("0");
|
|
2693
2663
|
const cropStateRef = (0, react.useRef)(false);
|
|
2694
2664
|
const cropOptions = [
|
|
2695
2665
|
{
|
|
2696
2666
|
label: localeService.t("image-panel.crop.mode"),
|
|
2697
|
-
value:
|
|
2667
|
+
value: "0"
|
|
2698
2668
|
},
|
|
2699
2669
|
{
|
|
2700
2670
|
label: "1:1",
|
|
2701
|
-
value:
|
|
2671
|
+
value: "1"
|
|
2702
2672
|
},
|
|
2703
2673
|
{
|
|
2704
2674
|
label: "16:9",
|
|
2705
|
-
value:
|
|
2675
|
+
value: "2"
|
|
2706
2676
|
},
|
|
2707
2677
|
{
|
|
2708
2678
|
label: "9:16",
|
|
2709
|
-
value:
|
|
2679
|
+
value: "3"
|
|
2710
2680
|
},
|
|
2711
2681
|
{
|
|
2712
2682
|
label: "5:4",
|
|
2713
|
-
value:
|
|
2683
|
+
value: "4"
|
|
2714
2684
|
},
|
|
2715
2685
|
{
|
|
2716
2686
|
label: "4:5",
|
|
2717
|
-
value:
|
|
2687
|
+
value: "5"
|
|
2718
2688
|
},
|
|
2719
2689
|
{
|
|
2720
2690
|
label: "4:3",
|
|
2721
|
-
value:
|
|
2691
|
+
value: "6"
|
|
2722
2692
|
},
|
|
2723
2693
|
{
|
|
2724
2694
|
label: "3:4",
|
|
2725
|
-
value:
|
|
2695
|
+
value: "7"
|
|
2726
2696
|
},
|
|
2727
2697
|
{
|
|
2728
2698
|
label: "3:2",
|
|
2729
|
-
value:
|
|
2699
|
+
value: "8"
|
|
2730
2700
|
},
|
|
2731
2701
|
{
|
|
2732
2702
|
label: "2:3",
|
|
2733
|
-
value:
|
|
2703
|
+
value: "9"
|
|
2734
2704
|
}
|
|
2735
2705
|
];
|
|
2736
2706
|
(0, react.useEffect)(() => {
|