@wcardinal/wcardinal-ui 0.303.0 → 0.305.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/types/wcardinal/ui/shape/e-shape-transforms.d.ts +2 -2
- package/dist/wcardinal/ui/shape/e-shape-transforms.js +1 -1
- package/dist/wcardinal/ui/shape/e-shape-transforms.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/to-resized.js +80 -20
- package/dist/wcardinal/ui/shape/variant/to-resized.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +80 -22
- package/dist/wcardinal-ui.js +80 -22
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPoint, Matrix } from "pixi.js";
|
|
2
2
|
import { EShape } from "./e-shape";
|
|
3
3
|
import { EShapeCapability } from "./e-shape-capability";
|
|
4
4
|
export declare class EShapeTransforms {
|
|
5
5
|
static prepare(shape: EShape): void;
|
|
6
6
|
static finalize(shape: EShape): void;
|
|
7
7
|
static apply(shape: EShape, transform: Matrix, capability: EShapeCapability): void;
|
|
8
|
-
static applyLocal(shape: EShape, localTransform: Matrix, capability: EShapeCapability, size
|
|
8
|
+
static applyLocal(shape: EShape, localTransform: Matrix, capability: EShapeCapability, size?: IPoint): void;
|
|
9
9
|
}
|
|
@@ -91,7 +91,7 @@ var EShapeTransforms = /** @class */ (function () {
|
|
|
91
91
|
transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
|
|
92
92
|
}
|
|
93
93
|
// Scale
|
|
94
|
-
if (cwidth || cheight) {
|
|
94
|
+
if (size != null && (cwidth || cheight)) {
|
|
95
95
|
var w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));
|
|
96
96
|
var h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));
|
|
97
97
|
var s = shape.size;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-transforms.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-transforms.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;IAAA;IAqHA,CAAC;IApHO,wBAAO,GAAd,UAAe,KAAa;QAC3B,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAClD,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAEtB,YAAY;QACZ,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,MAAM,YAAY,UAAU,EAAE;YACjC,MAAM,CAAC,SAAS,CAAC,iBAAiB;iBAChC,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC;iBAC7C,MAAM,EAAE,CAAC;SACX;aAAM;YACN,MAAM,CAAC,8BAA8B,CAAC,QAAQ,EAAE,CAAC;SACjD;QACD,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAEnE,WAAW;QACX,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;QAE3C,OAAO;QACP,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEjC,EAAE;QACF,KAAK,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAEM,yBAAQ,GAAf,UAAgB,KAAa;QAC5B,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAEM,sBAAK,GAAZ,UAAa,KAAa,EAAE,SAAiB,EAAE,UAA4B;QAC1E,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,MAAM,IAAI,IAAI,EAAE;YACnB,IAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC;YAChD,MAAM,CAAC,8BAA8B;iBACnC,MAAM,CAAC,iBAAiB,CAAC;iBACzB,MAAM,CAAC,SAAS,CAAC;iBACjB,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YACnC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;SACnE;IACF,CAAC;IAEM,2BAAU,GAAjB,UACC,KAAa,EACb,cAAsB,EACtB,UAA4B,EAC5B,
|
|
1
|
+
{"version":3,"file":"e-shape-transforms.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-transforms.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;IAAA;IAqHA,CAAC;IApHO,wBAAO,GAAd,UAAe,KAAa;QAC3B,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAClD,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAEtB,YAAY;QACZ,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAM,MAAM,GA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BAAM;gBACN,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;aACR;SACD;QAED,EAAE;QACF,KAAK,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IACF,uBAAC;AAAD,CAAC,AArHD,IAqHC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IPoint, Matrix } from \"pixi.js\";\nimport { EShape } from \"./e-shape\";\nimport { EShapeEditor } from \"./e-shape-editor\";\nimport { EShapeBase } from \"./variant/e-shape-base\";\nimport { toSizeNormalized } from \"./variant/to-size-normalized\";\nimport { EShapeCapability } from \"./e-shape-capability\";\n\nexport class EShapeTransforms {\n\tstatic prepare(shape: EShape): void {\n\t\tconst editor = shape.editor || new EShapeEditor();\n\t\tshape.editor = editor;\n\n\t\t// Transform\n\t\tshape.updateTransform();\n\t\tconst parent = shape.parent;\n\t\tif (parent instanceof EShapeBase) {\n\t\t\tparent.transform.internalTransform\n\t\t\t\t.copyTo(editor.internalTransformParentInverse)\n\t\t\t\t.invert();\n\t\t} else {\n\t\t\teditor.internalTransformParentInverse.identity();\n\t\t}\n\t\tshape.transform.internalTransform.copyTo(editor.internalTransform);\n\n\t\t// Rotation\n\t\teditor.rotation = shape.transform.rotation;\n\n\t\t// Size\n\t\teditor.size.copyFrom(shape.size);\n\n\t\t//\n\t\tshape.disallowOnTransformChange();\n\t}\n\n\tstatic finalize(shape: EShape): void {\n\t\tshape.allowOnTransformChange(true);\n\t}\n\n\tstatic apply(shape: EShape, transform: Matrix, capability: EShapeCapability): void {\n\t\tconst editor = shape.editor;\n\t\tif (editor != null) {\n\t\t\tconst newLocalTransform = editor.localTransform;\n\t\t\teditor.internalTransformParentInverse\n\t\t\t\t.copyTo(newLocalTransform)\n\t\t\t\t.append(transform)\n\t\t\t\t.append(editor.internalTransform);\n\t\t\tthis.applyLocal(shape, newLocalTransform, capability, editor.size);\n\t\t}\n\t}\n\n\tstatic applyLocal(\n\t\tshape: EShape,\n\t\tlocalTransform: Matrix,\n\t\tcapability: EShapeCapability,\n\t\tsize?: IPoint\n\t): void {\n\t\tshape.disallowUploadedUpdate();\n\n\t\t// Reconstruct the position, the rotation and the size\n\t\tconst a = localTransform.a;\n\t\tconst b = localTransform.b;\n\t\tconst c = localTransform.c;\n\t\tconst d = localTransform.d;\n\t\tconst tx = localTransform.tx;\n\t\tconst ty = localTransform.ty;\n\n\t\t// Transform\n\t\tconst transform = shape.transform;\n\n\t\t// Capability\n\t\tconst cposition = !!(capability & EShapeCapability.POSITION);\n\t\tconst crotation = !!(capability & EShapeCapability.ROTATION);\n\t\tconst cskew = !!(capability & EShapeCapability.SKEW);\n\t\tconst cwidth = !!(capability & EShapeCapability.WIDTH);\n\t\tconst cheight = !!(capability & EShapeCapability.HEIGHT);\n\n\t\t// Rotation and skew\n\t\tif (crotation || cskew) {\n\t\t\t// Rotation\n\t\t\tconst rx = Math.atan2(-c, d); // rotation - skewX\n\t\t\tconst ry = Math.atan2(+b, a); // rotation + skewY\n\t\t\tif (crotation) {\n\t\t\t\ttransform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`\n\t\t\t}\n\n\t\t\t// Skew\n\t\t\tif (cskew) {\n\t\t\t\tconst skew = (ry - rx) * 0.5;\n\t\t\t\ttransform.skew.set(skew, skew);\n\t\t\t}\n\t\t}\n\n\t\t// Position\n\t\tif (cposition) {\n\t\t\t// Assumes the pivot is invariant.\n\t\t\t// tx = position.x - (a * px + c * py)\n\t\t\t// ty = position.y - (b * px + d * py)\n\t\t\t//\n\t\t\t// Thus,\n\t\t\t// position.x = tx + (a * px + c * py)\n\t\t\t// position.y = ty + (b * px + d * py)\n\t\t\tconst pivot = transform.pivot;\n\t\t\tconst px = pivot.x;\n\t\t\tconst py = pivot.y;\n\t\t\ttransform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));\n\t\t}\n\n\t\t// Scale\n\t\tif (size != null && (cwidth || cheight)) {\n\t\t\tconst w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));\n\t\t\tconst h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));\n\t\t\tconst s = shape.size;\n\t\t\tif (cwidth && cheight) {\n\t\t\t\ts.set(w, h);\n\t\t\t} else if (cwidth) {\n\t\t\t\ts.x = w;\n\t\t\t} else {\n\t\t\t\ts.y = h;\n\t\t\t}\n\t\t}\n\n\t\t//\n\t\tshape.allowUploadedUpdate();\n\t}\n}\n"]}
|
|
@@ -4,47 +4,107 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { toSizeNormalized } from "./to-size-normalized";
|
|
6
6
|
import { toSizeRounded } from "./to-size-rounded";
|
|
7
|
+
import { EShapeCapabilities } from "../e-shape-capabilities";
|
|
8
|
+
import { EShapeCapability } from "../e-shape-capability";
|
|
7
9
|
export var toResized = function (shape, from, to, centerMode, isPerfect) {
|
|
10
|
+
var cposition = EShapeCapabilities.contains(shape, EShapeCapability.POSITION);
|
|
11
|
+
var cwidth = EShapeCapabilities.contains(shape, EShapeCapability.WIDTH);
|
|
12
|
+
var cheight = EShapeCapabilities.contains(shape, EShapeCapability.HEIGHT);
|
|
8
13
|
shape.disallowUploadedUpdate();
|
|
9
14
|
var position = shape.transform.position;
|
|
10
15
|
if (centerMode) {
|
|
11
16
|
var dx = Math.abs(to.x - from.x);
|
|
12
17
|
var dy = Math.abs(to.y - from.y);
|
|
13
18
|
if (isPerfect) {
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
var d = Math.max(dx, dy);
|
|
20
|
+
var s = toSizeNormalized(d + d);
|
|
21
|
+
var x = toSizeRounded(from.x);
|
|
22
|
+
var y = toSizeRounded(from.y);
|
|
23
|
+
var size = shape.size;
|
|
24
|
+
if (cwidth && cheight) {
|
|
25
|
+
size.set(s, s);
|
|
26
|
+
}
|
|
27
|
+
else if (cwidth) {
|
|
28
|
+
size.x = s;
|
|
29
|
+
}
|
|
30
|
+
else if (cheight) {
|
|
31
|
+
size.y = s;
|
|
32
|
+
}
|
|
33
|
+
if (cposition) {
|
|
34
|
+
position.set(x, y);
|
|
35
|
+
}
|
|
18
36
|
}
|
|
19
37
|
else {
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
var w = toSizeNormalized(dx + dx);
|
|
39
|
+
var h = toSizeNormalized(dy + dy);
|
|
40
|
+
var x = toSizeRounded(from.x);
|
|
41
|
+
var y = toSizeRounded(from.y);
|
|
42
|
+
var size = shape.size;
|
|
43
|
+
if (cwidth && cheight) {
|
|
44
|
+
size.set(w, h);
|
|
45
|
+
}
|
|
46
|
+
else if (cwidth) {
|
|
47
|
+
size.x = w;
|
|
48
|
+
}
|
|
49
|
+
else if (cheight) {
|
|
50
|
+
size.y = h;
|
|
51
|
+
}
|
|
52
|
+
if (cposition) {
|
|
53
|
+
position.set(x, y);
|
|
54
|
+
}
|
|
22
55
|
}
|
|
23
56
|
}
|
|
24
57
|
else {
|
|
25
58
|
if (isPerfect) {
|
|
26
59
|
var dx = to.x - from.x;
|
|
27
60
|
var dy = to.y - from.y;
|
|
28
|
-
var
|
|
29
|
-
var x2 = from.x + (dx < 0 ? -
|
|
30
|
-
var y2 = from.y + (dy < 0 ? -
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
61
|
+
var d = Math.max(Math.abs(dx), Math.abs(dy));
|
|
62
|
+
var x2 = from.x + (dx < 0 ? -d : +d);
|
|
63
|
+
var y2 = from.y + (dy < 0 ? -d : +d);
|
|
64
|
+
var hd = d * 0.5;
|
|
65
|
+
var s = toSizeNormalized(d);
|
|
66
|
+
var x = toSizeRounded(Math.min(from.x, x2) + hd);
|
|
67
|
+
var y = toSizeRounded(Math.min(from.y, y2) + hd);
|
|
68
|
+
var size = shape.size;
|
|
69
|
+
if (cwidth && cheight) {
|
|
70
|
+
size.set(s, s);
|
|
71
|
+
}
|
|
72
|
+
else if (cwidth) {
|
|
73
|
+
size.x = s;
|
|
74
|
+
}
|
|
75
|
+
else if (cheight) {
|
|
76
|
+
size.y = s;
|
|
77
|
+
}
|
|
78
|
+
if (cposition) {
|
|
79
|
+
position.set(x, y);
|
|
80
|
+
}
|
|
36
81
|
}
|
|
37
82
|
else {
|
|
38
83
|
var x0 = Math.min(from.x, to.x);
|
|
39
84
|
var y0 = Math.min(from.y, to.y);
|
|
40
85
|
var x1 = Math.max(from.x, to.x);
|
|
41
86
|
var y1 = Math.max(from.y, to.y);
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var px =
|
|
45
|
-
var py =
|
|
46
|
-
|
|
47
|
-
|
|
87
|
+
var dx = x1 - x0;
|
|
88
|
+
var dy = y1 - y0;
|
|
89
|
+
var px = dx * 0.5;
|
|
90
|
+
var py = dy * 0.5;
|
|
91
|
+
var w = toSizeNormalized(dx);
|
|
92
|
+
var h = toSizeNormalized(dy);
|
|
93
|
+
var x = toSizeRounded(x0 + px);
|
|
94
|
+
var y = toSizeRounded(y0 + py);
|
|
95
|
+
var size = shape.size;
|
|
96
|
+
if (cwidth && cheight) {
|
|
97
|
+
size.set(w, h);
|
|
98
|
+
}
|
|
99
|
+
else if (cwidth) {
|
|
100
|
+
size.x = w;
|
|
101
|
+
}
|
|
102
|
+
else if (cheight) {
|
|
103
|
+
size.y = h;
|
|
104
|
+
}
|
|
105
|
+
if (cposition) {
|
|
106
|
+
position.set(x, y);
|
|
107
|
+
}
|
|
48
108
|
}
|
|
49
109
|
}
|
|
50
110
|
shape.allowUploadedUpdate();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-resized.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/to-resized.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"to-resized.js","sourceRoot":"","sources":["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AAC,CAAC,CAAC;aACnB;SACD;KACD;IACD,KAAK,CAAC,mBAAmB,EAAE,CAAC;AAC7B,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IPoint } from \"pixi.js\";\nimport { EShape } from \"../e-shape\";\nimport { toSizeNormalized } from \"./to-size-normalized\";\nimport { toSizeRounded } from \"./to-size-rounded\";\nimport { EShapeCapabilities } from \"../e-shape-capabilities\";\nimport { EShapeCapability } from \"../e-shape-capability\";\n\nexport const toResized = (\n\tshape: EShape,\n\tfrom: IPoint,\n\tto: IPoint,\n\tcenterMode: boolean,\n\tisPerfect: boolean\n): void => {\n\tconst cposition = EShapeCapabilities.contains(shape, EShapeCapability.POSITION);\n\tconst cwidth = EShapeCapabilities.contains(shape, EShapeCapability.WIDTH);\n\tconst cheight = EShapeCapabilities.contains(shape, EShapeCapability.HEIGHT);\n\tshape.disallowUploadedUpdate();\n\tconst position = shape.transform.position;\n\tif (centerMode) {\n\t\tconst dx = Math.abs(to.x - from.x);\n\t\tconst dy = Math.abs(to.y - from.y);\n\t\tif (isPerfect) {\n\t\t\tconst d = Math.max(dx, dy);\n\t\t\tconst s = toSizeNormalized(d + d);\n\t\t\tconst x = toSizeRounded(from.x);\n\t\t\tconst y = toSizeRounded(from.y);\n\t\t\tconst size = shape.size;\n\t\t\tif (cwidth && cheight) {\n\t\t\t\tsize.set(s, s);\n\t\t\t} else if (cwidth) {\n\t\t\t\tsize.x = s;\n\t\t\t} else if (cheight) {\n\t\t\t\tsize.y = s;\n\t\t\t}\n\t\t\tif (cposition) {\n\t\t\t\tposition.set(x, y);\n\t\t\t}\n\t\t} else {\n\t\t\tconst w = toSizeNormalized(dx + dx);\n\t\t\tconst h = toSizeNormalized(dy + dy);\n\t\t\tconst x = toSizeRounded(from.x);\n\t\t\tconst y = toSizeRounded(from.y);\n\t\t\tconst size = shape.size;\n\t\t\tif (cwidth && cheight) {\n\t\t\t\tsize.set(w, h);\n\t\t\t} else if (cwidth) {\n\t\t\t\tsize.x = w;\n\t\t\t} else if (cheight) {\n\t\t\t\tsize.y = h;\n\t\t\t}\n\t\t\tif (cposition) {\n\t\t\t\tposition.set(x, y);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (isPerfect) {\n\t\t\tconst dx = to.x - from.x;\n\t\t\tconst dy = to.y - from.y;\n\t\t\tconst d = Math.max(Math.abs(dx), Math.abs(dy));\n\t\t\tconst x2 = from.x + (dx < 0 ? -d : +d);\n\t\t\tconst y2 = from.y + (dy < 0 ? -d : +d);\n\t\t\tconst hd = d * 0.5;\n\t\t\tconst s = toSizeNormalized(d);\n\t\t\tconst x = toSizeRounded(Math.min(from.x, x2) + hd);\n\t\t\tconst y = toSizeRounded(Math.min(from.y, y2) + hd);\n\t\t\tconst size = shape.size;\n\t\t\tif (cwidth && cheight) {\n\t\t\t\tsize.set(s, s);\n\t\t\t} else if (cwidth) {\n\t\t\t\tsize.x = s;\n\t\t\t} else if (cheight) {\n\t\t\t\tsize.y = s;\n\t\t\t}\n\t\t\tif (cposition) {\n\t\t\t\tposition.set(x, y);\n\t\t\t}\n\t\t} else {\n\t\t\tconst x0 = Math.min(from.x, to.x);\n\t\t\tconst y0 = Math.min(from.y, to.y);\n\t\t\tconst x1 = Math.max(from.x, to.x);\n\t\t\tconst y1 = Math.max(from.y, to.y);\n\t\t\tconst dx = x1 - x0;\n\t\t\tconst dy = y1 - y0;\n\t\t\tconst px = dx * 0.5;\n\t\t\tconst py = dy * 0.5;\n\t\t\tconst w = toSizeNormalized(dx);\n\t\t\tconst h = toSizeNormalized(dy);\n\t\t\tconst x = toSizeRounded(x0 + px);\n\t\t\tconst y = toSizeRounded(y0 + py);\n\t\t\tconst size = shape.size;\n\t\t\tif (cwidth && cheight) {\n\t\t\t\tsize.set(w, h);\n\t\t\t} else if (cwidth) {\n\t\t\t\tsize.x = w;\n\t\t\t} else if (cheight) {\n\t\t\t\tsize.y = h;\n\t\t\t}\n\t\t\tif (cposition) {\n\t\t\t\tposition.set(x, y);\n\t\t\t}\n\t\t}\n\t}\n\tshape.allowUploadedUpdate();\n};\n"]}
|
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.305.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -16346,7 +16346,7 @@ var EShapeTransforms = /** @class */ (function () {
|
|
|
16346
16346
|
transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
|
|
16347
16347
|
}
|
|
16348
16348
|
// Scale
|
|
16349
|
-
if (cwidth || cheight) {
|
|
16349
|
+
if (size != null && (cwidth || cheight)) {
|
|
16350
16350
|
var w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));
|
|
16351
16351
|
var h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));
|
|
16352
16352
|
var s = shape.size;
|
|
@@ -44277,46 +44277,104 @@ var toSizeRounded = function (value) {
|
|
|
44277
44277
|
* SPDX-License-Identifier: Apache-2.0
|
|
44278
44278
|
*/
|
|
44279
44279
|
var toResized = function (shape, from, to, centerMode, isPerfect) {
|
|
44280
|
+
var cposition = EShapeCapabilities.contains(shape, EShapeCapability.POSITION);
|
|
44281
|
+
var cwidth = EShapeCapabilities.contains(shape, EShapeCapability.WIDTH);
|
|
44282
|
+
var cheight = EShapeCapabilities.contains(shape, EShapeCapability.HEIGHT);
|
|
44280
44283
|
shape.disallowUploadedUpdate();
|
|
44281
44284
|
var position = shape.transform.position;
|
|
44282
44285
|
if (centerMode) {
|
|
44283
44286
|
var dx = Math.abs(to.x - from.x);
|
|
44284
44287
|
var dy = Math.abs(to.y - from.y);
|
|
44285
44288
|
if (isPerfect) {
|
|
44286
|
-
var
|
|
44287
|
-
var
|
|
44288
|
-
|
|
44289
|
-
|
|
44289
|
+
var d = Math.max(dx, dy);
|
|
44290
|
+
var s = toSizeNormalized(d + d);
|
|
44291
|
+
var x = toSizeRounded(from.x);
|
|
44292
|
+
var y = toSizeRounded(from.y);
|
|
44293
|
+
var size = shape.size;
|
|
44294
|
+
if (cwidth && cheight) {
|
|
44295
|
+
size.set(s, s);
|
|
44296
|
+
}
|
|
44297
|
+
else if (cwidth) {
|
|
44298
|
+
size.x = s;
|
|
44299
|
+
}
|
|
44300
|
+
else if (cheight) {
|
|
44301
|
+
size.y = s;
|
|
44302
|
+
}
|
|
44303
|
+
if (cposition) {
|
|
44304
|
+
position.set(x, y);
|
|
44305
|
+
}
|
|
44290
44306
|
}
|
|
44291
44307
|
else {
|
|
44292
|
-
|
|
44293
|
-
|
|
44308
|
+
var w = toSizeNormalized(dx + dx);
|
|
44309
|
+
var h = toSizeNormalized(dy + dy);
|
|
44310
|
+
var x = toSizeRounded(from.x);
|
|
44311
|
+
var y = toSizeRounded(from.y);
|
|
44312
|
+
var size = shape.size;
|
|
44313
|
+
if (cwidth && cheight) {
|
|
44314
|
+
size.set(w, h);
|
|
44315
|
+
}
|
|
44316
|
+
else if (cwidth) {
|
|
44317
|
+
size.x = w;
|
|
44318
|
+
}
|
|
44319
|
+
else if (cheight) {
|
|
44320
|
+
size.y = h;
|
|
44321
|
+
}
|
|
44322
|
+
if (cposition) {
|
|
44323
|
+
position.set(x, y);
|
|
44324
|
+
}
|
|
44294
44325
|
}
|
|
44295
44326
|
}
|
|
44296
44327
|
else {
|
|
44297
44328
|
if (isPerfect) {
|
|
44298
44329
|
var dx = to.x - from.x;
|
|
44299
44330
|
var dy = to.y - from.y;
|
|
44300
|
-
var
|
|
44301
|
-
var x2 = from.x + (dx < 0 ? -
|
|
44302
|
-
var y2 = from.y + (dy < 0 ? -
|
|
44303
|
-
var
|
|
44304
|
-
var
|
|
44305
|
-
var
|
|
44306
|
-
|
|
44307
|
-
|
|
44331
|
+
var d = Math.max(Math.abs(dx), Math.abs(dy));
|
|
44332
|
+
var x2 = from.x + (dx < 0 ? -d : +d);
|
|
44333
|
+
var y2 = from.y + (dy < 0 ? -d : +d);
|
|
44334
|
+
var hd = d * 0.5;
|
|
44335
|
+
var s = toSizeNormalized(d);
|
|
44336
|
+
var x = toSizeRounded(Math.min(from.x, x2) + hd);
|
|
44337
|
+
var y = toSizeRounded(Math.min(from.y, y2) + hd);
|
|
44338
|
+
var size = shape.size;
|
|
44339
|
+
if (cwidth && cheight) {
|
|
44340
|
+
size.set(s, s);
|
|
44341
|
+
}
|
|
44342
|
+
else if (cwidth) {
|
|
44343
|
+
size.x = s;
|
|
44344
|
+
}
|
|
44345
|
+
else if (cheight) {
|
|
44346
|
+
size.y = s;
|
|
44347
|
+
}
|
|
44348
|
+
if (cposition) {
|
|
44349
|
+
position.set(x, y);
|
|
44350
|
+
}
|
|
44308
44351
|
}
|
|
44309
44352
|
else {
|
|
44310
44353
|
var x0 = Math.min(from.x, to.x);
|
|
44311
44354
|
var y0 = Math.min(from.y, to.y);
|
|
44312
44355
|
var x1 = Math.max(from.x, to.x);
|
|
44313
44356
|
var y1 = Math.max(from.y, to.y);
|
|
44314
|
-
var
|
|
44315
|
-
var
|
|
44316
|
-
var px =
|
|
44317
|
-
var py =
|
|
44318
|
-
|
|
44319
|
-
|
|
44357
|
+
var dx = x1 - x0;
|
|
44358
|
+
var dy = y1 - y0;
|
|
44359
|
+
var px = dx * 0.5;
|
|
44360
|
+
var py = dy * 0.5;
|
|
44361
|
+
var w = toSizeNormalized(dx);
|
|
44362
|
+
var h = toSizeNormalized(dy);
|
|
44363
|
+
var x = toSizeRounded(x0 + px);
|
|
44364
|
+
var y = toSizeRounded(y0 + py);
|
|
44365
|
+
var size = shape.size;
|
|
44366
|
+
if (cwidth && cheight) {
|
|
44367
|
+
size.set(w, h);
|
|
44368
|
+
}
|
|
44369
|
+
else if (cwidth) {
|
|
44370
|
+
size.x = w;
|
|
44371
|
+
}
|
|
44372
|
+
else if (cheight) {
|
|
44373
|
+
size.y = h;
|
|
44374
|
+
}
|
|
44375
|
+
if (cposition) {
|
|
44376
|
+
position.set(x, y);
|
|
44377
|
+
}
|
|
44320
44378
|
}
|
|
44321
44379
|
}
|
|
44322
44380
|
shape.allowUploadedUpdate();
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.305.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -16343,7 +16343,7 @@
|
|
|
16343
16343
|
transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
|
|
16344
16344
|
}
|
|
16345
16345
|
// Scale
|
|
16346
|
-
if (cwidth || cheight) {
|
|
16346
|
+
if (size != null && (cwidth || cheight)) {
|
|
16347
16347
|
var w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));
|
|
16348
16348
|
var h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));
|
|
16349
16349
|
var s = shape.size;
|
|
@@ -44274,46 +44274,104 @@
|
|
|
44274
44274
|
* SPDX-License-Identifier: Apache-2.0
|
|
44275
44275
|
*/
|
|
44276
44276
|
var toResized = function (shape, from, to, centerMode, isPerfect) {
|
|
44277
|
+
var cposition = EShapeCapabilities.contains(shape, EShapeCapability.POSITION);
|
|
44278
|
+
var cwidth = EShapeCapabilities.contains(shape, EShapeCapability.WIDTH);
|
|
44279
|
+
var cheight = EShapeCapabilities.contains(shape, EShapeCapability.HEIGHT);
|
|
44277
44280
|
shape.disallowUploadedUpdate();
|
|
44278
44281
|
var position = shape.transform.position;
|
|
44279
44282
|
if (centerMode) {
|
|
44280
44283
|
var dx = Math.abs(to.x - from.x);
|
|
44281
44284
|
var dy = Math.abs(to.y - from.y);
|
|
44282
44285
|
if (isPerfect) {
|
|
44283
|
-
var
|
|
44284
|
-
var
|
|
44285
|
-
|
|
44286
|
-
|
|
44286
|
+
var d = Math.max(dx, dy);
|
|
44287
|
+
var s = toSizeNormalized(d + d);
|
|
44288
|
+
var x = toSizeRounded(from.x);
|
|
44289
|
+
var y = toSizeRounded(from.y);
|
|
44290
|
+
var size = shape.size;
|
|
44291
|
+
if (cwidth && cheight) {
|
|
44292
|
+
size.set(s, s);
|
|
44293
|
+
}
|
|
44294
|
+
else if (cwidth) {
|
|
44295
|
+
size.x = s;
|
|
44296
|
+
}
|
|
44297
|
+
else if (cheight) {
|
|
44298
|
+
size.y = s;
|
|
44299
|
+
}
|
|
44300
|
+
if (cposition) {
|
|
44301
|
+
position.set(x, y);
|
|
44302
|
+
}
|
|
44287
44303
|
}
|
|
44288
44304
|
else {
|
|
44289
|
-
|
|
44290
|
-
|
|
44305
|
+
var w = toSizeNormalized(dx + dx);
|
|
44306
|
+
var h = toSizeNormalized(dy + dy);
|
|
44307
|
+
var x = toSizeRounded(from.x);
|
|
44308
|
+
var y = toSizeRounded(from.y);
|
|
44309
|
+
var size = shape.size;
|
|
44310
|
+
if (cwidth && cheight) {
|
|
44311
|
+
size.set(w, h);
|
|
44312
|
+
}
|
|
44313
|
+
else if (cwidth) {
|
|
44314
|
+
size.x = w;
|
|
44315
|
+
}
|
|
44316
|
+
else if (cheight) {
|
|
44317
|
+
size.y = h;
|
|
44318
|
+
}
|
|
44319
|
+
if (cposition) {
|
|
44320
|
+
position.set(x, y);
|
|
44321
|
+
}
|
|
44291
44322
|
}
|
|
44292
44323
|
}
|
|
44293
44324
|
else {
|
|
44294
44325
|
if (isPerfect) {
|
|
44295
44326
|
var dx = to.x - from.x;
|
|
44296
44327
|
var dy = to.y - from.y;
|
|
44297
|
-
var
|
|
44298
|
-
var x2 = from.x + (dx < 0 ? -
|
|
44299
|
-
var y2 = from.y + (dy < 0 ? -
|
|
44300
|
-
var
|
|
44301
|
-
var
|
|
44302
|
-
var
|
|
44303
|
-
|
|
44304
|
-
|
|
44328
|
+
var d = Math.max(Math.abs(dx), Math.abs(dy));
|
|
44329
|
+
var x2 = from.x + (dx < 0 ? -d : +d);
|
|
44330
|
+
var y2 = from.y + (dy < 0 ? -d : +d);
|
|
44331
|
+
var hd = d * 0.5;
|
|
44332
|
+
var s = toSizeNormalized(d);
|
|
44333
|
+
var x = toSizeRounded(Math.min(from.x, x2) + hd);
|
|
44334
|
+
var y = toSizeRounded(Math.min(from.y, y2) + hd);
|
|
44335
|
+
var size = shape.size;
|
|
44336
|
+
if (cwidth && cheight) {
|
|
44337
|
+
size.set(s, s);
|
|
44338
|
+
}
|
|
44339
|
+
else if (cwidth) {
|
|
44340
|
+
size.x = s;
|
|
44341
|
+
}
|
|
44342
|
+
else if (cheight) {
|
|
44343
|
+
size.y = s;
|
|
44344
|
+
}
|
|
44345
|
+
if (cposition) {
|
|
44346
|
+
position.set(x, y);
|
|
44347
|
+
}
|
|
44305
44348
|
}
|
|
44306
44349
|
else {
|
|
44307
44350
|
var x0 = Math.min(from.x, to.x);
|
|
44308
44351
|
var y0 = Math.min(from.y, to.y);
|
|
44309
44352
|
var x1 = Math.max(from.x, to.x);
|
|
44310
44353
|
var y1 = Math.max(from.y, to.y);
|
|
44311
|
-
var
|
|
44312
|
-
var
|
|
44313
|
-
var px =
|
|
44314
|
-
var py =
|
|
44315
|
-
|
|
44316
|
-
|
|
44354
|
+
var dx = x1 - x0;
|
|
44355
|
+
var dy = y1 - y0;
|
|
44356
|
+
var px = dx * 0.5;
|
|
44357
|
+
var py = dy * 0.5;
|
|
44358
|
+
var w = toSizeNormalized(dx);
|
|
44359
|
+
var h = toSizeNormalized(dy);
|
|
44360
|
+
var x = toSizeRounded(x0 + px);
|
|
44361
|
+
var y = toSizeRounded(y0 + py);
|
|
44362
|
+
var size = shape.size;
|
|
44363
|
+
if (cwidth && cheight) {
|
|
44364
|
+
size.set(w, h);
|
|
44365
|
+
}
|
|
44366
|
+
else if (cwidth) {
|
|
44367
|
+
size.x = w;
|
|
44368
|
+
}
|
|
44369
|
+
else if (cheight) {
|
|
44370
|
+
size.y = h;
|
|
44371
|
+
}
|
|
44372
|
+
if (cposition) {
|
|
44373
|
+
position.set(x, y);
|
|
44374
|
+
}
|
|
44317
44375
|
}
|
|
44318
44376
|
}
|
|
44319
44377
|
shape.allowUploadedUpdate();
|