@wcardinal/wcardinal-ui 0.302.0 → 0.304.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.
@@ -1,8 +1,9 @@
1
- import { Matrix } from "pixi.js";
1
+ import { IPoint, Matrix } from "pixi.js";
2
2
  import { EShape } from "./e-shape";
3
+ import { EShapeCapability } from "./e-shape-capability";
3
4
  export declare class EShapeTransforms {
4
5
  static prepare(shape: EShape): void;
5
6
  static finalize(shape: EShape): void;
6
- static apply(shape: EShape, transform: Matrix, keepSize: boolean): void;
7
- static applyLocal(shape: EShape, localTransform: Matrix, bx?: number, by?: number): void;
7
+ static apply(shape: EShape, transform: Matrix, capability: EShapeCapability): void;
8
+ static applyLocal(shape: EShape, localTransform: Matrix, capability: EShapeCapability, size?: IPoint): void;
8
9
  }
@@ -5,6 +5,7 @@
5
5
  import { EShapeEditor } from "./e-shape-editor";
6
6
  import { EShapeBase } from "./variant/e-shape-base";
7
7
  import { toSizeNormalized } from "./variant/to-size-normalized";
8
+ import { EShapeCapability } from "./e-shape-capability";
8
9
  var EShapeTransforms = /** @class */ (function () {
9
10
  function EShapeTransforms() {
10
11
  }
@@ -33,7 +34,7 @@ var EShapeTransforms = /** @class */ (function () {
33
34
  EShapeTransforms.finalize = function (shape) {
34
35
  shape.allowOnTransformChange(true);
35
36
  };
36
- EShapeTransforms.apply = function (shape, transform, keepSize) {
37
+ EShapeTransforms.apply = function (shape, transform, capability) {
37
38
  var editor = shape.editor;
38
39
  if (editor != null) {
39
40
  var newLocalTransform = editor.localTransform;
@@ -41,16 +42,10 @@ var EShapeTransforms = /** @class */ (function () {
41
42
  .copyTo(newLocalTransform)
42
43
  .append(transform)
43
44
  .append(editor.internalTransform);
44
- if (keepSize) {
45
- this.applyLocal(shape, newLocalTransform);
46
- }
47
- else {
48
- var size = editor.size;
49
- this.applyLocal(shape, newLocalTransform, size.x, size.y);
50
- }
45
+ this.applyLocal(shape, newLocalTransform, capability, editor.size);
51
46
  }
52
47
  };
53
- EShapeTransforms.applyLocal = function (shape, localTransform, bx, by) {
48
+ EShapeTransforms.applyLocal = function (shape, localTransform, capability, size) {
54
49
  shape.disallowUploadedUpdate();
55
50
  // Reconstruct the position, the rotation and the size
56
51
  var a = localTransform.a;
@@ -59,30 +54,56 @@ var EShapeTransforms = /** @class */ (function () {
59
54
  var d = localTransform.d;
60
55
  var tx = localTransform.tx;
61
56
  var ty = localTransform.ty;
62
- // Rotation
57
+ // Transform
63
58
  var transform = shape.transform;
64
- var rx = Math.atan2(-c, d); // rotation - skewX
65
- var ry = Math.atan2(+b, a); // rotation + skewY
66
- transform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`
67
- // Skew
68
- var skew = (ry - rx) * 0.5;
69
- transform.skew.set(skew, skew);
70
- // Position: Assumes the pivot is invariant.
71
- // tx = position.x - (a * px + c * py)
72
- // ty = position.y - (b * px + d * py)
73
- //
74
- // Thus,
75
- // position.x = tx + (a * px + c * py)
76
- // position.y = ty + (b * px + d * py)
77
- var pivot = transform.pivot;
78
- var px = pivot.x;
79
- var py = pivot.y;
80
- transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
59
+ // Capability
60
+ var cposition = !!(capability & EShapeCapability.POSITION);
61
+ var crotation = !!(capability & EShapeCapability.ROTATION);
62
+ var cskew = !!(capability & EShapeCapability.SKEW);
63
+ var cwidth = !!(capability & EShapeCapability.WIDTH);
64
+ var cheight = !!(capability & EShapeCapability.HEIGHT);
65
+ // Rotation and skew
66
+ if (crotation || cskew) {
67
+ // Rotation
68
+ var rx = Math.atan2(-c, d); // rotation - skewX
69
+ var ry = Math.atan2(+b, a); // rotation + skewY
70
+ if (crotation) {
71
+ transform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`
72
+ }
73
+ // Skew
74
+ if (cskew) {
75
+ var skew = (ry - rx) * 0.5;
76
+ transform.skew.set(skew, skew);
77
+ }
78
+ }
79
+ // Position
80
+ if (cposition) {
81
+ // Assumes the pivot is invariant.
82
+ // tx = position.x - (a * px + c * py)
83
+ // ty = position.y - (b * px + d * py)
84
+ //
85
+ // Thus,
86
+ // position.x = tx + (a * px + c * py)
87
+ // position.y = ty + (b * px + d * py)
88
+ var pivot = transform.pivot;
89
+ var px = pivot.x;
90
+ var py = pivot.y;
91
+ transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
92
+ }
81
93
  // Scale
82
- if (bx != null && by != null) {
83
- var sx = Math.sqrt(a * a + b * b);
84
- var sy = Math.sqrt(c * c + d * d);
85
- shape.size.set(toSizeNormalized(bx * sx), toSizeNormalized(by * sy));
94
+ if (size != null && (cwidth || cheight)) {
95
+ var w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));
96
+ var h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));
97
+ var s = shape.size;
98
+ if (cwidth && cheight) {
99
+ s.set(w, h);
100
+ }
101
+ else if (cwidth) {
102
+ s.x = w;
103
+ }
104
+ else {
105
+ s.y = h;
106
+ }
86
107
  }
87
108
  //
88
109
  shape.allowUploadedUpdate();
@@ -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;AAEhE;IAAA;IA2FA,CAAC;IA1FO,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;QAC5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EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAEvE,QAAQ;QACR,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE;YAC7B,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACpC,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACrE;QAED,EAAE;QACF,KAAK,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IACF,uBAAC;AAAD,CAAC,AA3FD,IA2FC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { 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\";\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, keepSize: boolean): 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\tif (keepSize) {\n\t\t\t\tthis.applyLocal(shape, newLocalTransform);\n\t\t\t} else {\n\t\t\t\tconst size = editor.size;\n\t\t\t\tthis.applyLocal(shape, newLocalTransform, size.x, size.y);\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic applyLocal(shape: EShape, localTransform: Matrix, bx?: number, by?: number): 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// Rotation\n\t\tconst transform = shape.transform;\n\t\tconst rx = Math.atan2(-c, d); // rotation - skewX\n\t\tconst ry = Math.atan2(+b, a); // rotation + skewY\n\t\ttransform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`\n\n\t\t// Skew\n\t\tconst skew = (ry - rx) * 0.5;\n\t\ttransform.skew.set(skew, skew);\n\n\t\t// Position: Assumes the pivot is invariant.\n\t\t// tx = position.x - (a * px + c * py)\n\t\t// ty = position.y - (b * px + d * py)\n\t\t//\n\t\t// Thus,\n\t\t// position.x = tx + (a * px + c * py)\n\t\t// position.y = ty + (b * px + d * py)\n\t\tconst pivot = transform.pivot;\n\t\tconst px = pivot.x;\n\t\tconst py = pivot.y;\n\t\ttransform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));\n\n\t\t// Scale\n\t\tif (bx != null && by != null) {\n\t\t\tconst sx = Math.sqrt(a * a + b * b);\n\t\t\tconst sy = Math.sqrt(c * c + d * d);\n\t\t\tshape.size.set(toSizeNormalized(bx * sx), toSizeNormalized(by * sy));\n\t\t}\n\n\t\t//\n\t\tshape.allowUploadedUpdate();\n\t}\n}\n"]}
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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IAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;YACnB,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;SACvE;QAED,QAAQ;QACR,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,EAAE;YACxC,IAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC9D,IAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC9D,IAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;YACrB,IAAI,MAAM,IAAI,OAAO,EAAE;gBACtB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACZ;iBAAM,IAAI,MAAM,EAAE;gBAClB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;aACR;iBAAM;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"]}
@@ -52,7 +52,7 @@ var EShapeGroupSizeLayout = /** @class */ (function () {
52
52
  .scale(sx, sy)
53
53
  .translate(+pivotX, +pivotY);
54
54
  shape.disallowOnTransformChange();
55
- EShapeTransforms.applyLocal(shape, transform, childBase.x, childBase.y);
55
+ EShapeTransforms.applyLocal(shape, transform, EShapeCapability.ALL, childBase);
56
56
  shape.allowOnTransformChange(false);
57
57
  };
58
58
  EShapeGroupSizeLayout.WORK_TRANSFORM = new Matrix();
@@ -1 +1 @@
1
- {"version":3,"file":"e-shape-group-size-layout.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-group-size-layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;IAUC,+BAAY,KAAa,EAAE,EAAU,EAAE,EAAU;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,kBAAkB;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAE9B,kBAAkB;QAClB,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAE3C,YAAY;QACZ,IAAI,CAAC,SAAS,GAAG,IAAI,MAAM,EAAE,CAAC;QAC9B,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO;YACX,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC;gBAC7D,kBAAkB,CAAC,QAAQ,C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tB,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC;aAC3B,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC;aACb,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;QAC9B,KAAK,CAAC,yBAAyB,EAAE,CAAC;QAClC,gBAAgB,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;QACxE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAjEgB,oCAAc,GAAW,IAAI,MAAM,EAAE,CAAC;IAkExD,4BAAC;CAAA,AAnED,IAmEC;SAnEY,qBAAqB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Matrix, Point } from \"pixi.js\";\nimport { EShape } from \"../e-shape\";\nimport { EShapeCapabilities } from \"../e-shape-capabilities\";\nimport { EShapeCapability } from \"../e-shape-capability\";\nimport { EShapeLayout } from \"../e-shape-layout\";\nimport { EShapeTransforms } from \"../e-shape-transforms\";\n\nexport class EShapeGroupSizeLayout implements EShapeLayout {\n\tprotected static WORK_TRANSFORM: Matrix = new Matrix();\n\n\tprotected shape: EShape;\n\tprotected base: Point;\n\tprotected shapeBase: Point;\n\tprotected transform: Matrix;\n\n\tprotected capable: boolean;\n\n\tconstructor(shape: EShape, bx: number, by: number) {\n\t\tthis.shape = shape;\n\n\t\t// Base group size\n\t\tthis.base = new Point(bx, by);\n\n\t\t// Base shape size\n\t\tconst size = shape.size;\n\t\tthis.shapeBase = new Point(size.x, size.y);\n\n\t\t// Transform\n\t\tthis.transform = new Matrix();\n\t\tshape.updateTransform();\n\t\tshape.transform.localTransform.copyTo(this.transform);\n\n\t\tthis.capable =\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.POSITION) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.WIDTH) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.HEIGHT) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.ROTATION) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.SKEW);\n\t}\n\n\tisCompatible(shape: EShape): boolean {\n\t\treturn this.shape === shape;\n\t}\n\n\treset(shape: EShape, baseX: number, baseY: number): void {\n\t\tthis.base.set(baseX, baseY);\n\n\t\t// Base shape size\n\t\tconst size = shape.size;\n\t\tthis.shapeBase.copyFrom(size);\n\n\t\t// Transform\n\t\tshape.updateTransform();\n\t\tshape.transform.localTransform.copyTo(this.transform);\n\t}\n\n\tupdate(shape: EShape, baseX: number, baseY: number, pivotX: number, pivotY: number): void {\n\t\tif (!this.capable) {\n\t\t\treturn;\n\t\t}\n\t\tconst sx = baseX / this.base.x;\n\t\tconst sy = baseY / this.base.y;\n\t\tconst childBase = this.shapeBase;\n\t\tconst transform = EShapeGroupSizeLayout.WORK_TRANSFORM;\n\t\ttransform\n\t\t\t.identity()\n\t\t\t.append(this.transform)\n\t\t\t.translate(-pivotX, -pivotY)\n\t\t\t.scale(sx, sy)\n\t\t\t.translate(+pivotX, +pivotY);\n\t\tshape.disallowOnTransformChange();\n\t\tEShapeTransforms.applyLocal(shape, transform, childBase.x, childBase.y);\n\t\tshape.allowOnTransformChange(false);\n\t}\n}\n"]}
1
+ {"version":3,"file":"e-shape-group-size-layout.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-group-size-layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;IAUC,+BAAY,KAAa,EAA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S,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE9B,YAAY;QACZ,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,sCAAM,GAAN,UAAO,KAAa,EAAE,KAAa,EAAE,KAAa,EAAE,MAAc,EAAE,MAAc;QACjF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YAClB,OAAO;SACP;QACD,IAAM,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,IAAM,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,IAAM,SAAS,GAAG,qBAAqB,CAAC,cAAc,CAAC;QACvD,SAAS;aACP,QAAQ,EAAE;aACV,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;aACtB,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC;aAC3B,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC;aACb,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;QAC9B,KAAK,CAAC,yBAAyB,EAAE,CAAC;QAClC,gBAAgB,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC/E,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAjEgB,oCAAc,GAAW,IAAI,MAAM,EAAE,CAAC;IAkExD,4BAAC;CAAA,AAnED,IAmEC;SAnEY,qBAAqB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Matrix, Point } from \"pixi.js\";\nimport { EShape } from \"../e-shape\";\nimport { EShapeCapabilities } from \"../e-shape-capabilities\";\nimport { EShapeCapability } from \"../e-shape-capability\";\nimport { EShapeLayout } from \"../e-shape-layout\";\nimport { EShapeTransforms } from \"../e-shape-transforms\";\n\nexport class EShapeGroupSizeLayout implements EShapeLayout {\n\tprotected static WORK_TRANSFORM: Matrix = new Matrix();\n\n\tprotected shape: EShape;\n\tprotected base: Point;\n\tprotected shapeBase: Point;\n\tprotected transform: Matrix;\n\n\tprotected capable: boolean;\n\n\tconstructor(shape: EShape, bx: number, by: number) {\n\t\tthis.shape = shape;\n\n\t\t// Base group size\n\t\tthis.base = new Point(bx, by);\n\n\t\t// Base shape size\n\t\tconst size = shape.size;\n\t\tthis.shapeBase = new Point(size.x, size.y);\n\n\t\t// Transform\n\t\tthis.transform = new Matrix();\n\t\tshape.updateTransform();\n\t\tshape.transform.localTransform.copyTo(this.transform);\n\n\t\tthis.capable =\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.POSITION) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.WIDTH) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.HEIGHT) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.ROTATION) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.SKEW);\n\t}\n\n\tisCompatible(shape: EShape): boolean {\n\t\treturn this.shape === shape;\n\t}\n\n\treset(shape: EShape, baseX: number, baseY: number): void {\n\t\tthis.base.set(baseX, baseY);\n\n\t\t// Base shape size\n\t\tconst size = shape.size;\n\t\tthis.shapeBase.copyFrom(size);\n\n\t\t// Transform\n\t\tshape.updateTransform();\n\t\tshape.transform.localTransform.copyTo(this.transform);\n\t}\n\n\tupdate(shape: EShape, baseX: number, baseY: number, pivotX: number, pivotY: number): void {\n\t\tif (!this.capable) {\n\t\t\treturn;\n\t\t}\n\t\tconst sx = baseX / this.base.x;\n\t\tconst sy = baseY / this.base.y;\n\t\tconst childBase = this.shapeBase;\n\t\tconst transform = EShapeGroupSizeLayout.WORK_TRANSFORM;\n\t\ttransform\n\t\t\t.identity()\n\t\t\t.append(this.transform)\n\t\t\t.translate(-pivotX, -pivotY)\n\t\t\t.scale(sx, sy)\n\t\t\t.translate(+pivotX, +pivotY);\n\t\tshape.disallowOnTransformChange();\n\t\tEShapeTransforms.applyLocal(shape, transform, EShapeCapability.ALL, childBase);\n\t\tshape.allowOnTransformChange(false);\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.302.0
2
+ Winter Cardinal UI v0.304.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.302.0
2
+ Winter Cardinal UI v0.304.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.302.0
2
+ Winter Cardinal UI v0.304.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.302.0
2
+ Winter Cardinal UI v0.304.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.302.0
2
+ Winter Cardinal UI v0.304.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -16289,7 +16289,7 @@ var EShapeTransforms = /** @class */ (function () {
16289
16289
  EShapeTransforms.finalize = function (shape) {
16290
16290
  shape.allowOnTransformChange(true);
16291
16291
  };
16292
- EShapeTransforms.apply = function (shape, transform, keepSize) {
16292
+ EShapeTransforms.apply = function (shape, transform, capability) {
16293
16293
  var editor = shape.editor;
16294
16294
  if (editor != null) {
16295
16295
  var newLocalTransform = editor.localTransform;
@@ -16297,16 +16297,10 @@ var EShapeTransforms = /** @class */ (function () {
16297
16297
  .copyTo(newLocalTransform)
16298
16298
  .append(transform)
16299
16299
  .append(editor.internalTransform);
16300
- if (keepSize) {
16301
- this.applyLocal(shape, newLocalTransform);
16302
- }
16303
- else {
16304
- var size = editor.size;
16305
- this.applyLocal(shape, newLocalTransform, size.x, size.y);
16306
- }
16300
+ this.applyLocal(shape, newLocalTransform, capability, editor.size);
16307
16301
  }
16308
16302
  };
16309
- EShapeTransforms.applyLocal = function (shape, localTransform, bx, by) {
16303
+ EShapeTransforms.applyLocal = function (shape, localTransform, capability, size) {
16310
16304
  shape.disallowUploadedUpdate();
16311
16305
  // Reconstruct the position, the rotation and the size
16312
16306
  var a = localTransform.a;
@@ -16315,30 +16309,56 @@ var EShapeTransforms = /** @class */ (function () {
16315
16309
  var d = localTransform.d;
16316
16310
  var tx = localTransform.tx;
16317
16311
  var ty = localTransform.ty;
16318
- // Rotation
16312
+ // Transform
16319
16313
  var transform = shape.transform;
16320
- var rx = Math.atan2(-c, d); // rotation - skewX
16321
- var ry = Math.atan2(+b, a); // rotation + skewY
16322
- transform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`
16323
- // Skew
16324
- var skew = (ry - rx) * 0.5;
16325
- transform.skew.set(skew, skew);
16326
- // Position: Assumes the pivot is invariant.
16327
- // tx = position.x - (a * px + c * py)
16328
- // ty = position.y - (b * px + d * py)
16329
- //
16330
- // Thus,
16331
- // position.x = tx + (a * px + c * py)
16332
- // position.y = ty + (b * px + d * py)
16333
- var pivot = transform.pivot;
16334
- var px = pivot.x;
16335
- var py = pivot.y;
16336
- transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
16314
+ // Capability
16315
+ var cposition = !!(capability & EShapeCapability.POSITION);
16316
+ var crotation = !!(capability & EShapeCapability.ROTATION);
16317
+ var cskew = !!(capability & EShapeCapability.SKEW);
16318
+ var cwidth = !!(capability & EShapeCapability.WIDTH);
16319
+ var cheight = !!(capability & EShapeCapability.HEIGHT);
16320
+ // Rotation and skew
16321
+ if (crotation || cskew) {
16322
+ // Rotation
16323
+ var rx = Math.atan2(-c, d); // rotation - skewX
16324
+ var ry = Math.atan2(+b, a); // rotation + skewY
16325
+ if (crotation) {
16326
+ transform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`
16327
+ }
16328
+ // Skew
16329
+ if (cskew) {
16330
+ var skew = (ry - rx) * 0.5;
16331
+ transform.skew.set(skew, skew);
16332
+ }
16333
+ }
16334
+ // Position
16335
+ if (cposition) {
16336
+ // Assumes the pivot is invariant.
16337
+ // tx = position.x - (a * px + c * py)
16338
+ // ty = position.y - (b * px + d * py)
16339
+ //
16340
+ // Thus,
16341
+ // position.x = tx + (a * px + c * py)
16342
+ // position.y = ty + (b * px + d * py)
16343
+ var pivot = transform.pivot;
16344
+ var px = pivot.x;
16345
+ var py = pivot.y;
16346
+ transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
16347
+ }
16337
16348
  // Scale
16338
- if (bx != null && by != null) {
16339
- var sx = Math.sqrt(a * a + b * b);
16340
- var sy = Math.sqrt(c * c + d * d);
16341
- shape.size.set(toSizeNormalized(bx * sx), toSizeNormalized(by * sy));
16349
+ if (size != null && (cwidth || cheight)) {
16350
+ var w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));
16351
+ var h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));
16352
+ var s = shape.size;
16353
+ if (cwidth && cheight) {
16354
+ s.set(w, h);
16355
+ }
16356
+ else if (cwidth) {
16357
+ s.x = w;
16358
+ }
16359
+ else {
16360
+ s.y = h;
16361
+ }
16342
16362
  }
16343
16363
  //
16344
16364
  shape.allowUploadedUpdate();
@@ -16396,7 +16416,7 @@ var EShapeGroupSizeLayout = /** @class */ (function () {
16396
16416
  .scale(sx, sy)
16397
16417
  .translate(+pivotX, +pivotY);
16398
16418
  shape.disallowOnTransformChange();
16399
- EShapeTransforms.applyLocal(shape, transform, childBase.x, childBase.y);
16419
+ EShapeTransforms.applyLocal(shape, transform, EShapeCapability.ALL, childBase);
16400
16420
  shape.allowOnTransformChange(false);
16401
16421
  };
16402
16422
  EShapeGroupSizeLayout.WORK_TRANSFORM = new pixi_js.Matrix();
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.302.0
2
+ Winter Cardinal UI v0.304.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -16286,7 +16286,7 @@
16286
16286
  EShapeTransforms.finalize = function (shape) {
16287
16287
  shape.allowOnTransformChange(true);
16288
16288
  };
16289
- EShapeTransforms.apply = function (shape, transform, keepSize) {
16289
+ EShapeTransforms.apply = function (shape, transform, capability) {
16290
16290
  var editor = shape.editor;
16291
16291
  if (editor != null) {
16292
16292
  var newLocalTransform = editor.localTransform;
@@ -16294,16 +16294,10 @@
16294
16294
  .copyTo(newLocalTransform)
16295
16295
  .append(transform)
16296
16296
  .append(editor.internalTransform);
16297
- if (keepSize) {
16298
- this.applyLocal(shape, newLocalTransform);
16299
- }
16300
- else {
16301
- var size = editor.size;
16302
- this.applyLocal(shape, newLocalTransform, size.x, size.y);
16303
- }
16297
+ this.applyLocal(shape, newLocalTransform, capability, editor.size);
16304
16298
  }
16305
16299
  };
16306
- EShapeTransforms.applyLocal = function (shape, localTransform, bx, by) {
16300
+ EShapeTransforms.applyLocal = function (shape, localTransform, capability, size) {
16307
16301
  shape.disallowUploadedUpdate();
16308
16302
  // Reconstruct the position, the rotation and the size
16309
16303
  var a = localTransform.a;
@@ -16312,30 +16306,56 @@
16312
16306
  var d = localTransform.d;
16313
16307
  var tx = localTransform.tx;
16314
16308
  var ty = localTransform.ty;
16315
- // Rotation
16309
+ // Transform
16316
16310
  var transform = shape.transform;
16317
- var rx = Math.atan2(-c, d); // rotation - skewX
16318
- var ry = Math.atan2(+b, a); // rotation + skewY
16319
- transform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`
16320
- // Skew
16321
- var skew = (ry - rx) * 0.5;
16322
- transform.skew.set(skew, skew);
16323
- // Position: Assumes the pivot is invariant.
16324
- // tx = position.x - (a * px + c * py)
16325
- // ty = position.y - (b * px + d * py)
16326
- //
16327
- // Thus,
16328
- // position.x = tx + (a * px + c * py)
16329
- // position.y = ty + (b * px + d * py)
16330
- var pivot = transform.pivot;
16331
- var px = pivot.x;
16332
- var py = pivot.y;
16333
- transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
16311
+ // Capability
16312
+ var cposition = !!(capability & EShapeCapability.POSITION);
16313
+ var crotation = !!(capability & EShapeCapability.ROTATION);
16314
+ var cskew = !!(capability & EShapeCapability.SKEW);
16315
+ var cwidth = !!(capability & EShapeCapability.WIDTH);
16316
+ var cheight = !!(capability & EShapeCapability.HEIGHT);
16317
+ // Rotation and skew
16318
+ if (crotation || cskew) {
16319
+ // Rotation
16320
+ var rx = Math.atan2(-c, d); // rotation - skewX
16321
+ var ry = Math.atan2(+b, a); // rotation + skewY
16322
+ if (crotation) {
16323
+ transform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`
16324
+ }
16325
+ // Skew
16326
+ if (cskew) {
16327
+ var skew = (ry - rx) * 0.5;
16328
+ transform.skew.set(skew, skew);
16329
+ }
16330
+ }
16331
+ // Position
16332
+ if (cposition) {
16333
+ // Assumes the pivot is invariant.
16334
+ // tx = position.x - (a * px + c * py)
16335
+ // ty = position.y - (b * px + d * py)
16336
+ //
16337
+ // Thus,
16338
+ // position.x = tx + (a * px + c * py)
16339
+ // position.y = ty + (b * px + d * py)
16340
+ var pivot = transform.pivot;
16341
+ var px = pivot.x;
16342
+ var py = pivot.y;
16343
+ transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
16344
+ }
16334
16345
  // Scale
16335
- if (bx != null && by != null) {
16336
- var sx = Math.sqrt(a * a + b * b);
16337
- var sy = Math.sqrt(c * c + d * d);
16338
- shape.size.set(toSizeNormalized(bx * sx), toSizeNormalized(by * sy));
16346
+ if (size != null && (cwidth || cheight)) {
16347
+ var w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));
16348
+ var h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));
16349
+ var s = shape.size;
16350
+ if (cwidth && cheight) {
16351
+ s.set(w, h);
16352
+ }
16353
+ else if (cwidth) {
16354
+ s.x = w;
16355
+ }
16356
+ else {
16357
+ s.y = h;
16358
+ }
16339
16359
  }
16340
16360
  //
16341
16361
  shape.allowUploadedUpdate();
@@ -16393,7 +16413,7 @@
16393
16413
  .scale(sx, sy)
16394
16414
  .translate(+pivotX, +pivotY);
16395
16415
  shape.disallowOnTransformChange();
16396
- EShapeTransforms.applyLocal(shape, transform, childBase.x, childBase.y);
16416
+ EShapeTransforms.applyLocal(shape, transform, EShapeCapability.ALL, childBase);
16397
16417
  shape.allowOnTransformChange(false);
16398
16418
  };
16399
16419
  EShapeGroupSizeLayout.WORK_TRANSFORM = new pixi_js.Matrix();