@wcardinal/wcardinal-ui 0.304.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.
@@ -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 hsize = Math.max(dx, dy);
15
- var size = hsize + hsize;
16
- shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
17
- position.set(toSizeRounded(from.x), toSizeRounded(from.y));
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
- shape.size.set(toSizeNormalized(dx + dx), toSizeNormalized(dy + dy));
21
- position.set(toSizeRounded(from.x), toSizeRounded(from.y));
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 size = Math.max(Math.abs(dx), Math.abs(dy));
29
- var x2 = from.x + (dx < 0 ? -size : +size);
30
- var y2 = from.y + (dy < 0 ? -size : +size);
31
- var hsize = size * 0.5;
32
- var x = Math.min(from.x, x2) + hsize;
33
- var y = Math.min(from.y, y2) + hsize;
34
- shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
35
- position.set(toSizeRounded(x), toSizeRounded(y));
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 width = x1 - x0;
43
- var height = y1 - y0;
44
- var px = width * 0.5;
45
- var py = height * 0.5;
46
- shape.size.set(toSizeNormalized(width), toSizeNormalized(height));
47
- position.set(toSizeRounded(x0 + px), toSizeRounded(y0 + py));
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;AAElD,MAAM,CAAC,IAAM,SAAS,GAAG,UACxB,KAAa,EACb,IAAY,EACZ,EAAU,EACV,UAAmB,EACnB,SAAkB;IAElB,KAAK,CAAC,sBAAsB,EAAE,CAAC;IAC/B,IAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;IAC1C,IAAI,UAAU,EAAE;QACf,IAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnC,IAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,SAAS,EAAE;YACd,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC/B,IAAM,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,C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\nimport { IPoint } from \"pixi.js\";\nimport { EShape } from \"../e-shape\";\nimport { toSizeNormalized } from \"./to-size-normalized\";\nimport { toSizeRounded } from \"./to-size-rounded\";\n\nexport const toResized = (\n\tshape: EShape,\n\tfrom: IPoint,\n\tto: IPoint,\n\tcenterMode: boolean,\n\tisPerfect: boolean\n): void => {\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 hsize = Math.max(dx, dy);\n\t\t\tconst size = hsize + hsize;\n\t\t\tshape.size.set(toSizeNormalized(size), toSizeNormalized(size));\n\t\t\tposition.set(toSizeRounded(from.x), toSizeRounded(from.y));\n\t\t} else {\n\t\t\tshape.size.set(toSizeNormalized(dx + dx), toSizeNormalized(dy + dy));\n\t\t\tposition.set(toSizeRounded(from.x), toSizeRounded(from.y));\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 size = Math.max(Math.abs(dx), Math.abs(dy));\n\t\t\tconst x2 = from.x + (dx < 0 ? -size : +size);\n\t\t\tconst y2 = from.y + (dy < 0 ? -size : +size);\n\t\t\tconst hsize = size * 0.5;\n\t\t\tconst x = Math.min(from.x, x2) + hsize;\n\t\t\tconst y = Math.min(from.y, y2) + hsize;\n\t\t\tshape.size.set(toSizeNormalized(size), toSizeNormalized(size));\n\t\t\tposition.set(toSizeRounded(x), toSizeRounded(y));\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 width = x1 - x0;\n\t\t\tconst height = y1 - y0;\n\t\t\tconst px = width * 0.5;\n\t\t\tconst py = height * 0.5;\n\t\t\tshape.size.set(toSizeNormalized(width), toSizeNormalized(height));\n\t\t\tposition.set(toSizeRounded(x0 + px), toSizeRounded(y0 + py));\n\t\t}\n\t}\n\tshape.allowUploadedUpdate();\n};\n"]}
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;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,CAAC,IAAM,SAAS,GAAG,UACxB,KAAa,EACb,IAAY,EACZ,EAAU,EACV,UAAmB,EACnB,SAAkB;IAElB,IAAM,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAChF,IAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC1E,IAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC5E,KAAK,CAAC,sBAAsB,EAAE,CAAC;IAC/B,IAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;IAC1C,IAAI,UAAU,EAAE;QACf,IAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnC,IAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,SAAS,EAAE;YACd,IAAM,CAAC,GAAG,IAAI,CAAC,GAAG,C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AAG,CAAC,CAAC;aACX;iBAAM,IAAI,OAAO,EAAE;gBACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;aACX;YACD,IAAI,SAAS,EAAE;gBACd,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,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"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.304.0
2
+ Winter Cardinal UI v0.305.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.304.0
2
+ Winter Cardinal UI v0.305.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.304.0
2
+ Winter Cardinal UI v0.305.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.304.0
2
+ Winter Cardinal UI v0.305.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.304.0
2
+ Winter Cardinal UI v0.305.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -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 hsize = Math.max(dx, dy);
44287
- var size = hsize + hsize;
44288
- shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
44289
- position.set(toSizeRounded(from.x), toSizeRounded(from.y));
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
- shape.size.set(toSizeNormalized(dx + dx), toSizeNormalized(dy + dy));
44293
- position.set(toSizeRounded(from.x), toSizeRounded(from.y));
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 size = Math.max(Math.abs(dx), Math.abs(dy));
44301
- var x2 = from.x + (dx < 0 ? -size : +size);
44302
- var y2 = from.y + (dy < 0 ? -size : +size);
44303
- var hsize = size * 0.5;
44304
- var x = Math.min(from.x, x2) + hsize;
44305
- var y = Math.min(from.y, y2) + hsize;
44306
- shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
44307
- position.set(toSizeRounded(x), toSizeRounded(y));
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 width = x1 - x0;
44315
- var height = y1 - y0;
44316
- var px = width * 0.5;
44317
- var py = height * 0.5;
44318
- shape.size.set(toSizeNormalized(width), toSizeNormalized(height));
44319
- position.set(toSizeRounded(x0 + px), toSizeRounded(y0 + py));
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();
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.304.0
2
+ Winter Cardinal UI v0.305.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -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 hsize = Math.max(dx, dy);
44284
- var size = hsize + hsize;
44285
- shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
44286
- position.set(toSizeRounded(from.x), toSizeRounded(from.y));
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
- shape.size.set(toSizeNormalized(dx + dx), toSizeNormalized(dy + dy));
44290
- position.set(toSizeRounded(from.x), toSizeRounded(from.y));
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 size = Math.max(Math.abs(dx), Math.abs(dy));
44298
- var x2 = from.x + (dx < 0 ? -size : +size);
44299
- var y2 = from.y + (dy < 0 ? -size : +size);
44300
- var hsize = size * 0.5;
44301
- var x = Math.min(from.x, x2) + hsize;
44302
- var y = Math.min(from.y, y2) + hsize;
44303
- shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
44304
- position.set(toSizeRounded(x), toSizeRounded(y));
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 width = x1 - x0;
44312
- var height = y1 - y0;
44313
- var px = width * 0.5;
44314
- var py = height * 0.5;
44315
- shape.size.set(toSizeNormalized(width), toSizeNormalized(height));
44316
- position.set(toSizeRounded(x0 + px), toSizeRounded(y0 + py));
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();