@wcardinal/wcardinal-ui 0.150.2 → 0.151.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.
Files changed (160) hide show
  1. package/dist/types/wcardinal/ui/shape/action/{e-shape-action-value-deserializer.d.ts → deserialize-action-value.d.ts} +1 -4
  2. package/dist/types/wcardinal/ui/shape/action/index.d.ts +1 -1
  3. package/dist/types/wcardinal/ui/shape/e-shape-deserializers.d.ts +15 -4
  4. package/dist/types/wcardinal/ui/shape/index.d.ts +0 -3
  5. package/dist/types/wcardinal/ui/shape/variant/deserialize-all.d.ts +4 -0
  6. package/dist/types/wcardinal/ui/shape/variant/deserialize-bar.d.ts +1 -1
  7. package/dist/types/wcardinal/ui/shape/variant/deserialize-base.d.ts +4 -0
  8. package/dist/types/wcardinal/ui/shape/variant/deserialize-button.d.ts +1 -1
  9. package/dist/types/wcardinal/ui/shape/variant/deserialize-circle.d.ts +1 -1
  10. package/dist/types/wcardinal/ui/shape/variant/deserialize-connector-line.d.ts +2 -2
  11. package/dist/types/wcardinal/ui/shape/variant/deserialize-gradient.d.ts +2 -0
  12. package/dist/types/wcardinal/ui/shape/variant/deserialize-group-shadowed.d.ts +1 -1
  13. package/dist/types/wcardinal/ui/shape/variant/deserialize-group.d.ts +1 -1
  14. package/dist/types/wcardinal/ui/shape/variant/deserialize-image-sdf.d.ts +1 -1
  15. package/dist/types/wcardinal/ui/shape/variant/deserialize-image.d.ts +1 -1
  16. package/dist/types/wcardinal/ui/shape/variant/deserialize-label.d.ts +1 -1
  17. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-circles.d.ts +1 -1
  18. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-rectangle-roundeds.d.ts +1 -1
  19. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-rectangles.d.ts +1 -1
  20. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-triangle-roundeds.d.ts +1 -1
  21. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-triangles.d.ts +1 -1
  22. package/dist/types/wcardinal/ui/shape/variant/deserialize-line.d.ts +1 -1
  23. package/dist/types/wcardinal/ui/shape/variant/deserialize-null.d.ts +1 -1
  24. package/dist/types/wcardinal/ui/shape/variant/deserialize-rectangle-pivoted.d.ts +1 -1
  25. package/dist/types/wcardinal/ui/shape/variant/deserialize-rectangle-rounded.d.ts +1 -1
  26. package/dist/types/wcardinal/ui/shape/variant/deserialize-rectangle.d.ts +1 -1
  27. package/dist/types/wcardinal/ui/shape/variant/deserialize-triangle-rounded.d.ts +1 -1
  28. package/dist/types/wcardinal/ui/shape/variant/deserialize-triangle.d.ts +1 -1
  29. package/dist/types/wcardinal/ui/shape/variant/deserialize.d.ts +4 -0
  30. package/dist/types/wcardinal/ui/shape/variant/e-shape-embeddeds.d.ts +1 -2
  31. package/dist/types/wcardinal/ui/shape/variant/index.d.ts +11 -2
  32. package/dist/types/wcardinal/ui/shape/variant/to-gradient-image-url.d.ts +2 -0
  33. package/dist/types/wcardinal/ui/shape/variant/to-gradient-serialized.d.ts +2 -0
  34. package/dist/types/wcardinal/ui/shape/variant/to-image-element.d.ts +1 -0
  35. package/dist/types/wcardinal/ui/shape/variant/to-resized.d.ts +3 -0
  36. package/dist/types/wcardinal/ui/shape/variant/to-size-normalized.d.ts +1 -0
  37. package/dist/types/wcardinal/ui/shape/variant/to-size-rounded.d.ts +1 -0
  38. package/dist/wcardinal/ui/d-diagrams.js +2 -2
  39. package/dist/wcardinal/ui/d-diagrams.js.map +1 -1
  40. package/dist/wcardinal/ui/shape/action/deserialize-action-value.js +109 -0
  41. package/dist/wcardinal/ui/shape/action/deserialize-action-value.js.map +1 -0
  42. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-absolute.js +2 -2
  43. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-absolute.js.map +1 -1
  44. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-relative.js +2 -2
  45. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-relative.js.map +1 -1
  46. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-absolute.js +2 -2
  47. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-absolute.js.map +1 -1
  48. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-relative.js +2 -2
  49. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-relative.js.map +1 -1
  50. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-absolute.js +2 -2
  51. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-absolute.js.map +1 -1
  52. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-relative.js +2 -2
  53. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-relative.js.map +1 -1
  54. package/dist/wcardinal/ui/shape/action/index.js +1 -1
  55. package/dist/wcardinal/ui/shape/action/index.js.map +1 -1
  56. package/dist/wcardinal/ui/shape/e-shape-deserializers.js +7 -1
  57. package/dist/wcardinal/ui/shape/e-shape-deserializers.js.map +1 -1
  58. package/dist/wcardinal/ui/shape/e-shape-transforms.js +3 -3
  59. package/dist/wcardinal/ui/shape/e-shape-transforms.js.map +1 -1
  60. package/dist/wcardinal/ui/shape/index.js +0 -3
  61. package/dist/wcardinal/ui/shape/index.js.map +1 -1
  62. package/dist/wcardinal/ui/shape/load/load-shape-connector-line.js +3 -3
  63. package/dist/wcardinal/ui/shape/load/load-shape-connector-line.js.map +1 -1
  64. package/dist/wcardinal/ui/shape/variant/create-image-sdf.js +3 -3
  65. package/dist/wcardinal/ui/shape/variant/create-image-sdf.js.map +1 -1
  66. package/dist/wcardinal/ui/shape/variant/create-image.js +2 -2
  67. package/dist/wcardinal/ui/shape/variant/create-image.js.map +1 -1
  68. package/dist/wcardinal/ui/shape/variant/deserialize-all.js +32 -0
  69. package/dist/wcardinal/ui/shape/variant/deserialize-all.js.map +1 -0
  70. package/dist/wcardinal/ui/shape/variant/deserialize-bar.js +4 -4
  71. package/dist/wcardinal/ui/shape/variant/deserialize-bar.js.map +1 -1
  72. package/dist/wcardinal/ui/shape/variant/deserialize-base.js +100 -0
  73. package/dist/wcardinal/ui/shape/variant/deserialize-base.js.map +1 -0
  74. package/dist/wcardinal/ui/shape/variant/deserialize-button.js +4 -5
  75. package/dist/wcardinal/ui/shape/variant/deserialize-button.js.map +1 -1
  76. package/dist/wcardinal/ui/shape/variant/deserialize-circle.js +3 -3
  77. package/dist/wcardinal/ui/shape/variant/deserialize-circle.js.map +1 -1
  78. package/dist/wcardinal/ui/shape/variant/deserialize-connector-line.js +4 -4
  79. package/dist/wcardinal/ui/shape/variant/deserialize-connector-line.js.map +1 -1
  80. package/dist/wcardinal/ui/shape/variant/deserialize-embedded.js +15 -2
  81. package/dist/wcardinal/ui/shape/variant/deserialize-embedded.js.map +1 -1
  82. package/dist/wcardinal/ui/shape/variant/deserialize-gradient.js +34 -0
  83. package/dist/wcardinal/ui/shape/variant/deserialize-gradient.js.map +1 -0
  84. package/dist/wcardinal/ui/shape/variant/deserialize-group-shadowed.js +4 -4
  85. package/dist/wcardinal/ui/shape/variant/deserialize-group-shadowed.js.map +1 -1
  86. package/dist/wcardinal/ui/shape/variant/deserialize-group.js +4 -4
  87. package/dist/wcardinal/ui/shape/variant/deserialize-group.js.map +1 -1
  88. package/dist/wcardinal/ui/shape/variant/deserialize-image-sdf.js +3 -3
  89. package/dist/wcardinal/ui/shape/variant/deserialize-image-sdf.js.map +1 -1
  90. package/dist/wcardinal/ui/shape/variant/deserialize-image.js +3 -3
  91. package/dist/wcardinal/ui/shape/variant/deserialize-image.js.map +1 -1
  92. package/dist/wcardinal/ui/shape/variant/deserialize-label.js +3 -3
  93. package/dist/wcardinal/ui/shape/variant/deserialize-label.js.map +1 -1
  94. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-circles.js +3 -3
  95. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-circles.js.map +1 -1
  96. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangle-roundeds.js +3 -3
  97. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangle-roundeds.js.map +1 -1
  98. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangles.js +3 -3
  99. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangles.js.map +1 -1
  100. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangle-roundeds.js +3 -3
  101. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangle-roundeds.js.map +1 -1
  102. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangles.js +3 -3
  103. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangles.js.map +1 -1
  104. package/dist/wcardinal/ui/shape/variant/deserialize-line.js +4 -4
  105. package/dist/wcardinal/ui/shape/variant/deserialize-line.js.map +1 -1
  106. package/dist/wcardinal/ui/shape/variant/deserialize-null.js +3 -3
  107. package/dist/wcardinal/ui/shape/variant/deserialize-null.js.map +1 -1
  108. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-pivoted.js +3 -3
  109. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-pivoted.js.map +1 -1
  110. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-rounded.js +3 -3
  111. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-rounded.js.map +1 -1
  112. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle.js +3 -3
  113. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle.js.map +1 -1
  114. package/dist/wcardinal/ui/shape/variant/deserialize-triangle-rounded.js +3 -3
  115. package/dist/wcardinal/ui/shape/variant/deserialize-triangle-rounded.js.map +1 -1
  116. package/dist/wcardinal/ui/shape/variant/deserialize-triangle.js +3 -3
  117. package/dist/wcardinal/ui/shape/variant/deserialize-triangle.js.map +1 -1
  118. package/dist/wcardinal/ui/shape/variant/deserialize.js +17 -0
  119. package/dist/wcardinal/ui/shape/variant/deserialize.js.map +1 -0
  120. package/dist/wcardinal/ui/shape/variant/e-shape-base.js +9 -2
  121. package/dist/wcardinal/ui/shape/variant/e-shape-base.js.map +1 -1
  122. package/dist/wcardinal/ui/shape/variant/e-shape-embeddeds.js +0 -13
  123. package/dist/wcardinal/ui/shape/variant/e-shape-embeddeds.js.map +1 -1
  124. package/dist/wcardinal/ui/shape/variant/index.js +11 -2
  125. package/dist/wcardinal/ui/shape/variant/index.js.map +1 -1
  126. package/dist/wcardinal/ui/shape/variant/to-gradient-image-url.js +35 -0
  127. package/dist/wcardinal/ui/shape/variant/to-gradient-image-url.js.map +1 -0
  128. package/dist/wcardinal/ui/shape/variant/to-gradient-serialized.js +15 -0
  129. package/dist/wcardinal/ui/shape/variant/to-gradient-serialized.js.map +1 -0
  130. package/dist/wcardinal/ui/shape/variant/to-image-element.js +32 -0
  131. package/dist/wcardinal/ui/shape/variant/to-image-element.js.map +1 -0
  132. package/dist/wcardinal/ui/shape/variant/to-resized.js +52 -0
  133. package/dist/wcardinal/ui/shape/variant/to-resized.js.map +1 -0
  134. package/dist/wcardinal/ui/shape/variant/to-size-normalized.js +12 -0
  135. package/dist/wcardinal/ui/shape/variant/to-size-normalized.js.map +1 -0
  136. package/dist/wcardinal/ui/shape/variant/to-size-rounded.js +8 -0
  137. package/dist/wcardinal/ui/shape/variant/to-size-rounded.js.map +1 -0
  138. package/dist/wcardinal-ui-theme-dark.js +1 -1
  139. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  140. package/dist/wcardinal-ui-theme-white.js +1 -1
  141. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  142. package/dist/wcardinal-ui.cjs.js +2475 -2459
  143. package/dist/wcardinal-ui.js +1910 -1894
  144. package/dist/wcardinal-ui.min.js +2 -2
  145. package/dist/wcardinal-ui.min.js.map +1 -1
  146. package/package.json +1 -1
  147. package/dist/types/wcardinal/ui/shape/e-shape-deserializer.d.ts +0 -10
  148. package/dist/types/wcardinal/ui/shape/e-shape-image-elements.d.ts +0 -6
  149. package/dist/types/wcardinal/ui/shape/e-shape-sizes.d.ts +0 -7
  150. package/dist/types/wcardinal/ui/shape/variant/e-shape-gradients.d.ts +0 -9
  151. package/dist/wcardinal/ui/shape/action/e-shape-action-value-deserializer.js +0 -115
  152. package/dist/wcardinal/ui/shape/action/e-shape-action-value-deserializer.js.map +0 -1
  153. package/dist/wcardinal/ui/shape/e-shape-deserializer.js +0 -143
  154. package/dist/wcardinal/ui/shape/e-shape-deserializer.js.map +0 -1
  155. package/dist/wcardinal/ui/shape/e-shape-image-elements.js +0 -35
  156. package/dist/wcardinal/ui/shape/e-shape-image-elements.js.map +0 -1
  157. package/dist/wcardinal/ui/shape/e-shape-sizes.js +0 -66
  158. package/dist/wcardinal/ui/shape/e-shape-sizes.js.map +0 -1
  159. package/dist/wcardinal/ui/shape/variant/e-shape-gradients.js +0 -89
  160. package/dist/wcardinal/ui/shape/variant/e-shape-gradients.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.150.2
2
+ Winter Cardinal UI v0.151.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -13,8 +13,14 @@
13
13
  * Copyright (C) 2019 Toshiba Corporation
14
14
  * SPDX-License-Identifier: Apache-2.0
15
15
  */
16
+ /**
17
+ * Mappings of shape types and deserializers.
18
+ */
16
19
  var EShapeDeserializers = {};
17
- var EShapeOnDeserialized = {};
20
+ /**
21
+ * Mappings of shape types and `onDeserialized` handlers.
22
+ */
23
+ var EShapeOnDeserializeds = {};
18
24
 
19
25
  /*
20
26
  * Copyright (C) 2019 Toshiba Corporation
@@ -3691,198 +3697,23 @@
3691
3697
  * Copyright (C) 2019 Toshiba Corporation
3692
3698
  * SPDX-License-Identifier: Apache-2.0
3693
3699
  */
3694
- var toSvgUrl = function (svg) {
3695
- return "data:image/svg+xml;base64," + btoa(svg);
3696
- };
3697
-
3698
- /*
3699
- * Copyright (C) 2019 Toshiba Corporation
3700
- * SPDX-License-Identifier: Apache-2.0
3701
- */
3702
- var toPadded = function (str, length, c) {
3703
- var strLength = str.length;
3704
- if (length < strLength) {
3705
- return str;
3706
- }
3707
- var padding = "";
3708
- for (var i = 0, imax = length - strLength; i < imax; ++i) {
3709
- padding += c;
3710
- }
3711
- return padding + str;
3700
+ var hitTestBBox = function (x, y, ax, ay) {
3701
+ return -ax <= x && x <= +ax && -ay <= y && y <= +ay;
3712
3702
  };
3713
3703
 
3714
3704
  /*
3715
3705
  * Copyright (C) 2019 Toshiba Corporation
3716
3706
  * SPDX-License-Identifier: Apache-2.0
3717
3707
  */
3718
- var UtilRgb = /** @class */ (function () {
3719
- function UtilRgb() {
3720
- }
3721
- UtilRgb.toCode = function (color) {
3722
- return toPadded(color.toString(16).toUpperCase(), 6, "0");
3723
- };
3724
- UtilRgb.fromCode = function (code) {
3725
- var trimmed = code.trim().toLowerCase();
3726
- if (trimmed.length === 6) {
3727
- var color = Number("0x" + trimmed);
3728
- if (color === color) {
3729
- return color;
3730
- }
3731
- }
3732
- return null;
3733
- };
3734
- UtilRgb.fromRgb = function (r, g, b) {
3735
- return ((r * 0xff) << 16) | ((g * 0xff) << 8) | ((b * 0xff) | 0);
3736
- };
3737
- UtilRgb.blend = function (colorA, colorB, t) {
3738
- var ar = (colorA >> 16) & 0xff;
3739
- var ag = (colorA >> 8) & 0xff;
3740
- var ab = (colorA | 0) & 0xff;
3741
- var br = (colorB >> 16) & 0xff;
3742
- var bg = (colorB >> 8) & 0xff;
3743
- var bb = (colorB | 0) & 0xff;
3744
- var w1 = Math.max(0, Math.min(1, t));
3745
- var w0 = 1 - w1;
3746
- var cr = Math.max(0, Math.min(0xff, ar * w0 + br * w1));
3747
- var cg = Math.max(0, Math.min(0xff, ag * w0 + bg * w1));
3748
- var cb = Math.max(0, Math.min(0xff, ab * w0 + bb * w1));
3749
- return (cr << 16) | (cg << 8) | (cb | 0);
3750
- };
3751
- UtilRgb.brighten = function (color, amount) {
3752
- if (0 <= amount) {
3753
- return this.blend(color, 0xffffff, amount);
3754
- }
3755
- else {
3756
- return this.blend(color, 0x000000, -amount);
3757
- }
3758
- };
3759
- UtilRgb.darken = function (color, amount) {
3760
- if (0 <= amount) {
3761
- return this.blend(color, 0x000000, amount);
3762
- }
3763
- else {
3764
- return this.blend(color, 0xffffff, -amount);
3765
- }
3766
- };
3767
- /**
3768
- * Convertes the given color to a grayscale color.
3769
- *
3770
- * @param color a color to be converted
3771
- * @returns a grayscale color
3772
- * @see https://en.wikipedia.org/wiki/Grayscale
3773
- */
3774
- UtilRgb.toGrayscale = function (color) {
3775
- var l = this.toLuma(color);
3776
- return (l << 16) | (l << 8) | l;
3777
- };
3778
- /**
3779
- * Convertes the given color to a luma in the range [0, 255].
3780
- *
3781
- * @param color a color to be converted
3782
- * @returns a luma in the range [0, 255]
3783
- * @see https://en.wikipedia.org/wiki/Grayscale
3784
- */
3785
- UtilRgb.toLuma = function (color) {
3786
- var r = (color >> 16) & 0xff;
3787
- var g = (color >> 8) & 0xff;
3788
- var b = (color | 0) & 0xff;
3789
- return (0.2126 * r + 0.7152 * g + 0.0722 * b) & 0xff;
3790
- };
3791
- return UtilRgb;
3792
- }());
3793
-
3794
- /*
3795
- * Copyright (C) 2019 Toshiba Corporation
3796
- * SPDX-License-Identifier: Apache-2.0
3797
- */
3798
- var EShapeGradients = /** @class */ (function () {
3799
- function EShapeGradients() {
3708
+ var toGradientSerialized = function (gradient) {
3709
+ var points = gradient.points;
3710
+ var result = "[" + gradient.direction;
3711
+ for (var i = 0, imax = points.length, j = 1; i < imax; i += 1, j += 3) {
3712
+ var point = points[i];
3713
+ result += "," + point.color + "," + point.alpha + "," + point.position;
3800
3714
  }
3801
- EShapeGradients.serializeGradient = function (gradient) {
3802
- var points = gradient.points;
3803
- var result = "[" + gradient.direction;
3804
- for (var i = 0, imax = points.length, j = 1; i < imax; i += 1, j += 3) {
3805
- var point = points[i];
3806
- result += "," + point.color + "," + point.alpha + "," + point.position;
3807
- }
3808
- result += "]";
3809
- return result;
3810
- };
3811
- EShapeGradients.parseGradient = function (target) {
3812
- try {
3813
- return JSON.parse(target);
3814
- }
3815
- catch (e) {
3816
- return null;
3817
- }
3818
- };
3819
- EShapeGradients.deserializeGradient = function (target) {
3820
- var parsed = this.parseGradient(target);
3821
- if (parsed == null || parsed.length < 7) {
3822
- return undefined;
3823
- }
3824
- else {
3825
- var direction = parsed[0];
3826
- var points = [];
3827
- for (var i = 1, imax = parsed.length; i < imax; i += 3) {
3828
- points.push({
3829
- color: parsed[i + 0],
3830
- alpha: parsed[i + 1],
3831
- position: parsed[i + 2]
3832
- });
3833
- }
3834
- return {
3835
- points: points,
3836
- direction: direction
3837
- };
3838
- }
3839
- };
3840
- EShapeGradients.toGradientId = function (gradient, manager) {
3841
- if (gradient != null) {
3842
- if (gradient.serialized == null) {
3843
- gradient.serialized = this.serializeGradient(gradient);
3844
- }
3845
- return manager.addResource(gradient.serialized);
3846
- }
3847
- return -1;
3848
- };
3849
- EShapeGradients.toGradientImageUrl = function (gradient) {
3850
- var direction = gradient.direction;
3851
- var points = gradient.points;
3852
- var stops = "";
3853
- for (var i = 0, imax = points.length; i < imax; ++i) {
3854
- var point = points[i];
3855
- var color = UtilRgb.toCode(point.color);
3856
- var alpha = point.alpha;
3857
- var offset = point.position * 100;
3858
- stops += "<stop offset=\"" + offset + "%\" stop-color=\"#" + color + "\" stop-opacity=\"" + alpha + "\" />";
3859
- }
3860
- var radian = (direction * Math.PI) / 180;
3861
- var dx = 0.5 * Math.cos(radian);
3862
- var dy = -0.5 * Math.sin(radian);
3863
- var url = toSvgUrl(
3864
- /* eslint-disable prettier/prettier */
3865
- "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 32 32\">" +
3866
- "<defs>" +
3867
- ("<linearGradient id=\"o2glkm3aeu2oio\" x1=\"" + (0.5 - dx) + "\" x2=\"" + (0.5 + dx) + "\" y1=\"" + (0.5 - dy) + "\" y2=\"" + (0.5 + dy) + "\">") +
3868
- stops +
3869
- "</linearGradient>" +
3870
- "</defs>" +
3871
- "<rect x=\"0\" y=\"0\" width=\"32\" height=\"32\" stroke=\"none\" fill=\"url(#o2glkm3aeu2oio)\" />" +
3872
- "</svg>"
3873
- /* eslint-enable prettier/prettier */
3874
- );
3875
- return url;
3876
- };
3877
- return EShapeGradients;
3878
- }());
3879
-
3880
- /*
3881
- * Copyright (C) 2019 Toshiba Corporation
3882
- * SPDX-License-Identifier: Apache-2.0
3883
- */
3884
- var hitTestBBox = function (x, y, ax, ay) {
3885
- return -ax <= x && x <= +ax && -ay <= y && y <= +ay;
3715
+ result += "]";
3716
+ return result;
3886
3717
  };
3887
3718
 
3888
3719
  /*
@@ -4178,7 +4009,14 @@
4178
4009
  return image != null ? manager.addResource(image.src) : -1;
4179
4010
  };
4180
4011
  EShapeBase.prototype.serializeGradient = function (manager) {
4181
- return EShapeGradients.toGradientId(this.gradient, manager);
4012
+ var gradient = this.gradient;
4013
+ if (gradient != null) {
4014
+ if (gradient.serialized == null) {
4015
+ gradient.serialized = toGradientSerialized(gradient);
4016
+ }
4017
+ return manager.addResource(gradient.serialized);
4018
+ }
4019
+ return -1;
4182
4020
  };
4183
4021
  EShapeBase.prototype.serializeState = function (manager) {
4184
4022
  var state = this.state;
@@ -7108,6 +6946,102 @@
7108
6946
  return (typeof target === "number" || Object.prototype.toString.call(target) === "[object Number]");
7109
6947
  };
7110
6948
 
6949
+ /*
6950
+ * Copyright (C) 2019 Toshiba Corporation
6951
+ * SPDX-License-Identifier: Apache-2.0
6952
+ */
6953
+ var toPadded = function (str, length, c) {
6954
+ var strLength = str.length;
6955
+ if (length < strLength) {
6956
+ return str;
6957
+ }
6958
+ var padding = "";
6959
+ for (var i = 0, imax = length - strLength; i < imax; ++i) {
6960
+ padding += c;
6961
+ }
6962
+ return padding + str;
6963
+ };
6964
+
6965
+ /*
6966
+ * Copyright (C) 2019 Toshiba Corporation
6967
+ * SPDX-License-Identifier: Apache-2.0
6968
+ */
6969
+ var UtilRgb = /** @class */ (function () {
6970
+ function UtilRgb() {
6971
+ }
6972
+ UtilRgb.toCode = function (color) {
6973
+ return toPadded(color.toString(16).toUpperCase(), 6, "0");
6974
+ };
6975
+ UtilRgb.fromCode = function (code) {
6976
+ var trimmed = code.trim().toLowerCase();
6977
+ if (trimmed.length === 6) {
6978
+ var color = Number("0x" + trimmed);
6979
+ if (color === color) {
6980
+ return color;
6981
+ }
6982
+ }
6983
+ return null;
6984
+ };
6985
+ UtilRgb.fromRgb = function (r, g, b) {
6986
+ return ((r * 0xff) << 16) | ((g * 0xff) << 8) | ((b * 0xff) | 0);
6987
+ };
6988
+ UtilRgb.blend = function (colorA, colorB, t) {
6989
+ var ar = (colorA >> 16) & 0xff;
6990
+ var ag = (colorA >> 8) & 0xff;
6991
+ var ab = (colorA | 0) & 0xff;
6992
+ var br = (colorB >> 16) & 0xff;
6993
+ var bg = (colorB >> 8) & 0xff;
6994
+ var bb = (colorB | 0) & 0xff;
6995
+ var w1 = Math.max(0, Math.min(1, t));
6996
+ var w0 = 1 - w1;
6997
+ var cr = Math.max(0, Math.min(0xff, ar * w0 + br * w1));
6998
+ var cg = Math.max(0, Math.min(0xff, ag * w0 + bg * w1));
6999
+ var cb = Math.max(0, Math.min(0xff, ab * w0 + bb * w1));
7000
+ return (cr << 16) | (cg << 8) | (cb | 0);
7001
+ };
7002
+ UtilRgb.brighten = function (color, amount) {
7003
+ if (0 <= amount) {
7004
+ return this.blend(color, 0xffffff, amount);
7005
+ }
7006
+ else {
7007
+ return this.blend(color, 0x000000, -amount);
7008
+ }
7009
+ };
7010
+ UtilRgb.darken = function (color, amount) {
7011
+ if (0 <= amount) {
7012
+ return this.blend(color, 0x000000, amount);
7013
+ }
7014
+ else {
7015
+ return this.blend(color, 0xffffff, -amount);
7016
+ }
7017
+ };
7018
+ /**
7019
+ * Convertes the given color to a grayscale color.
7020
+ *
7021
+ * @param color a color to be converted
7022
+ * @returns a grayscale color
7023
+ * @see https://en.wikipedia.org/wiki/Grayscale
7024
+ */
7025
+ UtilRgb.toGrayscale = function (color) {
7026
+ var l = this.toLuma(color);
7027
+ return (l << 16) | (l << 8) | l;
7028
+ };
7029
+ /**
7030
+ * Convertes the given color to a luma in the range [0, 255].
7031
+ *
7032
+ * @param color a color to be converted
7033
+ * @returns a luma in the range [0, 255]
7034
+ * @see https://en.wikipedia.org/wiki/Grayscale
7035
+ */
7036
+ UtilRgb.toLuma = function (color) {
7037
+ var r = (color >> 16) & 0xff;
7038
+ var g = (color >> 8) & 0xff;
7039
+ var b = (color | 0) & 0xff;
7040
+ return (0.2126 * r + 0.7152 * g + 0.0722 * b) & 0xff;
7041
+ };
7042
+ return UtilRgb;
7043
+ }());
7044
+
7111
7045
  /*
7112
7046
  * Copyright (C) 2019 Toshiba Corporation
7113
7047
  * SPDX-License-Identifier: Apache-2.0
@@ -25090,66 +25024,13 @@
25090
25024
  * Copyright (C) 2019 Toshiba Corporation
25091
25025
  * SPDX-License-Identifier: Apache-2.0
25092
25026
  */
25093
- var EShapeSizes = /** @class */ (function () {
25094
- function EShapeSizes() {
25027
+ var toSizeNormalized = function (size) {
25028
+ var THRESHOLD = 0.001;
25029
+ if (Math.abs(size) < THRESHOLD) {
25030
+ return size < 0 ? -THRESHOLD : +THRESHOLD;
25095
25031
  }
25096
- EShapeSizes.toRounded = function (value) {
25097
- return Math.round(value * 100) / 100;
25098
- };
25099
- EShapeSizes.toNormalized = function (size) {
25100
- var THRESHOLD = 0.001;
25101
- if (Math.abs(size) < THRESHOLD) {
25102
- return size < 0 ? -THRESHOLD : +THRESHOLD;
25103
- }
25104
- return EShapeSizes.toRounded(size);
25105
- };
25106
- EShapeSizes.resize = function (shape, from, to, centerMode, isPerfect) {
25107
- shape.disallowUploadedUpdate();
25108
- var position = shape.transform.position;
25109
- if (centerMode) {
25110
- var dx = Math.abs(to.x - from.x);
25111
- var dy = Math.abs(to.y - from.y);
25112
- if (isPerfect) {
25113
- var hsize = Math.max(dx, dy);
25114
- var size = hsize + hsize;
25115
- shape.size.set(EShapeSizes.toNormalized(size), EShapeSizes.toNormalized(size));
25116
- position.set(EShapeSizes.toRounded(from.x), EShapeSizes.toRounded(from.y));
25117
- }
25118
- else {
25119
- shape.size.set(EShapeSizes.toNormalized(dx + dx), EShapeSizes.toNormalized(dy + dy));
25120
- position.set(EShapeSizes.toRounded(from.x), EShapeSizes.toRounded(from.y));
25121
- }
25122
- }
25123
- else {
25124
- if (isPerfect) {
25125
- var dx = to.x - from.x;
25126
- var dy = to.y - from.y;
25127
- var size = Math.max(Math.abs(dx), Math.abs(dy));
25128
- var x2 = from.x + (dx < 0 ? -size : +size);
25129
- var y2 = from.y + (dy < 0 ? -size : +size);
25130
- var hsize = size * 0.5;
25131
- var x = Math.min(from.x, x2) + hsize;
25132
- var y = Math.min(from.y, y2) + hsize;
25133
- shape.size.set(EShapeSizes.toNormalized(size), EShapeSizes.toNormalized(size));
25134
- position.set(EShapeSizes.toRounded(x), EShapeSizes.toRounded(y));
25135
- }
25136
- else {
25137
- var x0 = Math.min(from.x, to.x);
25138
- var y0 = Math.min(from.y, to.y);
25139
- var x1 = Math.max(from.x, to.x);
25140
- var y1 = Math.max(from.y, to.y);
25141
- var width = x1 - x0;
25142
- var height = y1 - y0;
25143
- var px = width * 0.5;
25144
- var py = height * 0.5;
25145
- shape.size.set(EShapeSizes.toNormalized(width), EShapeSizes.toNormalized(height));
25146
- position.set(EShapeSizes.toRounded(x0 + px), EShapeSizes.toRounded(y0 + py));
25147
- }
25148
- }
25149
- shape.allowUploadedUpdate();
25150
- };
25151
- return EShapeSizes;
25152
- }());
25032
+ return size;
25033
+ };
25153
25034
 
25154
25035
  /*
25155
25036
  * Copyright (C) 2019 Toshiba Corporation
@@ -25231,7 +25112,7 @@
25231
25112
  var size = shape.size;
25232
25113
  var writtenHeight = !!(runtime.written & EShapeRuntimeReset.HEIGHT);
25233
25114
  var oldSizeY = writtenHeight ? size.y : runtime.size.y;
25234
- size.y = EShapeSizes.toNormalized(sizeAbsolute);
25115
+ size.y = toSizeNormalized(sizeAbsolute);
25235
25116
  runtime.written |= EShapeRuntimeReset.HEIGHT;
25236
25117
  this.adjustPosition(shape, runtime, 0, oldSizeY - size.y, 0.5, this.origin);
25237
25118
  }
@@ -25257,7 +25138,7 @@
25257
25138
  var size = shape.size;
25258
25139
  var writtenHeight = !!(runtime.written & EShapeRuntimeReset.HEIGHT);
25259
25140
  var oldSizeY = writtenHeight ? size.y : runtime.size.y;
25260
- size.y = EShapeSizes.toNormalized(oldSizeY * sizeRelative);
25141
+ size.y = toSizeNormalized(oldSizeY * sizeRelative);
25261
25142
  runtime.written |= EShapeRuntimeReset.HEIGHT;
25262
25143
  this.adjustPosition(shape, runtime, 0, oldSizeY - size.y, 0.5, this.origin);
25263
25144
  }
@@ -25280,7 +25161,7 @@
25280
25161
  }
25281
25162
  EShapeActionRuntimeTransformResizeSizeAbsolute.prototype.execute = function (shape, runtime, time) {
25282
25163
  if (this.condition(shape, time)) {
25283
- var sizeAbsolute = EShapeSizes.toNormalized(this.size(shape, time));
25164
+ var sizeAbsolute = toSizeNormalized(this.size(shape, time));
25284
25165
  var size = shape.size;
25285
25166
  var writtenWidth = !!(runtime.written & EShapeRuntimeReset.WIDTH);
25286
25167
  var writtenHeight = !!(runtime.written & EShapeRuntimeReset.HEIGHT);
@@ -25315,7 +25196,7 @@
25315
25196
  var writtenHeight = !!(runtime.written & EShapeRuntimeReset.HEIGHT);
25316
25197
  var oldSizeX = writtenWidth ? size.x : runtime.size.x;
25317
25198
  var oldSizeY = writtenHeight ? size.y : runtime.size.y;
25318
- size.set(EShapeSizes.toNormalized(oldSizeX * sizeRelative), EShapeSizes.toNormalized(oldSizeY * sizeRelative));
25199
+ size.set(toSizeNormalized(oldSizeX * sizeRelative), toSizeNormalized(oldSizeY * sizeRelative));
25319
25200
  runtime.written |= EShapeRuntimeReset.SIZE;
25320
25201
  this.adjustPosition(shape, runtime, oldSizeX - size.x, oldSizeY - size.y, this.originX, this.originY);
25321
25202
  }
@@ -25341,7 +25222,7 @@
25341
25222
  var size = shape.size;
25342
25223
  var writtenWidth = !!(runtime.written & EShapeRuntimeReset.WIDTH);
25343
25224
  var oldSizeX = writtenWidth ? size.x : runtime.size.x;
25344
- size.x = EShapeSizes.toNormalized(sizeAbsolute);
25225
+ size.x = toSizeNormalized(sizeAbsolute);
25345
25226
  runtime.written |= EShapeRuntimeReset.WIDTH;
25346
25227
  this.adjustPosition(shape, runtime, oldSizeX - size.x, 0, this.origin, 0.5);
25347
25228
  }
@@ -25367,7 +25248,7 @@
25367
25248
  var size = shape.size;
25368
25249
  var writtenWidth = !!(runtime.written & EShapeRuntimeReset.WIDTH);
25369
25250
  var oldSizeX = writtenWidth ? size.x : runtime.size.x;
25370
- size.x = EShapeSizes.toNormalized(oldSizeX * sizeRelative);
25251
+ size.x = toSizeNormalized(oldSizeX * sizeRelative);
25371
25252
  runtime.written |= EShapeRuntimeReset.WIDTH;
25372
25253
  this.adjustPosition(shape, runtime, oldSizeX - size.x, 0, this.origin, 0.5);
25373
25254
  }
@@ -25559,321 +25440,270 @@
25559
25440
  * Copyright (C) 2019 Toshiba Corporation
25560
25441
  * SPDX-License-Identifier: Apache-2.0
25561
25442
  */
25562
- var EShapeActionValueDeserializer = /** @class */ (function () {
25563
- function EShapeActionValueDeserializer() {
25564
- }
25565
- EShapeActionValueDeserializer.toSerialized = function (resource) {
25566
- try {
25567
- var parsed = JSON.parse(resource);
25568
- if (isArray(parsed)) {
25569
- for (var i = 0, imax = parsed.length; i < imax; ++i) {
25570
- if (!isNumber(parsed[i])) {
25571
- return null;
25572
- }
25573
- }
25574
- if (2 <= parsed.length) {
25575
- return parsed;
25443
+ var toSerialized = function (resource) {
25444
+ try {
25445
+ var parsed = JSON.parse(resource);
25446
+ if (isArray(parsed)) {
25447
+ for (var i = 0, imax = parsed.length; i < imax; ++i) {
25448
+ if (!isNumber(parsed[i])) {
25449
+ return null;
25576
25450
  }
25577
25451
  }
25578
- return null;
25579
- }
25580
- catch (e) {
25581
- return null;
25582
- }
25583
- };
25584
- EShapeActionValueDeserializer.deserialize = function (id, manager) {
25585
- var action = manager.getAction(id);
25586
- if (action != null) {
25587
- return action;
25588
- }
25589
- var resources = manager.resources;
25590
- var resource = resources[id];
25591
- if (resource != null) {
25592
- var serialized = this.toSerialized(resource);
25593
- if (serialized != null) {
25594
- switch (serialized[0]) {
25595
- case EShapeActionValueType.SHOW_HIDE:
25596
- return EShapeActionValueShowHide.deserialize(serialized, manager);
25597
- case EShapeActionValueType.BLINK:
25598
- return EShapeActionValueBlink.deserialize(serialized, manager);
25599
- case EShapeActionValueType.CHANGE_COLOR:
25600
- case EShapeActionValueType.CHANGE_COLOR_LEGACY:
25601
- switch (serialized[3]) {
25602
- case EShapeActionValueChangeColorTarget.COLOR_AND_ALPHA:
25603
- case EShapeActionValueChangeColorTarget.COLOR:
25604
- case EShapeActionValueChangeColorTarget.ALPHA:
25605
- return EShapeActionValueChangeColor.deserialize(serialized, manager);
25606
- case EShapeActionValueChangeColorTarget.CODE:
25607
- return EShapeActionValueChangeColorCode.deserialize(serialized, manager);
25608
- case EShapeActionValueChangeColorTarget.BRIGHTNESS:
25609
- return EShapeActionValueChangeColorBrightness.deserialize(serialized, manager);
25610
- }
25611
- break;
25612
- case EShapeActionValueType.CHANGE_TEXT:
25613
- return EShapeActionValueChangeText.deserialize(serialized, manager);
25614
- case EShapeActionValueType.CHANGE_CURSOR:
25615
- return EShapeActionValueChangeCursor.deserialize(serialized, manager);
25616
- case EShapeActionValueType.EMIT_EVENT:
25617
- return EShapeActionValueEmitEvent.deserialize(serialized, manager);
25618
- case EShapeActionValueType.OPEN:
25619
- return EShapeActionValueOpen.deserialize(serialized, manager);
25620
- case EShapeActionValueType.TRANSFORM:
25621
- switch (serialized[2]) {
25622
- case EShapeActionValueTransformType.MOVE:
25623
- return EShapeActionValueTransformMove.deserialize(serialized, manager);
25624
- case EShapeActionValueTransformType.RESIZE:
25625
- return EShapeActionValueTransformResize.deserialize(serialized, manager);
25626
- case EShapeActionValueTransformType.ROTATE:
25627
- return EShapeActionValueTransformRotate.deserialize(serialized, manager);
25628
- }
25629
- break;
25630
- case EShapeActionValueType.MISC:
25631
- switch (serialized[2]) {
25632
- case EShapeActionValueMiscType.GESTURE:
25633
- return EShapeActionValueMiscGesture.deserialize(serialized, manager);
25634
- case EShapeActionValueMiscType.LAYER_SHOW_HIDE:
25635
- return EShapeActionValueMiscLayerShowHide.deserialize(serialized, manager);
25636
- case EShapeActionValueMiscType.LAYER_GESTURE:
25637
- return EShapeActionValueMiscLayerGesture.deserialize(serialized, manager);
25638
- default:
25639
- return EShapeActionValueMisc.deserialize(serialized, manager);
25640
- }
25641
- }
25452
+ if (2 <= parsed.length) {
25453
+ return parsed;
25642
25454
  }
25643
25455
  }
25644
- return new EShapeActionValueShowHide(EShapeActionValueShowHideType.SHOW, "");
25645
- };
25646
- return EShapeActionValueDeserializer;
25647
- }());
25648
-
25649
- var EShapeImageElements = /** @class */ (function () {
25650
- function EShapeImageElements() {
25456
+ return null;
25651
25457
  }
25652
- EShapeImageElements.toImageElement = function (dataUrl) {
25653
- var imageElements = EShapeImageElements.imageElements;
25654
- var cachedImageElement = imageElements[dataUrl];
25655
- if (cachedImageElement != null) {
25656
- if (cachedImageElement instanceof HTMLImageElement) {
25657
- return Promise.resolve(cachedImageElement);
25658
- }
25659
- else {
25660
- return cachedImageElement;
25458
+ catch (e) {
25459
+ return null;
25460
+ }
25461
+ };
25462
+ var deserializeActionValue = function (id, manager) {
25463
+ var action = manager.getAction(id);
25464
+ if (action != null) {
25465
+ return action;
25466
+ }
25467
+ var resources = manager.resources;
25468
+ var resource = resources[id];
25469
+ if (resource != null) {
25470
+ var serialized = toSerialized(resource);
25471
+ if (serialized != null) {
25472
+ switch (serialized[0]) {
25473
+ case EShapeActionValueType.SHOW_HIDE:
25474
+ return EShapeActionValueShowHide.deserialize(serialized, manager);
25475
+ case EShapeActionValueType.BLINK:
25476
+ return EShapeActionValueBlink.deserialize(serialized, manager);
25477
+ case EShapeActionValueType.CHANGE_COLOR:
25478
+ case EShapeActionValueType.CHANGE_COLOR_LEGACY:
25479
+ switch (serialized[3]) {
25480
+ case EShapeActionValueChangeColorTarget.COLOR_AND_ALPHA:
25481
+ case EShapeActionValueChangeColorTarget.COLOR:
25482
+ case EShapeActionValueChangeColorTarget.ALPHA:
25483
+ return EShapeActionValueChangeColor.deserialize(serialized, manager);
25484
+ case EShapeActionValueChangeColorTarget.CODE:
25485
+ return EShapeActionValueChangeColorCode.deserialize(serialized, manager);
25486
+ case EShapeActionValueChangeColorTarget.BRIGHTNESS:
25487
+ return EShapeActionValueChangeColorBrightness.deserialize(serialized, manager);
25488
+ }
25489
+ break;
25490
+ case EShapeActionValueType.CHANGE_TEXT:
25491
+ return EShapeActionValueChangeText.deserialize(serialized, manager);
25492
+ case EShapeActionValueType.CHANGE_CURSOR:
25493
+ return EShapeActionValueChangeCursor.deserialize(serialized, manager);
25494
+ case EShapeActionValueType.EMIT_EVENT:
25495
+ return EShapeActionValueEmitEvent.deserialize(serialized, manager);
25496
+ case EShapeActionValueType.OPEN:
25497
+ return EShapeActionValueOpen.deserialize(serialized, manager);
25498
+ case EShapeActionValueType.TRANSFORM:
25499
+ switch (serialized[2]) {
25500
+ case EShapeActionValueTransformType.MOVE:
25501
+ return EShapeActionValueTransformMove.deserialize(serialized, manager);
25502
+ case EShapeActionValueTransformType.RESIZE:
25503
+ return EShapeActionValueTransformResize.deserialize(serialized, manager);
25504
+ case EShapeActionValueTransformType.ROTATE:
25505
+ return EShapeActionValueTransformRotate.deserialize(serialized, manager);
25506
+ }
25507
+ break;
25508
+ case EShapeActionValueType.MISC:
25509
+ switch (serialized[2]) {
25510
+ case EShapeActionValueMiscType.GESTURE:
25511
+ return EShapeActionValueMiscGesture.deserialize(serialized, manager);
25512
+ case EShapeActionValueMiscType.LAYER_SHOW_HIDE:
25513
+ return EShapeActionValueMiscLayerShowHide.deserialize(serialized, manager);
25514
+ case EShapeActionValueMiscType.LAYER_GESTURE:
25515
+ return EShapeActionValueMiscLayerGesture.deserialize(serialized, manager);
25516
+ default:
25517
+ return EShapeActionValueMisc.deserialize(serialized, manager);
25518
+ }
25661
25519
  }
25662
25520
  }
25663
- else {
25664
- var result = new Promise(function (resolve, reject) {
25665
- var imageElement = document.createElement("img");
25666
- imageElement.onload = function () {
25667
- imageElements[dataUrl] = imageElement;
25668
- resolve(imageElement);
25669
- };
25670
- imageElement.onabort = imageElement.onerror = function () {
25671
- reject();
25672
- };
25673
- imageElement.src = dataUrl;
25674
- });
25675
- imageElements[dataUrl] = result;
25521
+ }
25522
+ return new EShapeActionValueShowHide(EShapeActionValueShowHideType.SHOW, "");
25523
+ };
25524
+
25525
+ /*
25526
+ * Copyright (C) 2019 Toshiba Corporation
25527
+ * SPDX-License-Identifier: Apache-2.0
25528
+ */
25529
+ var deserialize = function (item, manager) {
25530
+ var deserializer = EShapeDeserializers[item[0]] || EShapeDeserializers[EShapeType.NULL];
25531
+ if (deserializer != null) {
25532
+ var result = deserializer(item, manager);
25533
+ if (result != null) {
25676
25534
  return result;
25677
25535
  }
25678
- };
25679
- EShapeImageElements.imageElements = {};
25680
- return EShapeImageElements;
25681
- }());
25536
+ }
25537
+ throw new Error("Missing shape deserializers");
25538
+ };
25682
25539
 
25683
25540
  /*
25684
25541
  * Copyright (C) 2019 Toshiba Corporation
25685
25542
  * SPDX-License-Identifier: Apache-2.0
25686
25543
  */
25687
- var EShapeUuidMappingImpl = /** @class */ (function () {
25688
- function EShapeUuidMappingImpl(shapes) {
25689
- this._shapes = shapes;
25544
+ var parse = function (target) {
25545
+ try {
25546
+ return JSON.parse(target);
25690
25547
  }
25691
- EShapeUuidMappingImpl.prototype.find = function (uuid) {
25692
- return this.getUuidToShape().get(uuid);
25693
- };
25694
- EShapeUuidMappingImpl.prototype.getUuidToShape = function () {
25695
- var result = this._uuidToShape;
25696
- if (result == null) {
25697
- result = this.newUuidToShape();
25698
- this._uuidToShape = result;
25699
- }
25700
- return result;
25701
- };
25702
- EShapeUuidMappingImpl.prototype.newUuidToShape = function () {
25703
- var result = new Map();
25704
- this.fillUuidToShape(this._shapes, result);
25705
- return result;
25706
- };
25707
- EShapeUuidMappingImpl.prototype.fillUuidToShape = function (shapes, result) {
25708
- for (var i = 0, imax = shapes.length; i < imax; ++i) {
25709
- var shape = shapes[i];
25710
- result.set(shape.uuid, shape);
25711
- var children = shape.children;
25712
- if (0 < children.length) {
25713
- this.fillUuidToShape(children, result);
25714
- }
25548
+ catch (e) {
25549
+ return null;
25550
+ }
25551
+ };
25552
+ var deserializeGradient = function (target) {
25553
+ var parsed = parse(target);
25554
+ if (parsed == null || parsed.length < 7) {
25555
+ return undefined;
25556
+ }
25557
+ else {
25558
+ var direction = parsed[0];
25559
+ var points = [];
25560
+ for (var i = 1, imax = parsed.length; i < imax; i += 3) {
25561
+ points.push({
25562
+ color: parsed[i + 0],
25563
+ alpha: parsed[i + 1],
25564
+ position: parsed[i + 2]
25565
+ });
25715
25566
  }
25716
- };
25717
- return EShapeUuidMappingImpl;
25718
- }());
25567
+ return {
25568
+ points: points,
25569
+ direction: direction
25570
+ };
25571
+ }
25572
+ };
25719
25573
 
25720
25574
  /*
25721
25575
  * Copyright (C) 2019 Toshiba Corporation
25722
25576
  * SPDX-License-Identifier: Apache-2.0
25723
25577
  */
25724
- var EShapeNull = /** @class */ (function (_super) {
25725
- __extends(EShapeNull, _super);
25726
- function EShapeNull(type) {
25727
- if (type === void 0) { type = EShapeType.NULL; }
25728
- return _super.call(this, type) || this;
25578
+ var imageElementCache = {};
25579
+ var toImageElement = function (dataUrl) {
25580
+ var cachedImageElement = imageElementCache[dataUrl];
25581
+ if (cachedImageElement != null) {
25582
+ if (cachedImageElement instanceof HTMLImageElement) {
25583
+ return Promise.resolve(cachedImageElement);
25584
+ }
25585
+ else {
25586
+ return cachedImageElement;
25587
+ }
25729
25588
  }
25730
- EShapeNull.prototype.clone = function () {
25731
- return new EShapeNull().copy(this);
25732
- };
25733
- return EShapeNull;
25734
- }(EShapePrimitive));
25589
+ else {
25590
+ var result = new Promise(function (resolve, reject) {
25591
+ var imageElement = document.createElement("img");
25592
+ imageElement.onload = function () {
25593
+ imageElementCache[dataUrl] = imageElement;
25594
+ resolve(imageElement);
25595
+ };
25596
+ imageElement.onabort = imageElement.onerror = function () {
25597
+ reject();
25598
+ };
25599
+ imageElement.src = dataUrl;
25600
+ });
25601
+ imageElementCache[dataUrl] = result;
25602
+ return result;
25603
+ }
25604
+ };
25735
25605
 
25736
25606
  /*
25737
25607
  * Copyright (C) 2019 Toshiba Corporation
25738
25608
  * SPDX-License-Identifier: Apache-2.0
25739
25609
  */
25740
- var EShapeDeserializer = /** @class */ (function () {
25741
- function EShapeDeserializer() {
25610
+ var deserializeBase = function (item, manager, result) {
25611
+ result.id = manager.resources[item[1]] || "";
25612
+ var transform = result.transform;
25613
+ transform.position.set(item[2], item[3]);
25614
+ transform.rotation = item[6];
25615
+ transform.skew.set(item[7], item[7]);
25616
+ transform.pivot.set(item[21], item[22]);
25617
+ result.size.set(toSizeNormalized(item[4]), toSizeNormalized(item[5]));
25618
+ result.fill.deserialize(item[8], manager);
25619
+ result.stroke.deserialize(item[9], manager);
25620
+ result.cursor = manager.resources[item[10]] || "";
25621
+ result.text.deserialize(item[11], manager);
25622
+ result.data.deserialize(item[12], manager);
25623
+ result.radius = item[13];
25624
+ result.corner = item[14];
25625
+ var item23 = item[23];
25626
+ result.interactive = !!(item23 & 1);
25627
+ var state = result.state;
25628
+ state.isFocusable = !(item23 & 2);
25629
+ state.isActive = !!(item23 & 4);
25630
+ var item24 = item[24];
25631
+ result.shortcut = 0 <= item24 ? manager.resources[item24] : undefined;
25632
+ var item25 = item[25];
25633
+ result.title = 0 <= item25 ? manager.resources[item25] : undefined;
25634
+ var item26 = item[26];
25635
+ result.uuid = item26 != null ? item26 : 0;
25636
+ // Children
25637
+ var childrenPromise = null;
25638
+ var childrenSerialized = item[20];
25639
+ if (0 < childrenSerialized.length) {
25640
+ var childrenOrPromises = [];
25641
+ for (var i = 0, imax = childrenSerialized.length; i < imax; ++i) {
25642
+ childrenOrPromises.push(deserialize(childrenSerialized[i], manager));
25643
+ }
25644
+ childrenPromise = Promise.all(childrenOrPromises).then(function (children) {
25645
+ result.children = children;
25646
+ for (var i = 0, imax = children.length; i < imax; ++i) {
25647
+ children[i].parent = result;
25648
+ }
25649
+ result.onChildTransformChange();
25650
+ result.toDirty();
25651
+ return result;
25652
+ });
25742
25653
  }
25743
- EShapeDeserializer.toShape = function (item, manager) {
25744
- var shapeDeserializer = EShapeDeserializers[item[0]];
25745
- if (shapeDeserializer != null) {
25746
- var result = shapeDeserializer(item, manager);
25747
- if (result != null) {
25654
+ // Action
25655
+ var serializedActions = item[17];
25656
+ for (var i = 0, imax = serializedActions.length; i < imax; ++i) {
25657
+ result.action.add(deserializeActionValue(serializedActions[i], manager));
25658
+ }
25659
+ // Gradient
25660
+ var gradientId = item[19];
25661
+ if (0 <= gradientId && gradientId < manager.resources.length) {
25662
+ var gradient = manager.resources[gradientId];
25663
+ if (isString(gradient)) {
25664
+ result.gradient = deserializeGradient(gradient);
25665
+ }
25666
+ }
25667
+ // Image
25668
+ var imagePromise = null;
25669
+ var imageId = item[18];
25670
+ if (0 <= imageId && imageId < manager.resources.length) {
25671
+ var imageSrc = manager.resources[imageId];
25672
+ if (isString(imageSrc)) {
25673
+ imagePromise = toImageElement(imageSrc).then(function (imageElement) {
25674
+ result.image = imageElement;
25748
25675
  return result;
25749
- }
25676
+ });
25750
25677
  }
25751
- return EShapeDeserializer.deserialize(item, manager, new EShapeNull());
25752
- };
25753
- EShapeDeserializer.deserialize = function (item, manager, result) {
25754
- result.id = manager.resources[item[1]] || "";
25755
- var transform = result.transform;
25756
- transform.position.set(item[2], item[3]);
25757
- transform.rotation = item[6];
25758
- transform.skew.set(item[7], item[7]);
25759
- transform.pivot.set(item[21], item[22]);
25760
- result.size.set(EShapeSizes.toNormalized(item[4]), EShapeSizes.toNormalized(item[5]));
25761
- result.fill.deserialize(item[8], manager);
25762
- result.stroke.deserialize(item[9], manager);
25763
- result.cursor = manager.resources[item[10]] || "";
25764
- result.text.deserialize(item[11], manager);
25765
- result.data.deserialize(item[12], manager);
25766
- result.radius = item[13];
25767
- result.corner = item[14];
25768
- var item23 = item[23];
25769
- result.interactive = !!(item23 & 1);
25770
- var state = result.state;
25771
- state.isFocusable = !(item23 & 2);
25772
- state.isActive = !!(item23 & 4);
25773
- var item24 = item[24];
25774
- result.shortcut = 0 <= item24 ? manager.resources[item24] : undefined;
25775
- var item25 = item[25];
25776
- result.title = 0 <= item25 ? manager.resources[item25] : undefined;
25777
- var item26 = item[26];
25778
- result.uuid = item26 != null ? item26 : 0;
25779
- // Children
25780
- var childrenPromise = null;
25781
- var childrenSerialized = item[20];
25782
- if (0 < childrenSerialized.length) {
25783
- var childrenOrPromises = [];
25784
- for (var i = 0, imax = childrenSerialized.length; i < imax; ++i) {
25785
- childrenOrPromises.push(EShapeDeserializer.toShape(childrenSerialized[i], manager));
25786
- }
25787
- childrenPromise = Promise.all(childrenOrPromises).then(function (children) {
25788
- result.children = children;
25789
- for (var i = 0, imax = children.length; i < imax; ++i) {
25790
- children[i].parent = result;
25791
- }
25792
- result.onChildTransformChange();
25793
- result.toDirty();
25678
+ }
25679
+ //
25680
+ if (childrenPromise != null) {
25681
+ if (imagePromise != null) {
25682
+ return Promise.all([childrenPromise, imagePromise]).then(function () {
25794
25683
  return result;
25795
25684
  });
25796
25685
  }
25797
- // Action
25798
- var serializedActions = item[17];
25799
- for (var i = 0, imax = serializedActions.length; i < imax; ++i) {
25800
- result.action.add(EShapeActionValueDeserializer.deserialize(serializedActions[i], manager));
25801
- }
25802
- // Gradient
25803
- var gradientId = item[19];
25804
- if (0 <= gradientId && gradientId < manager.resources.length) {
25805
- var gradient = manager.resources[gradientId];
25806
- if (isString(gradient)) {
25807
- result.gradient = EShapeGradients.deserializeGradient(gradient);
25808
- }
25809
- }
25810
- // Image
25811
- var imagePromise = null;
25812
- var imageId = item[18];
25813
- if (0 <= imageId && imageId < manager.resources.length) {
25814
- var imageSrc = manager.resources[imageId];
25815
- if (isString(imageSrc)) {
25816
- imagePromise = EShapeImageElements.toImageElement(imageSrc).then(function (imageElement) {
25817
- result.image = imageElement;
25818
- return result;
25819
- });
25820
- }
25821
- }
25822
- //
25823
- if (childrenPromise != null) {
25824
- if (imagePromise != null) {
25825
- return Promise.all([childrenPromise, imagePromise]).then(function () {
25826
- return result;
25827
- });
25828
- }
25829
- else {
25830
- return childrenPromise;
25831
- }
25832
- }
25833
25686
  else {
25834
- if (imagePromise != null) {
25835
- return imagePromise;
25836
- }
25837
- else {
25838
- return result;
25839
- }
25687
+ return childrenPromise;
25840
25688
  }
25841
- };
25842
- EShapeDeserializer.deserializeAll = function (serializeds, manager) {
25843
- var _this = this;
25844
- var shapes = [];
25845
- for (var i = 0, imax = serializeds.length; i < imax; ++i) {
25846
- shapes.push(EShapeDeserializer.toShape(serializeds[i], manager));
25847
- }
25848
- if (0 < shapes.length) {
25849
- return Promise.all(shapes).then(function (resolved) {
25850
- _this.onDeserialized(serializeds, resolved, new EShapeUuidMappingImpl(resolved), manager);
25851
- return resolved;
25852
- });
25689
+ }
25690
+ else {
25691
+ if (imagePromise != null) {
25692
+ return imagePromise;
25853
25693
  }
25854
- return null;
25855
- };
25856
- EShapeDeserializer.onDeserialized = function (serializeds, shapes, mapping, manager) {
25857
- for (var i = 0, imax = serializeds.length; i < imax; ++i) {
25858
- var serialized = serializeds[i];
25859
- var shape = shapes[i];
25860
- var onDeserialized = EShapeOnDeserialized[serialized[0]];
25861
- if (onDeserialized) {
25862
- onDeserialized(serialized, shape, mapping, manager);
25863
- }
25864
- this.onDeserialized(serialized[20], shape.children, mapping, manager);
25694
+ else {
25695
+ return result;
25865
25696
  }
25866
- };
25867
- return EShapeDeserializer;
25868
- }());
25697
+ }
25698
+ };
25869
25699
 
25870
25700
  /*
25871
25701
  * Copyright (C) 2019 Toshiba Corporation
25872
25702
  * SPDX-License-Identifier: Apache-2.0
25873
25703
  */
25874
- var deserializeBar = function (item, manager) {
25875
- var shape = new EShapeBar();
25876
- var result = EShapeDeserializer.deserialize(item, manager, shape);
25704
+ var deserializeBar = function (item, manager, shape) {
25705
+ shape = shape || new EShapeBar();
25706
+ var result = deserializeBase(item, manager, shape);
25877
25707
  shape.points.deserialize(item[15], manager);
25878
25708
  var style = shape.points.style;
25879
25709
  var mask = EShapePointsStyle.NON_SCALING_MASK |
@@ -27322,7 +27152,8 @@
27322
27152
  * Copyright (C) 2019 Toshiba Corporation
27323
27153
  * SPDX-License-Identifier: Apache-2.0
27324
27154
  */
27325
- var deserializeButton = function (item, manager) {
27155
+ var deserializeButton = function (item, manager, shape) {
27156
+ shape = shape || new EShapeButton();
27326
27157
  var resources = manager.resources;
27327
27158
  var resourceId = item[15];
27328
27159
  if (0 <= resourceId && resourceId < resources.length) {
@@ -27331,12 +27162,10 @@
27331
27162
  parsed = JSON.parse(resources[resourceId]);
27332
27163
  manager.setExtension(resourceId, parsed);
27333
27164
  }
27334
- var shape = new EShapeButton();
27335
27165
  shape.isToggle = !!(parsed[0] & 1);
27336
27166
  shape.isGrouped = !!(parsed[0] & 2);
27337
- return EShapeDeserializer.deserialize(item, manager, shape);
27338
27167
  }
27339
- return EShapeDeserializer.deserialize(item, manager, new EShapeButton());
27168
+ return deserializeBase(item, manager, shape);
27340
27169
  };
27341
27170
 
27342
27171
  /*
@@ -28080,8 +27909,8 @@
28080
27909
  * Copyright (C) 2019 Toshiba Corporation
28081
27910
  * SPDX-License-Identifier: Apache-2.0
28082
27911
  */
28083
- var deserializeCircle = function (item, manager) {
28084
- return EShapeDeserializer.deserialize(item, manager, new EShapeCircle());
27912
+ var deserializeCircle = function (item, manager, shape) {
27913
+ return deserializeBase(item, manager, shape || new EShapeCircle());
28085
27914
  };
28086
27915
 
28087
27916
  /*
@@ -31737,10 +31566,10 @@
31737
31566
  * Copyright (C) 2019 Toshiba Corporation
31738
31567
  * SPDX-License-Identifier: Apache-2.0
31739
31568
  */
31740
- var deserializeConnectorLine = function (item, manager) {
31741
- return EShapeDeserializer.deserialize(item, manager, new EShapeConnectorLine());
31569
+ var deserializeConnectorLine = function (item, manager, shape) {
31570
+ return deserializeBase(item, manager, shape || new EShapeConnectorLine());
31742
31571
  };
31743
- var onConnectorLineDeserialized = function (item, shape, mapping, manager) {
31572
+ var onDeserializedConnectorLine = function (item, shape, mapping, manager) {
31744
31573
  if (shape instanceof EShapeConnectorLine) {
31745
31574
  var resources = manager.resources;
31746
31575
  var resourceId = item[15];
@@ -31781,7 +31610,7 @@
31781
31610
  var loadShapeConnectorLine = function () {
31782
31611
  EShapeUploadeds[EShapeType.CONNECTOR_LINE] = createLineUploaded;
31783
31612
  EShapeDeserializers[EShapeType.CONNECTOR_LINE] = deserializeConnectorLine;
31784
- EShapeOnDeserialized[EShapeType.CONNECTOR_LINE] = onConnectorLineDeserialized;
31613
+ EShapeOnDeserializeds[EShapeType.CONNECTOR_LINE] = onDeserializedConnectorLine;
31785
31614
  EShapeCapabilities.set(EShapeType.CONNECTOR_LINE, EShapeCapability.CONNECTOR);
31786
31615
  };
31787
31616
 
@@ -31890,237 +31719,680 @@
31890
31719
  * Copyright (C) 2019 Toshiba Corporation
31891
31720
  * SPDX-License-Identifier: Apache-2.0
31892
31721
  */
31893
- var EShapeResourceManagerDeserialization = /** @class */ (function () {
31894
- function EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode) {
31895
- this.resources = serialized.resources;
31896
- this.data = serialized.data || serialized.tags || serialized.resources;
31897
- this.pieces = pieces;
31898
- this.pieceData = pieceData;
31899
- this.isEditMode = isEditMode;
31900
- this._actions = new Map();
31901
- this._fills = new Map();
31902
- this._strokes = new Map();
31903
- this._data = new Map();
31904
- this._dataValues = new Map();
31905
- this._ranges = new Map();
31906
- this._aligns = new Map();
31907
- this._margins = new Map();
31908
- this._texts = new Map();
31909
- this._textOutlines = new Map();
31910
- this._extensions = new Map();
31722
+ var EShapeGroupTextAlignEditor = /** @class */ (function () {
31723
+ function EShapeGroupTextAlignEditor(parent) {
31724
+ this._parent = parent;
31911
31725
  }
31912
- EShapeResourceManagerDeserialization.prototype.getAction = function (id) {
31913
- return this._actions.get(id);
31914
- };
31915
- EShapeResourceManagerDeserialization.prototype.setAction = function (id, action) {
31916
- this._actions.set(id, action);
31917
- };
31918
- EShapeResourceManagerDeserialization.prototype.getFill = function (id) {
31919
- return this._fills.get(id);
31920
- };
31921
- EShapeResourceManagerDeserialization.prototype.setFill = function (id, fill) {
31922
- this._fills.set(id, fill);
31923
- };
31924
- EShapeResourceManagerDeserialization.prototype.getStroke = function (id) {
31925
- return this._strokes.get(id);
31926
- };
31927
- EShapeResourceManagerDeserialization.prototype.setStroke = function (id, stroke) {
31928
- this._strokes.set(id, stroke);
31929
- };
31930
- EShapeResourceManagerDeserialization.prototype.getData = function (id) {
31931
- return this._data.get(id);
31932
- };
31933
- EShapeResourceManagerDeserialization.prototype.setData = function (id, data) {
31934
- this._data.set(id, data);
31935
- };
31936
- EShapeResourceManagerDeserialization.prototype.getDataValue = function (id) {
31937
- return this._dataValues.get(id);
31938
- };
31939
- EShapeResourceManagerDeserialization.prototype.setDataValue = function (id, dataValue) {
31940
- this._dataValues.set(id, dataValue);
31941
- };
31942
- EShapeResourceManagerDeserialization.prototype.getRange = function (id) {
31943
- return this._ranges.get(id);
31944
- };
31945
- EShapeResourceManagerDeserialization.prototype.setRange = function (id, range) {
31946
- this._ranges.set(id, range);
31947
- };
31948
- EShapeResourceManagerDeserialization.prototype.getAlign = function (id) {
31949
- return this._aligns.get(id);
31950
- };
31951
- EShapeResourceManagerDeserialization.prototype.setAlign = function (id, align) {
31952
- this._aligns.set(id, align);
31953
- };
31954
- EShapeResourceManagerDeserialization.prototype.getMargin = function (id) {
31955
- return this._margins.get(id);
31956
- };
31957
- EShapeResourceManagerDeserialization.prototype.setMargin = function (id, margin) {
31958
- this._margins.set(id, margin);
31959
- };
31960
- EShapeResourceManagerDeserialization.prototype.getText = function (id) {
31961
- return this._texts.get(id);
31962
- };
31963
- EShapeResourceManagerDeserialization.prototype.setText = function (id, text) {
31964
- this._texts.set(id, text);
31726
+ Object.defineProperty(EShapeGroupTextAlignEditor.prototype, "horizontal", {
31727
+ get: function () {
31728
+ var children = this._parent.children;
31729
+ if (0 < children.length) {
31730
+ return children[children.length - 1].text.align.horizontal;
31731
+ }
31732
+ return EShapeTextAlignHorizontal.CENTER;
31733
+ },
31734
+ set: function (horizontal) {
31735
+ var children = this._parent.children;
31736
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31737
+ children[i].text.align.horizontal = horizontal;
31738
+ }
31739
+ },
31740
+ enumerable: false,
31741
+ configurable: true
31742
+ });
31743
+ Object.defineProperty(EShapeGroupTextAlignEditor.prototype, "vertical", {
31744
+ get: function () {
31745
+ var children = this._parent.children;
31746
+ if (0 < children.length) {
31747
+ return children[children.length - 1].text.align.vertical;
31748
+ }
31749
+ return EShapeTextAlignVertical.MIDDLE;
31750
+ },
31751
+ set: function (vertical) {
31752
+ var children = this._parent.children;
31753
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31754
+ children[i].text.align.vertical = vertical;
31755
+ }
31756
+ },
31757
+ enumerable: false,
31758
+ configurable: true
31759
+ });
31760
+ EShapeGroupTextAlignEditor.prototype.copy = function (target) {
31761
+ var children = this._parent.children;
31762
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31763
+ children[i].text.align.copy(target);
31764
+ }
31965
31765
  };
31966
- EShapeResourceManagerDeserialization.prototype.getTextOutline = function (id) {
31967
- return this._textOutlines.get(id);
31766
+ EShapeGroupTextAlignEditor.prototype.set = function (horizontal, vertical) {
31767
+ var children = this._parent.children;
31768
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31769
+ children[i].text.align.set(horizontal, vertical);
31770
+ }
31968
31771
  };
31969
- EShapeResourceManagerDeserialization.prototype.setTextOutline = function (id, textOutline) {
31970
- this._textOutlines.set(id, textOutline);
31772
+ EShapeGroupTextAlignEditor.prototype.toObject = function () {
31773
+ var children = this._parent.children;
31774
+ if (0 < children.length) {
31775
+ return children[children.length - 1].text.align.toObject();
31776
+ }
31777
+ return {
31778
+ horizontal: EShapeTextAlignHorizontal.CENTER,
31779
+ vertical: EShapeTextAlignVertical.MIDDLE
31780
+ };
31971
31781
  };
31972
- EShapeResourceManagerDeserialization.prototype.getExtension = function (id) {
31973
- return this._extensions.get(id);
31782
+ EShapeGroupTextAlignEditor.prototype.serialize = function (manager) {
31783
+ return -1;
31974
31784
  };
31975
- EShapeResourceManagerDeserialization.prototype.setExtension = function (id, extension) {
31976
- this._extensions.set(id, extension);
31785
+ EShapeGroupTextAlignEditor.prototype.deserialize = function (target, manager) {
31786
+ // DO NOTHING
31977
31787
  };
31978
- return EShapeResourceManagerDeserialization;
31979
- }());
31980
-
31981
- var EShapeEmbeddedDatum = /** @class */ (function () {
31982
- function EShapeEmbeddedDatum(name, width, height, layer) {
31983
- this.name = name;
31984
- this.width = width;
31985
- this.height = height;
31986
- this.layer = layer;
31987
- }
31988
- return EShapeEmbeddedDatum;
31788
+ return EShapeGroupTextAlignEditor;
31989
31789
  }());
31990
31790
 
31991
31791
  /*
31992
31792
  * Copyright (C) 2019 Toshiba Corporation
31993
31793
  * SPDX-License-Identifier: Apache-2.0
31994
31794
  */
31995
- var EShapeConnectors = /** @class */ (function () {
31996
- function EShapeConnectors() {
31795
+ var EShapeGroupTextOffsetEditor = /** @class */ (function () {
31796
+ function EShapeGroupTextOffsetEditor(parent) {
31797
+ this._parent = parent;
31997
31798
  }
31998
- EShapeConnectors.isConnector = function (target) {
31999
- return target != null && target.type === EShapeType.CONNECTOR_LINE;
32000
- };
32001
- EShapeConnectors.newMapping = function (sources, destinations, result) {
32002
- var _a;
32003
- if (result == null) {
32004
- result = (_a = EShapeConnectors._MAPPING) !== null && _a !== void 0 ? _a : (EShapeConnectors._MAPPING = new Map());
32005
- result.clear();
31799
+ Object.defineProperty(EShapeGroupTextOffsetEditor.prototype, "horizontal", {
31800
+ get: function () {
31801
+ var children = this._parent.children;
31802
+ if (0 < children.length) {
31803
+ return children[children.length - 1].text.offset.horizontal;
31804
+ }
31805
+ return 0;
31806
+ },
31807
+ set: function (horizontal) {
31808
+ var children = this._parent.children;
31809
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31810
+ children[i].text.offset.horizontal = horizontal;
31811
+ }
31812
+ },
31813
+ enumerable: false,
31814
+ configurable: true
31815
+ });
31816
+ Object.defineProperty(EShapeGroupTextOffsetEditor.prototype, "vertical", {
31817
+ get: function () {
31818
+ var children = this._parent.children;
31819
+ if (0 < children.length) {
31820
+ return children[children.length - 1].text.offset.vertical;
31821
+ }
31822
+ return 0;
31823
+ },
31824
+ set: function (vertical) {
31825
+ var children = this._parent.children;
31826
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31827
+ children[i].text.offset.vertical = vertical;
31828
+ }
31829
+ },
31830
+ enumerable: false,
31831
+ configurable: true
31832
+ });
31833
+ EShapeGroupTextOffsetEditor.prototype.copy = function (target) {
31834
+ var children = this._parent.children;
31835
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31836
+ children[i].text.offset.copy(target);
32006
31837
  }
32007
- for (var i = 0, imax = sources.length; i < imax; ++i) {
32008
- var fromChild = sources[i];
32009
- var toChild = destinations[i];
32010
- result.set(fromChild, toChild);
32011
- this.newMapping(fromChild.children, toChild.children, result);
31838
+ };
31839
+ EShapeGroupTextOffsetEditor.prototype.set = function (horizontal, vertical) {
31840
+ var children = this._parent.children;
31841
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31842
+ children[i].text.offset.set(horizontal, vertical);
32012
31843
  }
32013
- return result;
32014
31844
  };
32015
- EShapeConnectors.moveAll = function (rootSources, rootDestinations, sources, destinations, mapping) {
32016
- for (var i = 0, imax = sources.length; i < imax; ++i) {
32017
- var source = sources[i];
32018
- var destination = destinations[i];
32019
- if (this.isConnector(source)) {
32020
- if (this.isConnector(destination)) {
32021
- var sourceEdge = source.edge;
32022
- var destEdge = destination.edge;
32023
- var sourceHead = sourceEdge.head;
32024
- var sourceHeadShape = sourceHead.acceptor.shape;
32025
- if (sourceHeadShape) {
32026
- if (mapping == null) {
32027
- mapping = this.newMapping(rootSources, rootDestinations);
32028
- }
32029
- var destHeadShape = mapping.get(sourceHeadShape);
32030
- if (destHeadShape) {
32031
- var destHead = destEdge.head;
32032
- destHead.detach();
32033
- destHead.set(destHeadShape);
32034
- destHead.attach();
32035
- destHeadShape.connector.remove(sourceHead);
32036
- }
32037
- }
32038
- var sourceTail = sourceEdge.tail;
32039
- var sourceTailShape = sourceTail.acceptor.shape;
32040
- if (sourceTailShape) {
32041
- if (mapping == null) {
32042
- mapping = this.newMapping(rootSources, rootDestinations);
32043
- }
32044
- var destTailShape = mapping.get(sourceTailShape);
32045
- if (destTailShape) {
32046
- var destTail = destEdge.tail;
32047
- destTail.detach();
32048
- destTail.set(destTailShape);
32049
- destTail.attach();
32050
- destTailShape.connector.remove(sourceTail);
32051
- }
32052
- }
32053
- }
32054
- }
32055
- mapping = this.moveAll(rootSources, rootDestinations, source.children, destination.children, mapping);
31845
+ EShapeGroupTextOffsetEditor.prototype.toObject = function () {
31846
+ var children = this._parent.children;
31847
+ if (0 < children.length) {
31848
+ return children[children.length - 1].text.offset.toObject();
32056
31849
  }
32057
- return mapping;
31850
+ return {
31851
+ horizontal: 0,
31852
+ vertical: 0
31853
+ };
32058
31854
  };
32059
- EShapeConnectors.move = function (from, to) {
32060
- var fromChildren = from.children;
32061
- var toChildren = to.children;
32062
- this.moveAll(fromChildren, toChildren, fromChildren, toChildren);
31855
+ EShapeGroupTextOffsetEditor.prototype.serialize = function (manager) {
31856
+ return -1;
32063
31857
  };
32064
- return EShapeConnectors;
31858
+ EShapeGroupTextOffsetEditor.prototype.deserialize = function (target, manager) {
31859
+ // DO NOTHING
31860
+ };
31861
+ return EShapeGroupTextOffsetEditor;
32065
31862
  }());
32066
31863
 
32067
31864
  /*
32068
31865
  * Copyright (C) 2019 Toshiba Corporation
32069
31866
  * SPDX-License-Identifier: Apache-2.0
32070
31867
  */
32071
- var EShapeLayerState = {
32072
- INVISIBLE: "INVISIBLE",
32073
- INTERACTIVE: "INTERACTIVE",
32074
- DRAGGABLE: "DRAGGABLE",
32075
- PINCHABLE: "PINCHABLE"
32076
- };
32077
-
32078
- /*
32079
- * Copyright (C) 2019 Toshiba Corporation
32080
- * SPDX-License-Identifier: Apache-2.0
32081
- */
32082
- var EShapeGroupFillViewer = /** @class */ (function () {
32083
- function EShapeGroupFillViewer() {
32084
- // DO NOTHING
31868
+ var EShapeGroupTextOutlineEditor = /** @class */ (function () {
31869
+ function EShapeGroupTextOutlineEditor(parent) {
31870
+ this._parent = parent;
32085
31871
  }
32086
- Object.defineProperty(EShapeGroupFillViewer.prototype, "enable", {
31872
+ Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "enable", {
32087
31873
  get: function () {
32088
- return true;
31874
+ var children = this._parent.children;
31875
+ if (0 < children.length) {
31876
+ return children[children.length - 1].text.outline.enable;
31877
+ }
31878
+ return false;
32089
31879
  },
32090
31880
  set: function (enable) {
32091
- // DO NOTHING
31881
+ var children = this._parent.children;
31882
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31883
+ children[i].text.outline.enable = enable;
31884
+ }
32092
31885
  },
32093
31886
  enumerable: false,
32094
31887
  configurable: true
32095
31888
  });
32096
- Object.defineProperty(EShapeGroupFillViewer.prototype, "color", {
31889
+ Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "color", {
32097
31890
  get: function () {
31891
+ var children = this._parent.children;
31892
+ if (0 < children.length) {
31893
+ return children[children.length - 1].text.outline.color;
31894
+ }
32098
31895
  return 0xffffff;
32099
31896
  },
32100
31897
  set: function (color) {
32101
- // DO NOTHING
31898
+ var children = this._parent.children;
31899
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31900
+ children[i].text.outline.color = color;
31901
+ }
32102
31902
  },
32103
31903
  enumerable: false,
32104
31904
  configurable: true
32105
31905
  });
32106
- Object.defineProperty(EShapeGroupFillViewer.prototype, "alpha", {
31906
+ Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "alpha", {
32107
31907
  get: function () {
31908
+ var children = this._parent.children;
31909
+ if (0 < children.length) {
31910
+ return children[children.length - 1].text.outline.alpha;
31911
+ }
32108
31912
  return 1.0;
32109
31913
  },
32110
31914
  set: function (alpha) {
32111
- // DO NOTHING
31915
+ var children = this._parent.children;
31916
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31917
+ children[i].text.outline.alpha = alpha;
31918
+ }
32112
31919
  },
32113
31920
  enumerable: false,
32114
31921
  configurable: true
32115
31922
  });
32116
- EShapeGroupFillViewer.prototype.copy = function (target) {
32117
- // DO NOTHING
32118
- };
32119
- EShapeGroupFillViewer.prototype.set = function (enable, color, alpha) {
32120
- // DO NOTHING
31923
+ Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "width", {
31924
+ get: function () {
31925
+ var children = this._parent.children;
31926
+ if (0 < children.length) {
31927
+ return children[children.length - 1].text.outline.width;
31928
+ }
31929
+ return 1.0;
31930
+ },
31931
+ set: function (width) {
31932
+ var children = this._parent.children;
31933
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31934
+ children[i].text.outline.width = width;
31935
+ }
31936
+ },
31937
+ enumerable: false,
31938
+ configurable: true
31939
+ });
31940
+ EShapeGroupTextOutlineEditor.prototype.copy = function (target) {
31941
+ var children = this._parent.children;
31942
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31943
+ children[i].text.outline.copy(target);
31944
+ }
32121
31945
  };
32122
- EShapeGroupFillViewer.prototype.clone = function () {
32123
- return new EShapeGroupFillViewer();
31946
+ EShapeGroupTextOutlineEditor.prototype.set = function (enable, color, alpha, width) {
31947
+ var children = this._parent.children;
31948
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31949
+ children[i].text.outline.set(enable, color, alpha, width);
31950
+ }
31951
+ };
31952
+ EShapeGroupTextOutlineEditor.prototype.clone = function () {
31953
+ return new EShapeGroupTextOutlineEditor(this._parent);
31954
+ };
31955
+ EShapeGroupTextOutlineEditor.prototype.toObject = function () {
31956
+ var children = this._parent.children;
31957
+ if (0 < children.length) {
31958
+ return children[children.length - 1].text.outline.toObject();
31959
+ }
31960
+ return {
31961
+ enable: false,
31962
+ color: 0xffffff,
31963
+ alpha: 1.0,
31964
+ width: 1.0
31965
+ };
31966
+ };
31967
+ EShapeGroupTextOutlineEditor.prototype.serialize = function (manager) {
31968
+ return -1;
31969
+ };
31970
+ EShapeGroupTextOutlineEditor.prototype.deserialize = function (target, manager) {
31971
+ //
31972
+ };
31973
+ return EShapeGroupTextOutlineEditor;
31974
+ }());
31975
+
31976
+ /*
31977
+ * Copyright (C) 2019 Toshiba Corporation
31978
+ * SPDX-License-Identifier: Apache-2.0
31979
+ */
31980
+ var EShapeGroupTextPaddingEditor = /** @class */ (function () {
31981
+ function EShapeGroupTextPaddingEditor(parent) {
31982
+ this._parent = parent;
31983
+ }
31984
+ Object.defineProperty(EShapeGroupTextPaddingEditor.prototype, "horizontal", {
31985
+ get: function () {
31986
+ var children = this._parent.children;
31987
+ if (0 < children.length) {
31988
+ return children[children.length - 1].text.padding.horizontal;
31989
+ }
31990
+ return 0;
31991
+ },
31992
+ set: function (horizontal) {
31993
+ var children = this._parent.children;
31994
+ for (var i = 0, imax = children.length; i < imax; ++i) {
31995
+ children[i].text.padding.horizontal = horizontal;
31996
+ }
31997
+ },
31998
+ enumerable: false,
31999
+ configurable: true
32000
+ });
32001
+ Object.defineProperty(EShapeGroupTextPaddingEditor.prototype, "vertical", {
32002
+ get: function () {
32003
+ var children = this._parent.children;
32004
+ if (0 < children.length) {
32005
+ return children[children.length - 1].text.padding.vertical;
32006
+ }
32007
+ return 0;
32008
+ },
32009
+ set: function (vertical) {
32010
+ var children = this._parent.children;
32011
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32012
+ children[i].text.padding.vertical = vertical;
32013
+ }
32014
+ },
32015
+ enumerable: false,
32016
+ configurable: true
32017
+ });
32018
+ EShapeGroupTextPaddingEditor.prototype.copy = function (target) {
32019
+ var children = this._parent.children;
32020
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32021
+ children[i].text.padding.copy(target);
32022
+ }
32023
+ };
32024
+ EShapeGroupTextPaddingEditor.prototype.set = function (horizontal, vertical) {
32025
+ var children = this._parent.children;
32026
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32027
+ children[i].text.padding.set(horizontal, vertical);
32028
+ }
32029
+ };
32030
+ EShapeGroupTextPaddingEditor.prototype.toObject = function () {
32031
+ var children = this._parent.children;
32032
+ if (0 < children.length) {
32033
+ return children[children.length - 1].text.padding.toObject();
32034
+ }
32035
+ return {
32036
+ horizontal: 0,
32037
+ vertical: 0
32038
+ };
32039
+ };
32040
+ EShapeGroupTextPaddingEditor.prototype.serialize = function (manager) {
32041
+ return -1;
32042
+ };
32043
+ EShapeGroupTextPaddingEditor.prototype.deserialize = function (target, manager) {
32044
+ // DO NOTHING
32045
+ };
32046
+ return EShapeGroupTextPaddingEditor;
32047
+ }());
32048
+
32049
+ /*
32050
+ * Copyright (C) 2019 Toshiba Corporation
32051
+ * SPDX-License-Identifier: Apache-2.0
32052
+ */
32053
+ var EShapeGroupTextSpacingEditor = /** @class */ (function () {
32054
+ function EShapeGroupTextSpacingEditor(parent) {
32055
+ this._parent = parent;
32056
+ }
32057
+ Object.defineProperty(EShapeGroupTextSpacingEditor.prototype, "horizontal", {
32058
+ get: function () {
32059
+ var children = this._parent.children;
32060
+ if (0 < children.length) {
32061
+ return children[children.length - 1].text.spacing.horizontal;
32062
+ }
32063
+ return 0;
32064
+ },
32065
+ set: function (horizontal) {
32066
+ var children = this._parent.children;
32067
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32068
+ children[i].text.spacing.horizontal = horizontal;
32069
+ }
32070
+ },
32071
+ enumerable: false,
32072
+ configurable: true
32073
+ });
32074
+ Object.defineProperty(EShapeGroupTextSpacingEditor.prototype, "vertical", {
32075
+ get: function () {
32076
+ var children = this._parent.children;
32077
+ if (0 < children.length) {
32078
+ return children[children.length - 1].text.spacing.vertical;
32079
+ }
32080
+ return 0;
32081
+ },
32082
+ set: function (vertical) {
32083
+ var children = this._parent.children;
32084
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32085
+ children[i].text.spacing.vertical = vertical;
32086
+ }
32087
+ },
32088
+ enumerable: false,
32089
+ configurable: true
32090
+ });
32091
+ EShapeGroupTextSpacingEditor.prototype.copy = function (target) {
32092
+ var children = this._parent.children;
32093
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32094
+ children[i].text.spacing.copy(target);
32095
+ }
32096
+ };
32097
+ EShapeGroupTextSpacingEditor.prototype.set = function (horizontal, vertical) {
32098
+ var children = this._parent.children;
32099
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32100
+ children[i].text.spacing.set(horizontal, vertical);
32101
+ }
32102
+ };
32103
+ EShapeGroupTextSpacingEditor.prototype.toObject = function () {
32104
+ var children = this._parent.children;
32105
+ if (0 < children.length) {
32106
+ return children[children.length - 1].text.spacing.toObject();
32107
+ }
32108
+ return {
32109
+ horizontal: 0,
32110
+ vertical: 0
32111
+ };
32112
+ };
32113
+ EShapeGroupTextSpacingEditor.prototype.serialize = function (manager) {
32114
+ return -1;
32115
+ };
32116
+ EShapeGroupTextSpacingEditor.prototype.deserialize = function (target, manager) {
32117
+ // DO NOTHING
32118
+ };
32119
+ return EShapeGroupTextSpacingEditor;
32120
+ }());
32121
+
32122
+ /*
32123
+ * Copyright (C) 2019 Toshiba Corporation
32124
+ * SPDX-License-Identifier: Apache-2.0
32125
+ */
32126
+ var EShapeGroupTextEditor = /** @class */ (function () {
32127
+ function EShapeGroupTextEditor(parent) {
32128
+ this._parent = parent;
32129
+ this.align = new EShapeGroupTextAlignEditor(parent);
32130
+ this.offset = new EShapeGroupTextOffsetEditor(parent);
32131
+ this.outline = new EShapeGroupTextOutlineEditor(parent);
32132
+ this.spacing = new EShapeGroupTextSpacingEditor(parent);
32133
+ this.padding = new EShapeGroupTextPaddingEditor(parent);
32134
+ }
32135
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "enable", {
32136
+ get: function () {
32137
+ var children = this._parent.children;
32138
+ if (0 < children.length) {
32139
+ return children[children.length - 1].text.enable;
32140
+ }
32141
+ return true;
32142
+ },
32143
+ set: function (enable) {
32144
+ var children = this._parent.children;
32145
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32146
+ children[i].text.enable = enable;
32147
+ }
32148
+ },
32149
+ enumerable: false,
32150
+ configurable: true
32151
+ });
32152
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "value", {
32153
+ get: function () {
32154
+ var children = this._parent.children;
32155
+ if (0 < children.length) {
32156
+ return children[children.length - 1].text.value;
32157
+ }
32158
+ return "";
32159
+ },
32160
+ set: function (value) {
32161
+ var children = this._parent.children;
32162
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32163
+ children[i].text.value = value;
32164
+ }
32165
+ },
32166
+ enumerable: false,
32167
+ configurable: true
32168
+ });
32169
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "color", {
32170
+ get: function () {
32171
+ var children = this._parent.children;
32172
+ if (0 < children.length) {
32173
+ return children[children.length - 1].text.color;
32174
+ }
32175
+ return 0x000000;
32176
+ },
32177
+ set: function (color) {
32178
+ var children = this._parent.children;
32179
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32180
+ children[i].text.color = color;
32181
+ }
32182
+ },
32183
+ enumerable: false,
32184
+ configurable: true
32185
+ });
32186
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "alpha", {
32187
+ get: function () {
32188
+ var children = this._parent.children;
32189
+ if (0 < children.length) {
32190
+ return children[children.length - 1].text.alpha;
32191
+ }
32192
+ return 1.0;
32193
+ },
32194
+ set: function (alpha) {
32195
+ var children = this._parent.children;
32196
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32197
+ children[i].text.alpha = alpha;
32198
+ }
32199
+ },
32200
+ enumerable: false,
32201
+ configurable: true
32202
+ });
32203
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "family", {
32204
+ get: function () {
32205
+ var children = this._parent.children;
32206
+ if (0 < children.length) {
32207
+ return children[children.length - 1].text.family;
32208
+ }
32209
+ return "auto";
32210
+ },
32211
+ set: function (family) {
32212
+ var children = this._parent.children;
32213
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32214
+ children[i].text.family = family;
32215
+ }
32216
+ },
32217
+ enumerable: false,
32218
+ configurable: true
32219
+ });
32220
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "size", {
32221
+ get: function () {
32222
+ var children = this._parent.children;
32223
+ if (0 < children.length) {
32224
+ return children[children.length - 1].text.size;
32225
+ }
32226
+ return 24;
32227
+ },
32228
+ set: function (size) {
32229
+ var children = this._parent.children;
32230
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32231
+ children[i].text.size = size;
32232
+ }
32233
+ },
32234
+ enumerable: false,
32235
+ configurable: true
32236
+ });
32237
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "weight", {
32238
+ get: function () {
32239
+ var children = this._parent.children;
32240
+ if (0 < children.length) {
32241
+ return children[children.length - 1].text.weight;
32242
+ }
32243
+ return EShapeTextWeight.NORMAL;
32244
+ },
32245
+ set: function (weight) {
32246
+ var children = this._parent.children;
32247
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32248
+ children[i].text.weight = weight;
32249
+ }
32250
+ },
32251
+ enumerable: false,
32252
+ configurable: true
32253
+ });
32254
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "style", {
32255
+ get: function () {
32256
+ var children = this._parent.children;
32257
+ if (0 < children.length) {
32258
+ return children[children.length - 1].text.style;
32259
+ }
32260
+ return EShapeTextStyle.NORMAL;
32261
+ },
32262
+ set: function (style) {
32263
+ var children = this._parent.children;
32264
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32265
+ children[i].text.style = style;
32266
+ }
32267
+ },
32268
+ enumerable: false,
32269
+ configurable: true
32270
+ });
32271
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "direction", {
32272
+ get: function () {
32273
+ var children = this._parent.children;
32274
+ if (0 < children.length) {
32275
+ return children[children.length - 1].text.direction;
32276
+ }
32277
+ return 0;
32278
+ },
32279
+ set: function (direction) {
32280
+ var children = this._parent.children;
32281
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32282
+ children[i].text.direction = direction;
32283
+ }
32284
+ },
32285
+ enumerable: false,
32286
+ configurable: true
32287
+ });
32288
+ Object.defineProperty(EShapeGroupTextEditor.prototype, "clipping", {
32289
+ get: function () {
32290
+ var children = this._parent.children;
32291
+ if (0 < children.length) {
32292
+ return children[children.length - 1].text.clipping;
32293
+ }
32294
+ return false;
32295
+ },
32296
+ set: function (clipping) {
32297
+ var children = this._parent.children;
32298
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32299
+ children[i].text.clipping = clipping;
32300
+ }
32301
+ },
32302
+ enumerable: false,
32303
+ configurable: true
32304
+ });
32305
+ EShapeGroupTextEditor.prototype.copy = function (target) {
32306
+ var children = this._parent.children;
32307
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32308
+ children[i].text.copy(target);
32309
+ }
32310
+ return this;
32311
+ };
32312
+ EShapeGroupTextEditor.prototype.set = function (value, color, alpha, family, size, weight, style, direction) {
32313
+ var children = this._parent.children;
32314
+ for (var i = 0, imax = children.length; i < imax; ++i) {
32315
+ children[i].text.set(value, color, alpha, family, size, weight, style, direction);
32316
+ }
32317
+ return this;
32318
+ };
32319
+ EShapeGroupTextEditor.prototype.toObject = function () {
32320
+ var children = this._parent.children;
32321
+ if (0 < children.length) {
32322
+ return children[children.length - 1].text.toObject();
32323
+ }
32324
+ return {
32325
+ value: "",
32326
+ color: 0x000000,
32327
+ alpha: 1.0,
32328
+ family: "auto",
32329
+ size: 24,
32330
+ weight: EShapeTextWeight.NORMAL,
32331
+ align: this.align.toObject(),
32332
+ offset: this.offset.toObject(),
32333
+ style: EShapeTextStyle.NORMAL,
32334
+ outline: this.outline.toObject(),
32335
+ spacing: this.spacing.toObject(),
32336
+ direction: EShapeTextDirection.LEFT_TO_RIGHT,
32337
+ padding: this.padding.toObject(),
32338
+ clipping: false
32339
+ };
32340
+ };
32341
+ EShapeGroupTextEditor.prototype.serialize = function (manager) {
32342
+ return -1;
32343
+ };
32344
+ EShapeGroupTextEditor.prototype.deserialize = function (target, manager) {
32345
+ // DO NOTHING
32346
+ };
32347
+ return EShapeGroupTextEditor;
32348
+ }());
32349
+
32350
+ /*
32351
+ * Copyright (C) 2019 Toshiba Corporation
32352
+ * SPDX-License-Identifier: Apache-2.0
32353
+ */
32354
+ var EShapeGroupFillViewer = /** @class */ (function () {
32355
+ function EShapeGroupFillViewer() {
32356
+ // DO NOTHING
32357
+ }
32358
+ Object.defineProperty(EShapeGroupFillViewer.prototype, "enable", {
32359
+ get: function () {
32360
+ return true;
32361
+ },
32362
+ set: function (enable) {
32363
+ // DO NOTHING
32364
+ },
32365
+ enumerable: false,
32366
+ configurable: true
32367
+ });
32368
+ Object.defineProperty(EShapeGroupFillViewer.prototype, "color", {
32369
+ get: function () {
32370
+ return 0xffffff;
32371
+ },
32372
+ set: function (color) {
32373
+ // DO NOTHING
32374
+ },
32375
+ enumerable: false,
32376
+ configurable: true
32377
+ });
32378
+ Object.defineProperty(EShapeGroupFillViewer.prototype, "alpha", {
32379
+ get: function () {
32380
+ return 1.0;
32381
+ },
32382
+ set: function (alpha) {
32383
+ // DO NOTHING
32384
+ },
32385
+ enumerable: false,
32386
+ configurable: true
32387
+ });
32388
+ EShapeGroupFillViewer.prototype.copy = function (target) {
32389
+ // DO NOTHING
32390
+ };
32391
+ EShapeGroupFillViewer.prototype.set = function (enable, color, alpha) {
32392
+ // DO NOTHING
32393
+ };
32394
+ EShapeGroupFillViewer.prototype.clone = function () {
32395
+ return new EShapeGroupFillViewer();
32124
32396
  };
32125
32397
  EShapeGroupFillViewer.prototype.toObject = function () {
32126
32398
  return {
@@ -32163,7 +32435,7 @@
32163
32435
  EShapeTransforms.prepare = function (shape) {
32164
32436
  var editor = shape.editor || new EShapeEditor();
32165
32437
  shape.editor = editor;
32166
- // Ttransform
32438
+ // Transform
32167
32439
  shape.updateTransform();
32168
32440
  var parent = shape.parent;
32169
32441
  if (parent instanceof EShapeBase) {
@@ -32234,7 +32506,7 @@
32234
32506
  if (bx != null && by != null) {
32235
32507
  var sx = Math.sqrt(a * a + b * b);
32236
32508
  var sy = Math.sqrt(c * c + d * d);
32237
- shape.size.set(EShapeSizes.toNormalized(bx * sx), EShapeSizes.toNormalized(by * sy));
32509
+ shape.size.set(toSizeNormalized(bx * sx), toSizeNormalized(by * sy));
32238
32510
  }
32239
32511
  //
32240
32512
  shape.allowUploadedUpdate();
@@ -33258,949 +33530,6 @@
33258
33530
  return EShapeGroupViewer;
33259
33531
  }(EShapeBase));
33260
33532
 
33261
- /*
33262
- * Copyright (C) 2019 Toshiba Corporation
33263
- * SPDX-License-Identifier: Apache-2.0
33264
- */
33265
- var EShapeEmbeddedLayer = /** @class */ (function (_super) {
33266
- __extends(EShapeEmbeddedLayer, _super);
33267
- function EShapeEmbeddedLayer(name, isEditMode, type) {
33268
- if (type === void 0) { type = EShapeType.EMBEDDED_LAYER; }
33269
- var _this = _super.call(this, isEditMode, type) || this;
33270
- _this._name = name;
33271
- return _this;
33272
- }
33273
- Object.defineProperty(EShapeEmbeddedLayer.prototype, "name", {
33274
- get: function () {
33275
- return this._name;
33276
- },
33277
- enumerable: false,
33278
- configurable: true
33279
- });
33280
- EShapeEmbeddedLayer.prototype.newGroupFill = function () {
33281
- return new EShapeFillImpl(this, false, 0xffffff, 1);
33282
- };
33283
- EShapeEmbeddedLayer.prototype.isGroupSizeFittable = function () {
33284
- return false;
33285
- };
33286
- EShapeEmbeddedLayer.prototype.clone = function () {
33287
- var result = this.newClone().copy(this);
33288
- var children = this.children;
33289
- for (var i = 0, imax = children.length; i < imax; ++i) {
33290
- var clone = children[i].clone();
33291
- clone.parent = result;
33292
- result.children.push(clone);
33293
- }
33294
- result.onChildTransformChange();
33295
- result.toDirty();
33296
- result.size.init();
33297
- return result;
33298
- };
33299
- EShapeEmbeddedLayer.prototype.newClone = function () {
33300
- var constructor = this.constructor;
33301
- return new constructor(this._name, this._isEditMode, this.type);
33302
- };
33303
- EShapeEmbeddedLayer.prototype.serializeChildren = function (manager) {
33304
- return [];
33305
- };
33306
- EShapeEmbeddedLayer.prototype.serializeImage = function (manager) {
33307
- return -1;
33308
- };
33309
- EShapeEmbeddedLayer.prototype.serializeGradient = function (manager) {
33310
- return -1;
33311
- };
33312
- EShapeEmbeddedLayer.deserialize = function (serialized, manager, width, height) {
33313
- var _a, _b, _c;
33314
- var result = new EShapeEmbeddedLayer(this.deserializeName(serialized[0], manager), manager.isEditMode);
33315
- var visibility = serialized[1];
33316
- var visible = visibility == null || !!(visibility & 0x2);
33317
- if (!visible) {
33318
- result.visible = false;
33319
- result.state.add(EShapeLayerState.INVISIBLE);
33320
- }
33321
- var positionX = -0.5 * width + (serialized[2] || 0);
33322
- var positionY = -0.5 * height + (serialized[3] || 0);
33323
- result.transform.position.set(positionX, positionY);
33324
- var sizeX = (_a = serialized[4]) !== null && _a !== void 0 ? _a : width;
33325
- var sizeY = (_b = serialized[5]) !== null && _b !== void 0 ? _b : height;
33326
- result.size.set(sizeX, sizeY);
33327
- var fillId = serialized[6];
33328
- if (fillId != null) {
33329
- result.fill.deserialize(fillId, manager);
33330
- }
33331
- if (!manager.isEditMode) {
33332
- var state = (_c = serialized[7]) !== null && _c !== void 0 ? _c : 1;
33333
- var isInteractive = state & 0x1;
33334
- var isDraggable = state & 0x2;
33335
- var isPinchable = state & 0x4;
33336
- if (isDraggable || isPinchable) {
33337
- var gestureType = (isDraggable
33338
- ? EShapeActionValueMiscGestureType.DRAG
33339
- : EShapeActionValueMiscGestureType.NONE) |
33340
- (isPinchable
33341
- ? EShapeActionValueMiscGestureType.PINCH
33342
- : EShapeActionValueMiscGestureType.NONE);
33343
- result.action.add(new EShapeActionValueMiscLayerGesture("", gestureType));
33344
- }
33345
- if (isInteractive || isDraggable || isPinchable) {
33346
- result.interactive = true;
33347
- }
33348
- }
33349
- return result;
33350
- };
33351
- EShapeEmbeddedLayer.deserializeName = function (target, manager) {
33352
- if (isString(target)) {
33353
- return target;
33354
- }
33355
- else {
33356
- var resources = manager.resources;
33357
- if (0 <= target && target <= resources.length) {
33358
- return resources[target];
33359
- }
33360
- return "";
33361
- }
33362
- };
33363
- return EShapeEmbeddedLayer;
33364
- }(EShapeGroupViewer));
33365
-
33366
- /*
33367
- * Copyright (C) 2019 Toshiba Corporation
33368
- * SPDX-License-Identifier: Apache-2.0
33369
- */
33370
- var EShapeEmbeddedLayerContainer = /** @class */ (function () {
33371
- function EShapeEmbeddedLayerContainer(width, height, isEditMode) {
33372
- this.children = [];
33373
- this._width = width;
33374
- this._height = height;
33375
- this._isEditMode = isEditMode;
33376
- }
33377
- EShapeEmbeddedLayerContainer.prototype.hasConnectors = function (shapes) {
33378
- for (var i = 0, imax = shapes.length; i < imax; ++i) {
33379
- var shape = shapes[i];
33380
- if (shape.type === EShapeType.CONNECTOR_LINE) {
33381
- return true;
33382
- }
33383
- var children = shape.children;
33384
- if (0 < children.length) {
33385
- if (this.hasConnectors(children)) {
33386
- return true;
33387
- }
33388
- }
33389
- }
33390
- return false;
33391
- };
33392
- EShapeEmbeddedLayerContainer.prototype.newHasConnectors = function () {
33393
- var result = new Map();
33394
- var layers = this.children;
33395
- for (var i = 0, imax = layers.length; i < imax; ++i) {
33396
- var layer = layers[i];
33397
- result.set(layer, this.hasConnectors(layer.children));
33398
- }
33399
- return result;
33400
- };
33401
- EShapeEmbeddedLayerContainer.prototype.copyTo = function (destination) {
33402
- var _a;
33403
- var hasConnectors = ((_a = this._hasConnectors) !== null && _a !== void 0 ? _a : (this._hasConnectors = this.newHasConnectors()));
33404
- var layers = this.children;
33405
- var children = destination.children;
33406
- for (var i = 0, imax = layers.length; i < imax; ++i) {
33407
- var layer = layers[i];
33408
- var clone = layer.clone();
33409
- clone.parent = destination;
33410
- children.push(clone);
33411
- if (hasConnectors.get(layer)) {
33412
- EShapeConnectors.move(layer, clone);
33413
- }
33414
- }
33415
- destination.onChildTransformChange();
33416
- destination.toDirty();
33417
- destination.onAttach();
33418
- };
33419
- EShapeEmbeddedLayerContainer.prototype.deserialize = function (serializedLayers, manager) {
33420
- var serializedLayersLength = serializedLayers.length;
33421
- if (0 < serializedLayersLength) {
33422
- var width = this._width;
33423
- var height = this._height;
33424
- for (var i = 0; i < serializedLayersLength; ++i) {
33425
- this.children.push(EShapeEmbeddedLayer.deserialize(serializedLayers[i], manager, width, height));
33426
- }
33427
- }
33428
- };
33429
- return EShapeEmbeddedLayerContainer;
33430
- }());
33431
-
33432
- /*
33433
- * Copyright (C) 2019 Toshiba Corporation
33434
- * SPDX-License-Identifier: Apache-2.0
33435
- */
33436
- var DDiagrams = /** @class */ (function () {
33437
- function DDiagrams() {
33438
- }
33439
- DDiagrams.toSimple = function (serialized) {
33440
- return {
33441
- version: serialized.version,
33442
- id: serialized.id,
33443
- name: serialized.name,
33444
- thumbnail: serialized.thumbnail,
33445
- data: JSON.stringify({
33446
- width: serialized.width,
33447
- height: serialized.height,
33448
- background: serialized.background,
33449
- tile: serialized.tile,
33450
- resources: serialized.resources,
33451
- data: serialized.data || serialized.tags,
33452
- pieces: serialized.pieces,
33453
- layers: serialized.layers,
33454
- items: serialized.items,
33455
- snap: serialized.snap
33456
- })
33457
- };
33458
- };
33459
- DDiagrams.toSerialized = function (target) {
33460
- if (!("items" in target)) {
33461
- var data = JSON.parse(target.data);
33462
- var result = {
33463
- version: target.version,
33464
- id: target.id,
33465
- name: target.name,
33466
- width: data.width,
33467
- height: data.height,
33468
- background: data.background,
33469
- tile: data.tile,
33470
- resources: data.resources,
33471
- data: data.data || data.tags,
33472
- pieces: data.pieces,
33473
- layers: data.layers,
33474
- items: data.items,
33475
- snap: data.snap,
33476
- thumbnail: target.thumbnail
33477
- };
33478
- if (result.data == null) {
33479
- var tags = target.tags;
33480
- if (tags != null) {
33481
- result.data = JSON.parse(tags);
33482
- }
33483
- }
33484
- if (result.pieces == null) {
33485
- var pieces = target.pieces;
33486
- if (pieces != null) {
33487
- result.pieces = JSON.parse(pieces);
33488
- }
33489
- }
33490
- return result;
33491
- }
33492
- return target;
33493
- };
33494
- DDiagrams.newLayer = function (serialized, container, manager) {
33495
- // Layers
33496
- container.deserialize(serialized.layers, manager);
33497
- // Items
33498
- var serializedItems = serialized.items;
33499
- var shapePromises = EShapeDeserializer.deserializeAll(serializedItems, manager);
33500
- if (shapePromises != null) {
33501
- return shapePromises.then(function (shapes) {
33502
- var layers = container.children;
33503
- for (var i = 0, imax = shapes.length; i < imax; ++i) {
33504
- var serializedItem = serializedItems[i];
33505
- var shape = shapes[i];
33506
- var layer = layers[serializedItem[16]];
33507
- if (layer != null) {
33508
- shape.parent = layer;
33509
- shape.uploaded = undefined;
33510
- layer.children.push(shape);
33511
- }
33512
- }
33513
- for (var i = 0, imax = layers.length; i < imax; ++i) {
33514
- var layer = layers[i];
33515
- layer.onChildTransformChange();
33516
- layer.toDirty();
33517
- var children = layer.children;
33518
- for (var j = 0, jmax = children.length; j < jmax; ++j) {
33519
- children[j].onAttach();
33520
- }
33521
- }
33522
- return shapes;
33523
- });
33524
- }
33525
- else {
33526
- return Promise.resolve([]);
33527
- }
33528
- };
33529
- DDiagrams.toPieceData = function (controller, pieces, isEditMode) {
33530
- var result = new Map();
33531
- var onFulfilled = function () {
33532
- return result;
33533
- };
33534
- return this.toPieceData_(controller, pieces, result, isEditMode).then(onFulfilled, onFulfilled);
33535
- };
33536
- DDiagrams.toPieceData_ = function (controller, pieces, pieceData, isEditMode) {
33537
- var _this = this;
33538
- var promises = [];
33539
- if (pieces && 0 < pieces.length && controller) {
33540
- var _loop_1 = function (i, imax) {
33541
- var piece = pieces[i];
33542
- if (!pieceData.has(piece)) {
33543
- pieceData.set(piece, null);
33544
- promises.push(controller.piece.getByName(piece).then(function (found) {
33545
- return _this.toPieceData__(controller, piece, found, isEditMode, pieceData);
33546
- }, function () {
33547
- return null;
33548
- }));
33549
- }
33550
- };
33551
- for (var i = 0, imax = pieces.length; i < imax; ++i) {
33552
- _loop_1(i, imax);
33553
- }
33554
- }
33555
- return Promise.all(promises);
33556
- };
33557
- DDiagrams.toPieceData__ = function (controller, name, serializedOrSimple, isEditMode, pieceData) {
33558
- var _this = this;
33559
- var serialized = this.toSerialized(serializedOrSimple);
33560
- var width = serialized.width;
33561
- var height = serialized.height;
33562
- var container = new EShapeEmbeddedLayerContainer(width, height, isEditMode);
33563
- pieceData.set(name, new EShapeEmbeddedDatum(name, width, height, container));
33564
- var pieces = serialized.pieces;
33565
- return this.toPieceData_(controller, pieces, pieceData, isEditMode).then(function () {
33566
- return _this.newLayer(serialized, container, new EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode));
33567
- });
33568
- };
33569
- return DDiagrams;
33570
- }());
33571
-
33572
- /*
33573
- * Copyright (C) 2019 Toshiba Corporation
33574
- * SPDX-License-Identifier: Apache-2.0
33575
- */
33576
- var EShapeGroupTextAlignEditor = /** @class */ (function () {
33577
- function EShapeGroupTextAlignEditor(parent) {
33578
- this._parent = parent;
33579
- }
33580
- Object.defineProperty(EShapeGroupTextAlignEditor.prototype, "horizontal", {
33581
- get: function () {
33582
- var children = this._parent.children;
33583
- if (0 < children.length) {
33584
- return children[children.length - 1].text.align.horizontal;
33585
- }
33586
- return EShapeTextAlignHorizontal.CENTER;
33587
- },
33588
- set: function (horizontal) {
33589
- var children = this._parent.children;
33590
- for (var i = 0, imax = children.length; i < imax; ++i) {
33591
- children[i].text.align.horizontal = horizontal;
33592
- }
33593
- },
33594
- enumerable: false,
33595
- configurable: true
33596
- });
33597
- Object.defineProperty(EShapeGroupTextAlignEditor.prototype, "vertical", {
33598
- get: function () {
33599
- var children = this._parent.children;
33600
- if (0 < children.length) {
33601
- return children[children.length - 1].text.align.vertical;
33602
- }
33603
- return EShapeTextAlignVertical.MIDDLE;
33604
- },
33605
- set: function (vertical) {
33606
- var children = this._parent.children;
33607
- for (var i = 0, imax = children.length; i < imax; ++i) {
33608
- children[i].text.align.vertical = vertical;
33609
- }
33610
- },
33611
- enumerable: false,
33612
- configurable: true
33613
- });
33614
- EShapeGroupTextAlignEditor.prototype.copy = function (target) {
33615
- var children = this._parent.children;
33616
- for (var i = 0, imax = children.length; i < imax; ++i) {
33617
- children[i].text.align.copy(target);
33618
- }
33619
- };
33620
- EShapeGroupTextAlignEditor.prototype.set = function (horizontal, vertical) {
33621
- var children = this._parent.children;
33622
- for (var i = 0, imax = children.length; i < imax; ++i) {
33623
- children[i].text.align.set(horizontal, vertical);
33624
- }
33625
- };
33626
- EShapeGroupTextAlignEditor.prototype.toObject = function () {
33627
- var children = this._parent.children;
33628
- if (0 < children.length) {
33629
- return children[children.length - 1].text.align.toObject();
33630
- }
33631
- return {
33632
- horizontal: EShapeTextAlignHorizontal.CENTER,
33633
- vertical: EShapeTextAlignVertical.MIDDLE
33634
- };
33635
- };
33636
- EShapeGroupTextAlignEditor.prototype.serialize = function (manager) {
33637
- return -1;
33638
- };
33639
- EShapeGroupTextAlignEditor.prototype.deserialize = function (target, manager) {
33640
- // DO NOTHING
33641
- };
33642
- return EShapeGroupTextAlignEditor;
33643
- }());
33644
-
33645
- /*
33646
- * Copyright (C) 2019 Toshiba Corporation
33647
- * SPDX-License-Identifier: Apache-2.0
33648
- */
33649
- var EShapeGroupTextOffsetEditor = /** @class */ (function () {
33650
- function EShapeGroupTextOffsetEditor(parent) {
33651
- this._parent = parent;
33652
- }
33653
- Object.defineProperty(EShapeGroupTextOffsetEditor.prototype, "horizontal", {
33654
- get: function () {
33655
- var children = this._parent.children;
33656
- if (0 < children.length) {
33657
- return children[children.length - 1].text.offset.horizontal;
33658
- }
33659
- return 0;
33660
- },
33661
- set: function (horizontal) {
33662
- var children = this._parent.children;
33663
- for (var i = 0, imax = children.length; i < imax; ++i) {
33664
- children[i].text.offset.horizontal = horizontal;
33665
- }
33666
- },
33667
- enumerable: false,
33668
- configurable: true
33669
- });
33670
- Object.defineProperty(EShapeGroupTextOffsetEditor.prototype, "vertical", {
33671
- get: function () {
33672
- var children = this._parent.children;
33673
- if (0 < children.length) {
33674
- return children[children.length - 1].text.offset.vertical;
33675
- }
33676
- return 0;
33677
- },
33678
- set: function (vertical) {
33679
- var children = this._parent.children;
33680
- for (var i = 0, imax = children.length; i < imax; ++i) {
33681
- children[i].text.offset.vertical = vertical;
33682
- }
33683
- },
33684
- enumerable: false,
33685
- configurable: true
33686
- });
33687
- EShapeGroupTextOffsetEditor.prototype.copy = function (target) {
33688
- var children = this._parent.children;
33689
- for (var i = 0, imax = children.length; i < imax; ++i) {
33690
- children[i].text.offset.copy(target);
33691
- }
33692
- };
33693
- EShapeGroupTextOffsetEditor.prototype.set = function (horizontal, vertical) {
33694
- var children = this._parent.children;
33695
- for (var i = 0, imax = children.length; i < imax; ++i) {
33696
- children[i].text.offset.set(horizontal, vertical);
33697
- }
33698
- };
33699
- EShapeGroupTextOffsetEditor.prototype.toObject = function () {
33700
- var children = this._parent.children;
33701
- if (0 < children.length) {
33702
- return children[children.length - 1].text.offset.toObject();
33703
- }
33704
- return {
33705
- horizontal: 0,
33706
- vertical: 0
33707
- };
33708
- };
33709
- EShapeGroupTextOffsetEditor.prototype.serialize = function (manager) {
33710
- return -1;
33711
- };
33712
- EShapeGroupTextOffsetEditor.prototype.deserialize = function (target, manager) {
33713
- // DO NOTHING
33714
- };
33715
- return EShapeGroupTextOffsetEditor;
33716
- }());
33717
-
33718
- /*
33719
- * Copyright (C) 2019 Toshiba Corporation
33720
- * SPDX-License-Identifier: Apache-2.0
33721
- */
33722
- var EShapeGroupTextOutlineEditor = /** @class */ (function () {
33723
- function EShapeGroupTextOutlineEditor(parent) {
33724
- this._parent = parent;
33725
- }
33726
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "enable", {
33727
- get: function () {
33728
- var children = this._parent.children;
33729
- if (0 < children.length) {
33730
- return children[children.length - 1].text.outline.enable;
33731
- }
33732
- return false;
33733
- },
33734
- set: function (enable) {
33735
- var children = this._parent.children;
33736
- for (var i = 0, imax = children.length; i < imax; ++i) {
33737
- children[i].text.outline.enable = enable;
33738
- }
33739
- },
33740
- enumerable: false,
33741
- configurable: true
33742
- });
33743
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "color", {
33744
- get: function () {
33745
- var children = this._parent.children;
33746
- if (0 < children.length) {
33747
- return children[children.length - 1].text.outline.color;
33748
- }
33749
- return 0xffffff;
33750
- },
33751
- set: function (color) {
33752
- var children = this._parent.children;
33753
- for (var i = 0, imax = children.length; i < imax; ++i) {
33754
- children[i].text.outline.color = color;
33755
- }
33756
- },
33757
- enumerable: false,
33758
- configurable: true
33759
- });
33760
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "alpha", {
33761
- get: function () {
33762
- var children = this._parent.children;
33763
- if (0 < children.length) {
33764
- return children[children.length - 1].text.outline.alpha;
33765
- }
33766
- return 1.0;
33767
- },
33768
- set: function (alpha) {
33769
- var children = this._parent.children;
33770
- for (var i = 0, imax = children.length; i < imax; ++i) {
33771
- children[i].text.outline.alpha = alpha;
33772
- }
33773
- },
33774
- enumerable: false,
33775
- configurable: true
33776
- });
33777
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "width", {
33778
- get: function () {
33779
- var children = this._parent.children;
33780
- if (0 < children.length) {
33781
- return children[children.length - 1].text.outline.width;
33782
- }
33783
- return 1.0;
33784
- },
33785
- set: function (width) {
33786
- var children = this._parent.children;
33787
- for (var i = 0, imax = children.length; i < imax; ++i) {
33788
- children[i].text.outline.width = width;
33789
- }
33790
- },
33791
- enumerable: false,
33792
- configurable: true
33793
- });
33794
- EShapeGroupTextOutlineEditor.prototype.copy = function (target) {
33795
- var children = this._parent.children;
33796
- for (var i = 0, imax = children.length; i < imax; ++i) {
33797
- children[i].text.outline.copy(target);
33798
- }
33799
- };
33800
- EShapeGroupTextOutlineEditor.prototype.set = function (enable, color, alpha, width) {
33801
- var children = this._parent.children;
33802
- for (var i = 0, imax = children.length; i < imax; ++i) {
33803
- children[i].text.outline.set(enable, color, alpha, width);
33804
- }
33805
- };
33806
- EShapeGroupTextOutlineEditor.prototype.clone = function () {
33807
- return new EShapeGroupTextOutlineEditor(this._parent);
33808
- };
33809
- EShapeGroupTextOutlineEditor.prototype.toObject = function () {
33810
- var children = this._parent.children;
33811
- if (0 < children.length) {
33812
- return children[children.length - 1].text.outline.toObject();
33813
- }
33814
- return {
33815
- enable: false,
33816
- color: 0xffffff,
33817
- alpha: 1.0,
33818
- width: 1.0
33819
- };
33820
- };
33821
- EShapeGroupTextOutlineEditor.prototype.serialize = function (manager) {
33822
- return -1;
33823
- };
33824
- EShapeGroupTextOutlineEditor.prototype.deserialize = function (target, manager) {
33825
- //
33826
- };
33827
- return EShapeGroupTextOutlineEditor;
33828
- }());
33829
-
33830
- /*
33831
- * Copyright (C) 2019 Toshiba Corporation
33832
- * SPDX-License-Identifier: Apache-2.0
33833
- */
33834
- var EShapeGroupTextPaddingEditor = /** @class */ (function () {
33835
- function EShapeGroupTextPaddingEditor(parent) {
33836
- this._parent = parent;
33837
- }
33838
- Object.defineProperty(EShapeGroupTextPaddingEditor.prototype, "horizontal", {
33839
- get: function () {
33840
- var children = this._parent.children;
33841
- if (0 < children.length) {
33842
- return children[children.length - 1].text.padding.horizontal;
33843
- }
33844
- return 0;
33845
- },
33846
- set: function (horizontal) {
33847
- var children = this._parent.children;
33848
- for (var i = 0, imax = children.length; i < imax; ++i) {
33849
- children[i].text.padding.horizontal = horizontal;
33850
- }
33851
- },
33852
- enumerable: false,
33853
- configurable: true
33854
- });
33855
- Object.defineProperty(EShapeGroupTextPaddingEditor.prototype, "vertical", {
33856
- get: function () {
33857
- var children = this._parent.children;
33858
- if (0 < children.length) {
33859
- return children[children.length - 1].text.padding.vertical;
33860
- }
33861
- return 0;
33862
- },
33863
- set: function (vertical) {
33864
- var children = this._parent.children;
33865
- for (var i = 0, imax = children.length; i < imax; ++i) {
33866
- children[i].text.padding.vertical = vertical;
33867
- }
33868
- },
33869
- enumerable: false,
33870
- configurable: true
33871
- });
33872
- EShapeGroupTextPaddingEditor.prototype.copy = function (target) {
33873
- var children = this._parent.children;
33874
- for (var i = 0, imax = children.length; i < imax; ++i) {
33875
- children[i].text.padding.copy(target);
33876
- }
33877
- };
33878
- EShapeGroupTextPaddingEditor.prototype.set = function (horizontal, vertical) {
33879
- var children = this._parent.children;
33880
- for (var i = 0, imax = children.length; i < imax; ++i) {
33881
- children[i].text.padding.set(horizontal, vertical);
33882
- }
33883
- };
33884
- EShapeGroupTextPaddingEditor.prototype.toObject = function () {
33885
- var children = this._parent.children;
33886
- if (0 < children.length) {
33887
- return children[children.length - 1].text.padding.toObject();
33888
- }
33889
- return {
33890
- horizontal: 0,
33891
- vertical: 0
33892
- };
33893
- };
33894
- EShapeGroupTextPaddingEditor.prototype.serialize = function (manager) {
33895
- return -1;
33896
- };
33897
- EShapeGroupTextPaddingEditor.prototype.deserialize = function (target, manager) {
33898
- // DO NOTHING
33899
- };
33900
- return EShapeGroupTextPaddingEditor;
33901
- }());
33902
-
33903
- /*
33904
- * Copyright (C) 2019 Toshiba Corporation
33905
- * SPDX-License-Identifier: Apache-2.0
33906
- */
33907
- var EShapeGroupTextSpacingEditor = /** @class */ (function () {
33908
- function EShapeGroupTextSpacingEditor(parent) {
33909
- this._parent = parent;
33910
- }
33911
- Object.defineProperty(EShapeGroupTextSpacingEditor.prototype, "horizontal", {
33912
- get: function () {
33913
- var children = this._parent.children;
33914
- if (0 < children.length) {
33915
- return children[children.length - 1].text.spacing.horizontal;
33916
- }
33917
- return 0;
33918
- },
33919
- set: function (horizontal) {
33920
- var children = this._parent.children;
33921
- for (var i = 0, imax = children.length; i < imax; ++i) {
33922
- children[i].text.spacing.horizontal = horizontal;
33923
- }
33924
- },
33925
- enumerable: false,
33926
- configurable: true
33927
- });
33928
- Object.defineProperty(EShapeGroupTextSpacingEditor.prototype, "vertical", {
33929
- get: function () {
33930
- var children = this._parent.children;
33931
- if (0 < children.length) {
33932
- return children[children.length - 1].text.spacing.vertical;
33933
- }
33934
- return 0;
33935
- },
33936
- set: function (vertical) {
33937
- var children = this._parent.children;
33938
- for (var i = 0, imax = children.length; i < imax; ++i) {
33939
- children[i].text.spacing.vertical = vertical;
33940
- }
33941
- },
33942
- enumerable: false,
33943
- configurable: true
33944
- });
33945
- EShapeGroupTextSpacingEditor.prototype.copy = function (target) {
33946
- var children = this._parent.children;
33947
- for (var i = 0, imax = children.length; i < imax; ++i) {
33948
- children[i].text.spacing.copy(target);
33949
- }
33950
- };
33951
- EShapeGroupTextSpacingEditor.prototype.set = function (horizontal, vertical) {
33952
- var children = this._parent.children;
33953
- for (var i = 0, imax = children.length; i < imax; ++i) {
33954
- children[i].text.spacing.set(horizontal, vertical);
33955
- }
33956
- };
33957
- EShapeGroupTextSpacingEditor.prototype.toObject = function () {
33958
- var children = this._parent.children;
33959
- if (0 < children.length) {
33960
- return children[children.length - 1].text.spacing.toObject();
33961
- }
33962
- return {
33963
- horizontal: 0,
33964
- vertical: 0
33965
- };
33966
- };
33967
- EShapeGroupTextSpacingEditor.prototype.serialize = function (manager) {
33968
- return -1;
33969
- };
33970
- EShapeGroupTextSpacingEditor.prototype.deserialize = function (target, manager) {
33971
- // DO NOTHING
33972
- };
33973
- return EShapeGroupTextSpacingEditor;
33974
- }());
33975
-
33976
- /*
33977
- * Copyright (C) 2019 Toshiba Corporation
33978
- * SPDX-License-Identifier: Apache-2.0
33979
- */
33980
- var EShapeGroupTextEditor = /** @class */ (function () {
33981
- function EShapeGroupTextEditor(parent) {
33982
- this._parent = parent;
33983
- this.align = new EShapeGroupTextAlignEditor(parent);
33984
- this.offset = new EShapeGroupTextOffsetEditor(parent);
33985
- this.outline = new EShapeGroupTextOutlineEditor(parent);
33986
- this.spacing = new EShapeGroupTextSpacingEditor(parent);
33987
- this.padding = new EShapeGroupTextPaddingEditor(parent);
33988
- }
33989
- Object.defineProperty(EShapeGroupTextEditor.prototype, "enable", {
33990
- get: function () {
33991
- var children = this._parent.children;
33992
- if (0 < children.length) {
33993
- return children[children.length - 1].text.enable;
33994
- }
33995
- return true;
33996
- },
33997
- set: function (enable) {
33998
- var children = this._parent.children;
33999
- for (var i = 0, imax = children.length; i < imax; ++i) {
34000
- children[i].text.enable = enable;
34001
- }
34002
- },
34003
- enumerable: false,
34004
- configurable: true
34005
- });
34006
- Object.defineProperty(EShapeGroupTextEditor.prototype, "value", {
34007
- get: function () {
34008
- var children = this._parent.children;
34009
- if (0 < children.length) {
34010
- return children[children.length - 1].text.value;
34011
- }
34012
- return "";
34013
- },
34014
- set: function (value) {
34015
- var children = this._parent.children;
34016
- for (var i = 0, imax = children.length; i < imax; ++i) {
34017
- children[i].text.value = value;
34018
- }
34019
- },
34020
- enumerable: false,
34021
- configurable: true
34022
- });
34023
- Object.defineProperty(EShapeGroupTextEditor.prototype, "color", {
34024
- get: function () {
34025
- var children = this._parent.children;
34026
- if (0 < children.length) {
34027
- return children[children.length - 1].text.color;
34028
- }
34029
- return 0x000000;
34030
- },
34031
- set: function (color) {
34032
- var children = this._parent.children;
34033
- for (var i = 0, imax = children.length; i < imax; ++i) {
34034
- children[i].text.color = color;
34035
- }
34036
- },
34037
- enumerable: false,
34038
- configurable: true
34039
- });
34040
- Object.defineProperty(EShapeGroupTextEditor.prototype, "alpha", {
34041
- get: function () {
34042
- var children = this._parent.children;
34043
- if (0 < children.length) {
34044
- return children[children.length - 1].text.alpha;
34045
- }
34046
- return 1.0;
34047
- },
34048
- set: function (alpha) {
34049
- var children = this._parent.children;
34050
- for (var i = 0, imax = children.length; i < imax; ++i) {
34051
- children[i].text.alpha = alpha;
34052
- }
34053
- },
34054
- enumerable: false,
34055
- configurable: true
34056
- });
34057
- Object.defineProperty(EShapeGroupTextEditor.prototype, "family", {
34058
- get: function () {
34059
- var children = this._parent.children;
34060
- if (0 < children.length) {
34061
- return children[children.length - 1].text.family;
34062
- }
34063
- return "auto";
34064
- },
34065
- set: function (family) {
34066
- var children = this._parent.children;
34067
- for (var i = 0, imax = children.length; i < imax; ++i) {
34068
- children[i].text.family = family;
34069
- }
34070
- },
34071
- enumerable: false,
34072
- configurable: true
34073
- });
34074
- Object.defineProperty(EShapeGroupTextEditor.prototype, "size", {
34075
- get: function () {
34076
- var children = this._parent.children;
34077
- if (0 < children.length) {
34078
- return children[children.length - 1].text.size;
34079
- }
34080
- return 24;
34081
- },
34082
- set: function (size) {
34083
- var children = this._parent.children;
34084
- for (var i = 0, imax = children.length; i < imax; ++i) {
34085
- children[i].text.size = size;
34086
- }
34087
- },
34088
- enumerable: false,
34089
- configurable: true
34090
- });
34091
- Object.defineProperty(EShapeGroupTextEditor.prototype, "weight", {
34092
- get: function () {
34093
- var children = this._parent.children;
34094
- if (0 < children.length) {
34095
- return children[children.length - 1].text.weight;
34096
- }
34097
- return EShapeTextWeight.NORMAL;
34098
- },
34099
- set: function (weight) {
34100
- var children = this._parent.children;
34101
- for (var i = 0, imax = children.length; i < imax; ++i) {
34102
- children[i].text.weight = weight;
34103
- }
34104
- },
34105
- enumerable: false,
34106
- configurable: true
34107
- });
34108
- Object.defineProperty(EShapeGroupTextEditor.prototype, "style", {
34109
- get: function () {
34110
- var children = this._parent.children;
34111
- if (0 < children.length) {
34112
- return children[children.length - 1].text.style;
34113
- }
34114
- return EShapeTextStyle.NORMAL;
34115
- },
34116
- set: function (style) {
34117
- var children = this._parent.children;
34118
- for (var i = 0, imax = children.length; i < imax; ++i) {
34119
- children[i].text.style = style;
34120
- }
34121
- },
34122
- enumerable: false,
34123
- configurable: true
34124
- });
34125
- Object.defineProperty(EShapeGroupTextEditor.prototype, "direction", {
34126
- get: function () {
34127
- var children = this._parent.children;
34128
- if (0 < children.length) {
34129
- return children[children.length - 1].text.direction;
34130
- }
34131
- return 0;
34132
- },
34133
- set: function (direction) {
34134
- var children = this._parent.children;
34135
- for (var i = 0, imax = children.length; i < imax; ++i) {
34136
- children[i].text.direction = direction;
34137
- }
34138
- },
34139
- enumerable: false,
34140
- configurable: true
34141
- });
34142
- Object.defineProperty(EShapeGroupTextEditor.prototype, "clipping", {
34143
- get: function () {
34144
- var children = this._parent.children;
34145
- if (0 < children.length) {
34146
- return children[children.length - 1].text.clipping;
34147
- }
34148
- return false;
34149
- },
34150
- set: function (clipping) {
34151
- var children = this._parent.children;
34152
- for (var i = 0, imax = children.length; i < imax; ++i) {
34153
- children[i].text.clipping = clipping;
34154
- }
34155
- },
34156
- enumerable: false,
34157
- configurable: true
34158
- });
34159
- EShapeGroupTextEditor.prototype.copy = function (target) {
34160
- var children = this._parent.children;
34161
- for (var i = 0, imax = children.length; i < imax; ++i) {
34162
- children[i].text.copy(target);
34163
- }
34164
- return this;
34165
- };
34166
- EShapeGroupTextEditor.prototype.set = function (value, color, alpha, family, size, weight, style, direction) {
34167
- var children = this._parent.children;
34168
- for (var i = 0, imax = children.length; i < imax; ++i) {
34169
- children[i].text.set(value, color, alpha, family, size, weight, style, direction);
34170
- }
34171
- return this;
34172
- };
34173
- EShapeGroupTextEditor.prototype.toObject = function () {
34174
- var children = this._parent.children;
34175
- if (0 < children.length) {
34176
- return children[children.length - 1].text.toObject();
34177
- }
34178
- return {
34179
- value: "",
34180
- color: 0x000000,
34181
- alpha: 1.0,
34182
- family: "auto",
34183
- size: 24,
34184
- weight: EShapeTextWeight.NORMAL,
34185
- align: this.align.toObject(),
34186
- offset: this.offset.toObject(),
34187
- style: EShapeTextStyle.NORMAL,
34188
- outline: this.outline.toObject(),
34189
- spacing: this.spacing.toObject(),
34190
- direction: EShapeTextDirection.LEFT_TO_RIGHT,
34191
- padding: this.padding.toObject(),
34192
- clipping: false
34193
- };
34194
- };
34195
- EShapeGroupTextEditor.prototype.serialize = function (manager) {
34196
- return -1;
34197
- };
34198
- EShapeGroupTextEditor.prototype.deserialize = function (target, manager) {
34199
- // DO NOTHING
34200
- };
34201
- return EShapeGroupTextEditor;
34202
- }());
34203
-
34204
33533
  var EShapeEmbedded = /** @class */ (function (_super) {
34205
33534
  __extends(EShapeEmbedded, _super);
34206
33535
  function EShapeEmbedded(name, isEditMode, type) {
@@ -34261,53 +33590,22 @@
34261
33590
  return EShapeEmbedded;
34262
33591
  }(EShapeGroupViewer));
34263
33592
 
34264
- var EShapeEmbeddeds = /** @class */ (function () {
34265
- function EShapeEmbeddeds() {
34266
- }
34267
- EShapeEmbeddeds.from = function (serializedOrSimple, controller, isEditMode) {
34268
- var _this = this;
34269
- var serialized = DDiagrams.toSerialized(serializedOrSimple);
34270
- var pieces = serialized.pieces;
34271
- return DDiagrams.toPieceData(controller, pieces, isEditMode).then(function (pieceData) {
34272
- return _this.from_(serialized, isEditMode, pieces, pieceData);
34273
- });
34274
- };
34275
- EShapeEmbeddeds.from_ = function (serialized, isEditMode, pieces, pieceData) {
34276
- var _this = this;
34277
- var width = serialized.width;
34278
- var height = serialized.height;
34279
- var container = new EShapeEmbeddedLayerContainer(width, height, isEditMode);
34280
- var manager = new EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode);
34281
- return DDiagrams.newLayer(serialized, container, manager).then(function () {
34282
- return _this.create(serialized.name, width, height, container, manager);
34283
- });
34284
- };
34285
- EShapeEmbeddeds.deserialize = function (name, width, height, container, manager, item) {
34286
- var shape = new EShapeEmbedded(name, manager.isEditMode);
34287
- var result = EShapeDeserializer.deserialize(item, manager, shape);
34288
- var shapeSize = shape.size;
34289
- var sizeX = shapeSize.x;
34290
- var sizeY = shapeSize.y;
34291
- shape.size.set(width, height);
34292
- container.copyTo(shape);
34293
- shape.size.init();
34294
- shape.size.set(sizeX, sizeY);
34295
- return result;
34296
- };
34297
- EShapeEmbeddeds.create = function (name, width, height, container, manager) {
34298
- var shape = new EShapeEmbedded(name, manager.isEditMode);
34299
- shape.size.set(width, height);
34300
- container.copyTo(shape);
34301
- shape.size.init();
34302
- return shape;
34303
- };
34304
- return EShapeEmbeddeds;
34305
- }());
34306
-
34307
33593
  /*
34308
33594
  * Copyright (C) 2019 Toshiba Corporation
34309
33595
  * SPDX-License-Identifier: Apache-2.0
34310
33596
  */
33597
+ var create = function (name, width, height, container, manager, item) {
33598
+ var shape = new EShapeEmbedded(name, manager.isEditMode);
33599
+ var result = deserializeBase(item, manager, shape);
33600
+ var shapeSize = shape.size;
33601
+ var sizeX = shapeSize.x;
33602
+ var sizeY = shapeSize.y;
33603
+ shape.size.set(width, height);
33604
+ container.copyTo(shape);
33605
+ shape.size.init();
33606
+ shape.size.set(sizeX, sizeY);
33607
+ return result;
33608
+ };
34311
33609
  var deserializeEmbedded = function (item, manager) {
34312
33610
  var pieces = manager.pieces;
34313
33611
  var pieceId = item[15];
@@ -34317,7 +33615,7 @@
34317
33615
  var piece = pieces[pieceId];
34318
33616
  var pieceDatum = pieceData.get(piece);
34319
33617
  if (pieceDatum) {
34320
- return EShapeEmbeddeds.deserialize(piece, pieceDatum.width, pieceDatum.height, pieceDatum.layer, manager, item);
33618
+ return create(piece, pieceDatum.width, pieceDatum.height, pieceDatum.layer, manager, item);
34321
33619
  }
34322
33620
  }
34323
33621
  }
@@ -35006,9 +34304,9 @@
35006
34304
  * Copyright (C) 2019 Toshiba Corporation
35007
34305
  * SPDX-License-Identifier: Apache-2.0
35008
34306
  */
35009
- var deserializeGroup = function (item, manager) {
35010
- var shape = new EShapeGroup(manager.isEditMode);
35011
- var result = EShapeDeserializer.deserialize(item, manager, shape);
34307
+ var deserializeGroup = function (item, manager, shape) {
34308
+ shape = shape || new EShapeGroup(manager.isEditMode);
34309
+ var result = deserializeBase(item, manager, shape);
35012
34310
  shape.size.init();
35013
34311
  return result;
35014
34312
  };
@@ -35142,9 +34440,9 @@
35142
34440
  * Copyright (C) 2019 Toshiba Corporation
35143
34441
  * SPDX-License-Identifier: Apache-2.0
35144
34442
  */
35145
- var deserializeGroupShadowed = function (item, manager) {
35146
- var shape = new EShapeGroupShadowed(manager.isEditMode);
35147
- var result = EShapeDeserializer.deserialize(item, manager, shape);
34443
+ var deserializeGroupShadowed = function (item, manager, shape) {
34444
+ shape = shape || new EShapeGroupShadowed(manager.isEditMode);
34445
+ var result = deserializeBase(item, manager, shape);
35148
34446
  shape.size.init();
35149
34447
  return result;
35150
34448
  };
@@ -35297,8 +34595,8 @@
35297
34595
  * Copyright (C) 2019 Toshiba Corporation
35298
34596
  * SPDX-License-Identifier: Apache-2.0
35299
34597
  */
35300
- var deserializeImage = function (item, manager) {
35301
- return EShapeDeserializer.deserialize(item, manager, new EShapeImage());
34598
+ var deserializeImage = function (item, manager, shape) {
34599
+ return deserializeBase(item, manager, shape || new EShapeImage());
35302
34600
  };
35303
34601
 
35304
34602
  /*
@@ -35606,8 +34904,8 @@
35606
34904
  * Copyright (C) 2019 Toshiba Corporation
35607
34905
  * SPDX-License-Identifier: Apache-2.0
35608
34906
  */
35609
- var deserializeImageSdf = function (item, manager) {
35610
- return EShapeDeserializer.deserialize(item, manager, new EShapeImageSdf());
34907
+ var deserializeImageSdf = function (item, manager, shape) {
34908
+ return deserializeBase(item, manager, shape || new EShapeImageSdf());
35611
34909
  };
35612
34910
 
35613
34911
  /*
@@ -35691,8 +34989,8 @@
35691
34989
  * Copyright (C) 2019 Toshiba Corporation
35692
34990
  * SPDX-License-Identifier: Apache-2.0
35693
34991
  */
35694
- var deserializeLabel = function (item, manager) {
35695
- return EShapeDeserializer.deserialize(item, manager, new EShapeLabel());
34992
+ var deserializeLabel = function (item, manager, shape) {
34993
+ return deserializeBase(item, manager, shape || new EShapeLabel());
35696
34994
  };
35697
34995
 
35698
34996
  /*
@@ -35738,9 +35036,9 @@
35738
35036
  * Copyright (C) 2019 Toshiba Corporation
35739
35037
  * SPDX-License-Identifier: Apache-2.0
35740
35038
  */
35741
- var deserializeLine = function (item, manager) {
35742
- var shape = new EShapeLine();
35743
- var result = EShapeDeserializer.deserialize(item, manager, shape);
35039
+ var deserializeLine = function (item, manager, shape) {
35040
+ shape = shape || new EShapeLine();
35041
+ var result = deserializeBase(item, manager, shape);
35744
35042
  shape.points.deserialize(item[15], manager);
35745
35043
  var style = shape.points.style;
35746
35044
  var mask = EShapePointsStyle.NON_SCALING_MASK |
@@ -36784,8 +36082,8 @@
36784
36082
  * Copyright (C) 2019 Toshiba Corporation
36785
36083
  * SPDX-License-Identifier: Apache-2.0
36786
36084
  */
36787
- var deserializeLineOfCircles = function (item, manager) {
36788
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfCircles());
36085
+ var deserializeLineOfCircles = function (item, manager, shape) {
36086
+ return deserializeBase(item, manager, shape || new EShapeLineOfCircles());
36789
36087
  };
36790
36088
 
36791
36089
  /*
@@ -37011,8 +36309,8 @@
37011
36309
  * Copyright (C) 2019 Toshiba Corporation
37012
36310
  * SPDX-License-Identifier: Apache-2.0
37013
36311
  */
37014
- var deserializeLineOfRectangleRoundeds = function (item, manager) {
37015
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfRectangleRoundeds());
36312
+ var deserializeLineOfRectangleRoundeds = function (item, manager, shape) {
36313
+ return deserializeBase(item, manager, shape || new EShapeLineOfRectangleRoundeds());
37016
36314
  };
37017
36315
 
37018
36316
  /*
@@ -37229,8 +36527,8 @@
37229
36527
  * Copyright (C) 2019 Toshiba Corporation
37230
36528
  * SPDX-License-Identifier: Apache-2.0
37231
36529
  */
37232
- var deserializeLineOfRectangles = function (item, manager) {
37233
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfRectangles());
36530
+ var deserializeLineOfRectangles = function (item, manager, shape) {
36531
+ return deserializeBase(item, manager, shape || new EShapeLineOfRectangles());
37234
36532
  };
37235
36533
 
37236
36534
  /*
@@ -38006,8 +37304,8 @@
38006
37304
  * Copyright (C) 2019 Toshiba Corporation
38007
37305
  * SPDX-License-Identifier: Apache-2.0
38008
37306
  */
38009
- var deserializeLineOfTriangleRoundeds = function (item, manager) {
38010
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfTriangleRoundeds());
37307
+ var deserializeLineOfTriangleRoundeds = function (item, manager, shape) {
37308
+ return deserializeBase(item, manager, shape || new EShapeLineOfTriangleRoundeds());
38011
37309
  };
38012
37310
 
38013
37311
  /*
@@ -38228,8 +37526,8 @@
38228
37526
  * Copyright (C) 2019 Toshiba Corporation
38229
37527
  * SPDX-License-Identifier: Apache-2.0
38230
37528
  */
38231
- var deserializeLineOfTriangles = function (item, manager) {
38232
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfTriangles());
37529
+ var deserializeLineOfTriangles = function (item, manager, shape) {
37530
+ return deserializeBase(item, manager, shape || new EShapeLineOfTriangles());
38233
37531
  };
38234
37532
 
38235
37533
  /*
@@ -38255,8 +37553,24 @@
38255
37553
  * Copyright (C) 2019 Toshiba Corporation
38256
37554
  * SPDX-License-Identifier: Apache-2.0
38257
37555
  */
38258
- var deserializeNull = function (item, manager) {
38259
- return EShapeDeserializer.deserialize(item, manager, new EShapeNull());
37556
+ var EShapeNull = /** @class */ (function (_super) {
37557
+ __extends(EShapeNull, _super);
37558
+ function EShapeNull(type) {
37559
+ if (type === void 0) { type = EShapeType.NULL; }
37560
+ return _super.call(this, type) || this;
37561
+ }
37562
+ EShapeNull.prototype.clone = function () {
37563
+ return new EShapeNull().copy(this);
37564
+ };
37565
+ return EShapeNull;
37566
+ }(EShapePrimitive));
37567
+
37568
+ /*
37569
+ * Copyright (C) 2019 Toshiba Corporation
37570
+ * SPDX-License-Identifier: Apache-2.0
37571
+ */
37572
+ var deserializeNull = function (item, manager, shape) {
37573
+ return deserializeBase(item, manager, shape || new EShapeNull());
38260
37574
  };
38261
37575
 
38262
37576
  /*
@@ -38272,8 +37586,8 @@
38272
37586
  * Copyright (C) 2019 Toshiba Corporation
38273
37587
  * SPDX-License-Identifier: Apache-2.0
38274
37588
  */
38275
- var deserializeRectangle = function (item, manager) {
38276
- return EShapeDeserializer.deserialize(item, manager, new EShapeRectangle());
37589
+ var deserializeRectangle = function (item, manager, shape) {
37590
+ return deserializeBase(item, manager, shape || new EShapeRectangle());
38277
37591
  };
38278
37592
 
38279
37593
  /*
@@ -38347,222 +37661,918 @@
38347
37661
  buffer.updateClippings();
38348
37662
  buildTriangleRoundedClipping(buffer.clippings, voffset, corner, radius);
38349
37663
  }
38350
- if (isVertexChanged || isTransformChanged || isCornerChanged) {
38351
- buffer.updateSteps();
38352
- buildTriangleRoundedStep(buffer.steps, buffer.clippings, voffset, strokeWidth, strokeStyle, shape.radius, TRIANGLE_ROUNDED_WORLD_SIZE);
37664
+ if (isVertexChanged || isTransformChanged || isCornerChanged) {
37665
+ buffer.updateSteps();
37666
+ buildTriangleRoundedStep(buffer.steps, buffer.clippings, voffset, strokeWidth, strokeStyle, shape.radius, TRIANGLE_ROUNDED_WORLD_SIZE);
37667
+ }
37668
+ if (isVertexChanged || isTextureChanged) {
37669
+ buffer.updateUvs();
37670
+ buildTriangleRoundedUv(buffer.uvs, voffset, toTextureUvs(texture), radius, TRIANGLE_ROUNDED_WORLD_SIZE);
37671
+ }
37672
+ }
37673
+ };
37674
+ return BuilderTriangleRounded;
37675
+ }(BuilderBase));
37676
+
37677
+ /*
37678
+ * Copyright (C) 2019 Toshiba Corporation
37679
+ * SPDX-License-Identifier: Apache-2.0
37680
+ */
37681
+ var BuilderTriangle = /** @class */ (function (_super) {
37682
+ __extends(BuilderTriangle, _super);
37683
+ function BuilderTriangle() {
37684
+ return _super !== null && _super.apply(this, arguments) || this;
37685
+ }
37686
+ BuilderTriangle.prototype.init = function (buffer) {
37687
+ buffer.updateClippings();
37688
+ buffer.updateIndices();
37689
+ buildTriangleClipping(buffer.clippings, this.vertexOffset);
37690
+ buildTriangleIndex(buffer.indices, this.vertexOffset, this.indexOffset);
37691
+ };
37692
+ BuilderTriangle.prototype.update = function (buffer, shape) {
37693
+ this.updateVertexStepAndUv(buffer, shape);
37694
+ this.updateColorFill(buffer, shape);
37695
+ this.updateColorStroke(buffer, shape);
37696
+ };
37697
+ BuilderTriangle.prototype.updateVertexStepAndUv = function (buffer, shape) {
37698
+ var size = shape.size;
37699
+ var sizeX = size.x;
37700
+ var sizeY = size.y;
37701
+ var isSizeChanged = sizeX !== this.sizeX || sizeY !== this.sizeY;
37702
+ var transformLocalId = toTransformLocalId(shape);
37703
+ var isTransformChanged = this.transformLocalId !== transformLocalId;
37704
+ var stroke = shape.stroke;
37705
+ var strokeAlign = stroke.align;
37706
+ var strokeWidth = stroke.enable ? stroke.width : 0;
37707
+ var strokeStyle = stroke.style;
37708
+ var isStrokeChanged = this.strokeAlign !== strokeAlign ||
37709
+ this.strokeWidth !== strokeWidth ||
37710
+ this.strokeStyle !== strokeStyle;
37711
+ var texture = toTexture(shape);
37712
+ var textureTransformId = toTextureTransformId(texture);
37713
+ var isTextureChanged = texture !== this.texture || textureTransformId !== this.textureTransformId;
37714
+ var isVertexChanged = isSizeChanged || isStrokeChanged;
37715
+ if (isVertexChanged || isTransformChanged || isTextureChanged) {
37716
+ this.sizeX = sizeX;
37717
+ this.sizeY = sizeY;
37718
+ this.transformLocalId = transformLocalId;
37719
+ this.strokeAlign = strokeAlign;
37720
+ this.strokeWidth = strokeWidth;
37721
+ this.strokeStyle = strokeStyle;
37722
+ this.texture = texture;
37723
+ this.textureTransformId = textureTransformId;
37724
+ var voffset = this.vertexOffset;
37725
+ buffer.updateVertices();
37726
+ buildTriangleVertex(buffer.vertices, voffset, 0, 0, sizeX, sizeY, strokeAlign, strokeWidth, shape.transform.internalTransform, TRIANGLE_WORLD_SIZE);
37727
+ if (isVertexChanged || isTransformChanged) {
37728
+ buffer.updateSteps();
37729
+ buildTriangleStep(buffer.steps, buffer.clippings, voffset, TRIANGLE_VERTEX_COUNT, strokeWidth, strokeStyle, TRIANGLE_WORLD_SIZE);
37730
+ }
37731
+ if (isVertexChanged || isTextureChanged) {
37732
+ buffer.updateUvs();
37733
+ buildTriangleUv(buffer.uvs, toTextureUvs(texture), voffset, TRIANGLE_WORLD_SIZE);
37734
+ }
37735
+ }
37736
+ };
37737
+ return BuilderTriangle;
37738
+ }(BuilderBase));
37739
+
37740
+ /*
37741
+ * Copyright (C) 2019 Toshiba Corporation
37742
+ * SPDX-License-Identifier: Apache-2.0
37743
+ */
37744
+ var createImageSdf = function (dataUrl, convertToSdf) {
37745
+ if (convertToSdf) {
37746
+ return toImageElement(dataUrl).then(function (imageElement) {
37747
+ var generator = DynamicSDFFontGenerator.getInstance().init();
37748
+ generator.updateTexture(imageElement);
37749
+ generator.render();
37750
+ var canvas = document.createElement("canvas");
37751
+ generator.read(canvas);
37752
+ return createImageSdf(canvas.toDataURL(), false);
37753
+ });
37754
+ }
37755
+ else {
37756
+ return toImageElement(dataUrl).then(function (imageElement) {
37757
+ return new EShapeImageSdf(imageElement);
37758
+ });
37759
+ }
37760
+ };
37761
+
37762
+ /*
37763
+ * Copyright (C) 2019 Toshiba Corporation
37764
+ * SPDX-License-Identifier: Apache-2.0
37765
+ */
37766
+ var createImage = function (dataUrl) {
37767
+ return toImageElement(dataUrl).then(function (imageElement) {
37768
+ return new EShapeImage(imageElement);
37769
+ });
37770
+ };
37771
+
37772
+ var createLine = function (points, segments, strokeWidth, pointsStyle) {
37773
+ // Calculate the boundary
37774
+ var boundary = toPointsBoundary(points, [0, 0, 0, 0]);
37775
+ var cx = (boundary[2] + boundary[0]) * 0.5;
37776
+ var cy = (boundary[3] + boundary[1]) * 0.5;
37777
+ var sx = boundary[2] - boundary[0];
37778
+ var sy = boundary[3] - boundary[1];
37779
+ // Calculate values
37780
+ var values = [];
37781
+ for (var i = 0, imax = points.length; i < imax; i += 2) {
37782
+ values.push(points[i] - cx, points[i + 1] - cy);
37783
+ }
37784
+ // Create a line
37785
+ var result = new EShapeLine();
37786
+ result.stroke.set(true, undefined, undefined, strokeWidth);
37787
+ result.transform.position.set(cx, cy);
37788
+ result.size.set(sx, sy);
37789
+ result.points.set(values, segments, pointsStyle);
37790
+ return result;
37791
+ };
37792
+
37793
+ /*
37794
+ * Copyright (C) 2019 Toshiba Corporation
37795
+ * SPDX-License-Identifier: Apache-2.0
37796
+ */
37797
+ var createTriangleRoundedUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
37798
+ var tcount = toTextBufferCount(shape);
37799
+ var tvcount = tcount * TEXT_VERTEX_COUNT;
37800
+ var ticount = tcount * TEXT_INDEX_COUNT;
37801
+ var vcount = TRIANGLE_ROUNDED_VERTEX_COUNT + tvcount;
37802
+ var icount = TRIANGLE_ROUNDED_INDEX_COUNT + ticount;
37803
+ if (buffer.check(voffset, ioffset, vcount, icount)) {
37804
+ return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
37805
+ new BuilderTriangleRounded(voffset, ioffset, vcount - tvcount, icount - ticount),
37806
+ new BuilderText(voffset + TRIANGLE_ROUNDED_VERTEX_COUNT, ioffset + TRIANGLE_ROUNDED_INDEX_COUNT, tvcount, ticount)
37807
+ ]).init(shape);
37808
+ }
37809
+ return null;
37810
+ };
37811
+
37812
+ /*
37813
+ * Copyright (C) 2019 Toshiba Corporation
37814
+ * SPDX-License-Identifier: Apache-2.0
37815
+ */
37816
+ var createTriangleUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
37817
+ var tcount = toTextBufferCount(shape);
37818
+ var tvcount = tcount * TEXT_VERTEX_COUNT;
37819
+ var ticount = tcount * TEXT_INDEX_COUNT;
37820
+ var vcount = TRIANGLE_VERTEX_COUNT + tvcount;
37821
+ var icount = TRIANGLE_INDEX_COUNT + ticount;
37822
+ if (buffer.check(voffset, ioffset, vcount, icount)) {
37823
+ return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
37824
+ new BuilderTriangle(voffset, ioffset, vcount - tvcount, icount - ticount),
37825
+ new BuilderText(voffset + TRIANGLE_VERTEX_COUNT, ioffset + TRIANGLE_INDEX_COUNT, tvcount, ticount)
37826
+ ]).init(shape);
37827
+ }
37828
+ return null;
37829
+ };
37830
+
37831
+ /*
37832
+ * Copyright (C) 2019 Toshiba Corporation
37833
+ * SPDX-License-Identifier: Apache-2.0
37834
+ */
37835
+ var EShapeUuidMappingImpl = /** @class */ (function () {
37836
+ function EShapeUuidMappingImpl(shapes) {
37837
+ this._shapes = shapes;
37838
+ }
37839
+ EShapeUuidMappingImpl.prototype.find = function (uuid) {
37840
+ return this.getUuidToShape().get(uuid);
37841
+ };
37842
+ EShapeUuidMappingImpl.prototype.getUuidToShape = function () {
37843
+ var result = this._uuidToShape;
37844
+ if (result == null) {
37845
+ result = this.newUuidToShape();
37846
+ this._uuidToShape = result;
37847
+ }
37848
+ return result;
37849
+ };
37850
+ EShapeUuidMappingImpl.prototype.newUuidToShape = function () {
37851
+ var result = new Map();
37852
+ this.fillUuidToShape(this._shapes, result);
37853
+ return result;
37854
+ };
37855
+ EShapeUuidMappingImpl.prototype.fillUuidToShape = function (shapes, result) {
37856
+ for (var i = 0, imax = shapes.length; i < imax; ++i) {
37857
+ var shape = shapes[i];
37858
+ result.set(shape.uuid, shape);
37859
+ var children = shape.children;
37860
+ if (0 < children.length) {
37861
+ this.fillUuidToShape(children, result);
37862
+ }
37863
+ }
37864
+ };
37865
+ return EShapeUuidMappingImpl;
37866
+ }());
37867
+
37868
+ /*
37869
+ * Copyright (C) 2019 Toshiba Corporation
37870
+ * SPDX-License-Identifier: Apache-2.0
37871
+ */
37872
+ var deserializeAll = function (serializeds, manager) {
37873
+ var shapes = [];
37874
+ for (var i = 0, imax = serializeds.length; i < imax; ++i) {
37875
+ shapes.push(deserialize(serializeds[i], manager));
37876
+ }
37877
+ if (0 < shapes.length) {
37878
+ return Promise.all(shapes).then(function (resolved) {
37879
+ callOnDeserialized(serializeds, resolved, new EShapeUuidMappingImpl(resolved), manager);
37880
+ return resolved;
37881
+ });
37882
+ }
37883
+ return null;
37884
+ };
37885
+ var callOnDeserialized = function (serializeds, shapes, mapping, manager) {
37886
+ for (var i = 0, imax = serializeds.length; i < imax; ++i) {
37887
+ var serialized = serializeds[i];
37888
+ var shape = shapes[i];
37889
+ var onDeserialized = EShapeOnDeserializeds[serialized[0]];
37890
+ if (onDeserialized) {
37891
+ onDeserialized(serialized, shape, mapping, manager);
37892
+ }
37893
+ callOnDeserialized(serialized[20], shape.children, mapping, manager);
37894
+ }
37895
+ };
37896
+
37897
+ /*
37898
+ * Copyright (C) 2019 Toshiba Corporation
37899
+ * SPDX-License-Identifier: Apache-2.0
37900
+ */
37901
+ var deserializeRectangleRounded = function (item, manager, shape) {
37902
+ return deserializeBase(item, manager, shape || new EShapeRectangleRounded());
37903
+ };
37904
+
37905
+ /*
37906
+ * Copyright (C) 2019 Toshiba Corporation
37907
+ * SPDX-License-Identifier: Apache-2.0
37908
+ */
37909
+ var deserializeTriangleRounded = function (item, manager, shape) {
37910
+ return deserializeBase(item, manager, shape || new EShapeTriangleRounded());
37911
+ };
37912
+
37913
+ /*
37914
+ * Copyright (C) 2019 Toshiba Corporation
37915
+ * SPDX-License-Identifier: Apache-2.0
37916
+ */
37917
+ var deserializeTriangle = function (item, manager, shape) {
37918
+ return deserializeBase(item, manager, shape || new EShapeTriangle());
37919
+ };
37920
+
37921
+ var EShapeEmbeddedDatum = /** @class */ (function () {
37922
+ function EShapeEmbeddedDatum(name, width, height, layer) {
37923
+ this.name = name;
37924
+ this.width = width;
37925
+ this.height = height;
37926
+ this.layer = layer;
37927
+ }
37928
+ return EShapeEmbeddedDatum;
37929
+ }());
37930
+
37931
+ /*
37932
+ * Copyright (C) 2019 Toshiba Corporation
37933
+ * SPDX-License-Identifier: Apache-2.0
37934
+ */
37935
+ var EShapeConnectors = /** @class */ (function () {
37936
+ function EShapeConnectors() {
37937
+ }
37938
+ EShapeConnectors.isConnector = function (target) {
37939
+ return target != null && target.type === EShapeType.CONNECTOR_LINE;
37940
+ };
37941
+ EShapeConnectors.newMapping = function (sources, destinations, result) {
37942
+ var _a;
37943
+ if (result == null) {
37944
+ result = (_a = EShapeConnectors._MAPPING) !== null && _a !== void 0 ? _a : (EShapeConnectors._MAPPING = new Map());
37945
+ result.clear();
37946
+ }
37947
+ for (var i = 0, imax = sources.length; i < imax; ++i) {
37948
+ var fromChild = sources[i];
37949
+ var toChild = destinations[i];
37950
+ result.set(fromChild, toChild);
37951
+ this.newMapping(fromChild.children, toChild.children, result);
37952
+ }
37953
+ return result;
37954
+ };
37955
+ EShapeConnectors.moveAll = function (rootSources, rootDestinations, sources, destinations, mapping) {
37956
+ for (var i = 0, imax = sources.length; i < imax; ++i) {
37957
+ var source = sources[i];
37958
+ var destination = destinations[i];
37959
+ if (this.isConnector(source)) {
37960
+ if (this.isConnector(destination)) {
37961
+ var sourceEdge = source.edge;
37962
+ var destEdge = destination.edge;
37963
+ var sourceHead = sourceEdge.head;
37964
+ var sourceHeadShape = sourceHead.acceptor.shape;
37965
+ if (sourceHeadShape) {
37966
+ if (mapping == null) {
37967
+ mapping = this.newMapping(rootSources, rootDestinations);
37968
+ }
37969
+ var destHeadShape = mapping.get(sourceHeadShape);
37970
+ if (destHeadShape) {
37971
+ var destHead = destEdge.head;
37972
+ destHead.detach();
37973
+ destHead.set(destHeadShape);
37974
+ destHead.attach();
37975
+ destHeadShape.connector.remove(sourceHead);
37976
+ }
37977
+ }
37978
+ var sourceTail = sourceEdge.tail;
37979
+ var sourceTailShape = sourceTail.acceptor.shape;
37980
+ if (sourceTailShape) {
37981
+ if (mapping == null) {
37982
+ mapping = this.newMapping(rootSources, rootDestinations);
37983
+ }
37984
+ var destTailShape = mapping.get(sourceTailShape);
37985
+ if (destTailShape) {
37986
+ var destTail = destEdge.tail;
37987
+ destTail.detach();
37988
+ destTail.set(destTailShape);
37989
+ destTail.attach();
37990
+ destTailShape.connector.remove(sourceTail);
37991
+ }
37992
+ }
37993
+ }
37994
+ }
37995
+ mapping = this.moveAll(rootSources, rootDestinations, source.children, destination.children, mapping);
37996
+ }
37997
+ return mapping;
37998
+ };
37999
+ EShapeConnectors.move = function (from, to) {
38000
+ var fromChildren = from.children;
38001
+ var toChildren = to.children;
38002
+ this.moveAll(fromChildren, toChildren, fromChildren, toChildren);
38003
+ };
38004
+ return EShapeConnectors;
38005
+ }());
38006
+
38007
+ /*
38008
+ * Copyright (C) 2019 Toshiba Corporation
38009
+ * SPDX-License-Identifier: Apache-2.0
38010
+ */
38011
+ var EShapeLayerState = {
38012
+ INVISIBLE: "INVISIBLE",
38013
+ INTERACTIVE: "INTERACTIVE",
38014
+ DRAGGABLE: "DRAGGABLE",
38015
+ PINCHABLE: "PINCHABLE"
38016
+ };
38017
+
38018
+ /*
38019
+ * Copyright (C) 2019 Toshiba Corporation
38020
+ * SPDX-License-Identifier: Apache-2.0
38021
+ */
38022
+ var EShapeEmbeddedLayer = /** @class */ (function (_super) {
38023
+ __extends(EShapeEmbeddedLayer, _super);
38024
+ function EShapeEmbeddedLayer(name, isEditMode, type) {
38025
+ if (type === void 0) { type = EShapeType.EMBEDDED_LAYER; }
38026
+ var _this = _super.call(this, isEditMode, type) || this;
38027
+ _this._name = name;
38028
+ return _this;
38029
+ }
38030
+ Object.defineProperty(EShapeEmbeddedLayer.prototype, "name", {
38031
+ get: function () {
38032
+ return this._name;
38033
+ },
38034
+ enumerable: false,
38035
+ configurable: true
38036
+ });
38037
+ EShapeEmbeddedLayer.prototype.newGroupFill = function () {
38038
+ return new EShapeFillImpl(this, false, 0xffffff, 1);
38039
+ };
38040
+ EShapeEmbeddedLayer.prototype.isGroupSizeFittable = function () {
38041
+ return false;
38042
+ };
38043
+ EShapeEmbeddedLayer.prototype.clone = function () {
38044
+ var result = this.newClone().copy(this);
38045
+ var children = this.children;
38046
+ for (var i = 0, imax = children.length; i < imax; ++i) {
38047
+ var clone = children[i].clone();
38048
+ clone.parent = result;
38049
+ result.children.push(clone);
38050
+ }
38051
+ result.onChildTransformChange();
38052
+ result.toDirty();
38053
+ result.size.init();
38054
+ return result;
38055
+ };
38056
+ EShapeEmbeddedLayer.prototype.newClone = function () {
38057
+ var constructor = this.constructor;
38058
+ return new constructor(this._name, this._isEditMode, this.type);
38059
+ };
38060
+ EShapeEmbeddedLayer.prototype.serializeChildren = function (manager) {
38061
+ return [];
38062
+ };
38063
+ EShapeEmbeddedLayer.prototype.serializeImage = function (manager) {
38064
+ return -1;
38065
+ };
38066
+ EShapeEmbeddedLayer.prototype.serializeGradient = function (manager) {
38067
+ return -1;
38068
+ };
38069
+ EShapeEmbeddedLayer.deserialize = function (serialized, manager, width, height) {
38070
+ var _a, _b, _c;
38071
+ var result = new EShapeEmbeddedLayer(this.deserializeName(serialized[0], manager), manager.isEditMode);
38072
+ var visibility = serialized[1];
38073
+ var visible = visibility == null || !!(visibility & 0x2);
38074
+ if (!visible) {
38075
+ result.visible = false;
38076
+ result.state.add(EShapeLayerState.INVISIBLE);
38077
+ }
38078
+ var positionX = -0.5 * width + (serialized[2] || 0);
38079
+ var positionY = -0.5 * height + (serialized[3] || 0);
38080
+ result.transform.position.set(positionX, positionY);
38081
+ var sizeX = (_a = serialized[4]) !== null && _a !== void 0 ? _a : width;
38082
+ var sizeY = (_b = serialized[5]) !== null && _b !== void 0 ? _b : height;
38083
+ result.size.set(sizeX, sizeY);
38084
+ var fillId = serialized[6];
38085
+ if (fillId != null) {
38086
+ result.fill.deserialize(fillId, manager);
38087
+ }
38088
+ if (!manager.isEditMode) {
38089
+ var state = (_c = serialized[7]) !== null && _c !== void 0 ? _c : 1;
38090
+ var isInteractive = state & 0x1;
38091
+ var isDraggable = state & 0x2;
38092
+ var isPinchable = state & 0x4;
38093
+ if (isDraggable || isPinchable) {
38094
+ var gestureType = (isDraggable
38095
+ ? EShapeActionValueMiscGestureType.DRAG
38096
+ : EShapeActionValueMiscGestureType.NONE) |
38097
+ (isPinchable
38098
+ ? EShapeActionValueMiscGestureType.PINCH
38099
+ : EShapeActionValueMiscGestureType.NONE);
38100
+ result.action.add(new EShapeActionValueMiscLayerGesture("", gestureType));
38101
+ }
38102
+ if (isInteractive || isDraggable || isPinchable) {
38103
+ result.interactive = true;
38353
38104
  }
38354
- if (isVertexChanged || isTextureChanged) {
38355
- buffer.updateUvs();
38356
- buildTriangleRoundedUv(buffer.uvs, voffset, toTextureUvs(texture), radius, TRIANGLE_ROUNDED_WORLD_SIZE);
38105
+ }
38106
+ return result;
38107
+ };
38108
+ EShapeEmbeddedLayer.deserializeName = function (target, manager) {
38109
+ if (isString(target)) {
38110
+ return target;
38111
+ }
38112
+ else {
38113
+ var resources = manager.resources;
38114
+ if (0 <= target && target <= resources.length) {
38115
+ return resources[target];
38357
38116
  }
38117
+ return "";
38358
38118
  }
38359
38119
  };
38360
- return BuilderTriangleRounded;
38361
- }(BuilderBase));
38120
+ return EShapeEmbeddedLayer;
38121
+ }(EShapeGroupViewer));
38362
38122
 
38363
38123
  /*
38364
38124
  * Copyright (C) 2019 Toshiba Corporation
38365
38125
  * SPDX-License-Identifier: Apache-2.0
38366
38126
  */
38367
- var BuilderTriangle = /** @class */ (function (_super) {
38368
- __extends(BuilderTriangle, _super);
38369
- function BuilderTriangle() {
38370
- return _super !== null && _super.apply(this, arguments) || this;
38127
+ var EShapeEmbeddedLayerContainer = /** @class */ (function () {
38128
+ function EShapeEmbeddedLayerContainer(width, height, isEditMode) {
38129
+ this.children = [];
38130
+ this._width = width;
38131
+ this._height = height;
38132
+ this._isEditMode = isEditMode;
38371
38133
  }
38372
- BuilderTriangle.prototype.init = function (buffer) {
38373
- buffer.updateClippings();
38374
- buffer.updateIndices();
38375
- buildTriangleClipping(buffer.clippings, this.vertexOffset);
38376
- buildTriangleIndex(buffer.indices, this.vertexOffset, this.indexOffset);
38134
+ EShapeEmbeddedLayerContainer.prototype.hasConnectors = function (shapes) {
38135
+ for (var i = 0, imax = shapes.length; i < imax; ++i) {
38136
+ var shape = shapes[i];
38137
+ if (shape.type === EShapeType.CONNECTOR_LINE) {
38138
+ return true;
38139
+ }
38140
+ var children = shape.children;
38141
+ if (0 < children.length) {
38142
+ if (this.hasConnectors(children)) {
38143
+ return true;
38144
+ }
38145
+ }
38146
+ }
38147
+ return false;
38377
38148
  };
38378
- BuilderTriangle.prototype.update = function (buffer, shape) {
38379
- this.updateVertexStepAndUv(buffer, shape);
38380
- this.updateColorFill(buffer, shape);
38381
- this.updateColorStroke(buffer, shape);
38149
+ EShapeEmbeddedLayerContainer.prototype.newHasConnectors = function () {
38150
+ var result = new Map();
38151
+ var layers = this.children;
38152
+ for (var i = 0, imax = layers.length; i < imax; ++i) {
38153
+ var layer = layers[i];
38154
+ result.set(layer, this.hasConnectors(layer.children));
38155
+ }
38156
+ return result;
38382
38157
  };
38383
- BuilderTriangle.prototype.updateVertexStepAndUv = function (buffer, shape) {
38384
- var size = shape.size;
38385
- var sizeX = size.x;
38386
- var sizeY = size.y;
38387
- var isSizeChanged = sizeX !== this.sizeX || sizeY !== this.sizeY;
38388
- var transformLocalId = toTransformLocalId(shape);
38389
- var isTransformChanged = this.transformLocalId !== transformLocalId;
38390
- var stroke = shape.stroke;
38391
- var strokeAlign = stroke.align;
38392
- var strokeWidth = stroke.enable ? stroke.width : 0;
38393
- var strokeStyle = stroke.style;
38394
- var isStrokeChanged = this.strokeAlign !== strokeAlign ||
38395
- this.strokeWidth !== strokeWidth ||
38396
- this.strokeStyle !== strokeStyle;
38397
- var texture = toTexture(shape);
38398
- var textureTransformId = toTextureTransformId(texture);
38399
- var isTextureChanged = texture !== this.texture || textureTransformId !== this.textureTransformId;
38400
- var isVertexChanged = isSizeChanged || isStrokeChanged;
38401
- if (isVertexChanged || isTransformChanged || isTextureChanged) {
38402
- this.sizeX = sizeX;
38403
- this.sizeY = sizeY;
38404
- this.transformLocalId = transformLocalId;
38405
- this.strokeAlign = strokeAlign;
38406
- this.strokeWidth = strokeWidth;
38407
- this.strokeStyle = strokeStyle;
38408
- this.texture = texture;
38409
- this.textureTransformId = textureTransformId;
38410
- var voffset = this.vertexOffset;
38411
- buffer.updateVertices();
38412
- buildTriangleVertex(buffer.vertices, voffset, 0, 0, sizeX, sizeY, strokeAlign, strokeWidth, shape.transform.internalTransform, TRIANGLE_WORLD_SIZE);
38413
- if (isVertexChanged || isTransformChanged) {
38414
- buffer.updateSteps();
38415
- buildTriangleStep(buffer.steps, buffer.clippings, voffset, TRIANGLE_VERTEX_COUNT, strokeWidth, strokeStyle, TRIANGLE_WORLD_SIZE);
38158
+ EShapeEmbeddedLayerContainer.prototype.copyTo = function (destination) {
38159
+ var _a;
38160
+ var hasConnectors = ((_a = this._hasConnectors) !== null && _a !== void 0 ? _a : (this._hasConnectors = this.newHasConnectors()));
38161
+ var layers = this.children;
38162
+ var children = destination.children;
38163
+ for (var i = 0, imax = layers.length; i < imax; ++i) {
38164
+ var layer = layers[i];
38165
+ var clone = layer.clone();
38166
+ clone.parent = destination;
38167
+ children.push(clone);
38168
+ if (hasConnectors.get(layer)) {
38169
+ EShapeConnectors.move(layer, clone);
38416
38170
  }
38417
- if (isVertexChanged || isTextureChanged) {
38418
- buffer.updateUvs();
38419
- buildTriangleUv(buffer.uvs, toTextureUvs(texture), voffset, TRIANGLE_WORLD_SIZE);
38171
+ }
38172
+ destination.onChildTransformChange();
38173
+ destination.toDirty();
38174
+ destination.onAttach();
38175
+ };
38176
+ EShapeEmbeddedLayerContainer.prototype.deserialize = function (serializedLayers, manager) {
38177
+ var serializedLayersLength = serializedLayers.length;
38178
+ if (0 < serializedLayersLength) {
38179
+ var width = this._width;
38180
+ var height = this._height;
38181
+ for (var i = 0; i < serializedLayersLength; ++i) {
38182
+ this.children.push(EShapeEmbeddedLayer.deserialize(serializedLayers[i], manager, width, height));
38420
38183
  }
38421
38184
  }
38422
38185
  };
38423
- return BuilderTriangle;
38424
- }(BuilderBase));
38186
+ return EShapeEmbeddedLayerContainer;
38187
+ }());
38425
38188
 
38426
38189
  /*
38427
38190
  * Copyright (C) 2019 Toshiba Corporation
38428
38191
  * SPDX-License-Identifier: Apache-2.0
38429
38192
  */
38430
- var createImageSdf = function (dataUrl, convertToSdf) {
38431
- if (convertToSdf) {
38432
- return EShapeImageElements.toImageElement(dataUrl).then(function (imageElement) {
38433
- var generator = DynamicSDFFontGenerator.getInstance().init();
38434
- generator.updateTexture(imageElement);
38435
- generator.render();
38436
- var canvas = document.createElement("canvas");
38437
- generator.read(canvas);
38438
- return createImageSdf(canvas.toDataURL(), false);
38439
- });
38440
- }
38441
- else {
38442
- return EShapeImageElements.toImageElement(dataUrl).then(function (imageElement) {
38443
- return new EShapeImageSdf(imageElement);
38444
- });
38193
+ var EShapeResourceManagerDeserialization = /** @class */ (function () {
38194
+ function EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode) {
38195
+ this.resources = serialized.resources;
38196
+ this.data = serialized.data || serialized.tags || serialized.resources;
38197
+ this.pieces = pieces;
38198
+ this.pieceData = pieceData;
38199
+ this.isEditMode = isEditMode;
38200
+ this._actions = new Map();
38201
+ this._fills = new Map();
38202
+ this._strokes = new Map();
38203
+ this._data = new Map();
38204
+ this._dataValues = new Map();
38205
+ this._ranges = new Map();
38206
+ this._aligns = new Map();
38207
+ this._margins = new Map();
38208
+ this._texts = new Map();
38209
+ this._textOutlines = new Map();
38210
+ this._extensions = new Map();
38445
38211
  }
38446
- };
38212
+ EShapeResourceManagerDeserialization.prototype.getAction = function (id) {
38213
+ return this._actions.get(id);
38214
+ };
38215
+ EShapeResourceManagerDeserialization.prototype.setAction = function (id, action) {
38216
+ this._actions.set(id, action);
38217
+ };
38218
+ EShapeResourceManagerDeserialization.prototype.getFill = function (id) {
38219
+ return this._fills.get(id);
38220
+ };
38221
+ EShapeResourceManagerDeserialization.prototype.setFill = function (id, fill) {
38222
+ this._fills.set(id, fill);
38223
+ };
38224
+ EShapeResourceManagerDeserialization.prototype.getStroke = function (id) {
38225
+ return this._strokes.get(id);
38226
+ };
38227
+ EShapeResourceManagerDeserialization.prototype.setStroke = function (id, stroke) {
38228
+ this._strokes.set(id, stroke);
38229
+ };
38230
+ EShapeResourceManagerDeserialization.prototype.getData = function (id) {
38231
+ return this._data.get(id);
38232
+ };
38233
+ EShapeResourceManagerDeserialization.prototype.setData = function (id, data) {
38234
+ this._data.set(id, data);
38235
+ };
38236
+ EShapeResourceManagerDeserialization.prototype.getDataValue = function (id) {
38237
+ return this._dataValues.get(id);
38238
+ };
38239
+ EShapeResourceManagerDeserialization.prototype.setDataValue = function (id, dataValue) {
38240
+ this._dataValues.set(id, dataValue);
38241
+ };
38242
+ EShapeResourceManagerDeserialization.prototype.getRange = function (id) {
38243
+ return this._ranges.get(id);
38244
+ };
38245
+ EShapeResourceManagerDeserialization.prototype.setRange = function (id, range) {
38246
+ this._ranges.set(id, range);
38247
+ };
38248
+ EShapeResourceManagerDeserialization.prototype.getAlign = function (id) {
38249
+ return this._aligns.get(id);
38250
+ };
38251
+ EShapeResourceManagerDeserialization.prototype.setAlign = function (id, align) {
38252
+ this._aligns.set(id, align);
38253
+ };
38254
+ EShapeResourceManagerDeserialization.prototype.getMargin = function (id) {
38255
+ return this._margins.get(id);
38256
+ };
38257
+ EShapeResourceManagerDeserialization.prototype.setMargin = function (id, margin) {
38258
+ this._margins.set(id, margin);
38259
+ };
38260
+ EShapeResourceManagerDeserialization.prototype.getText = function (id) {
38261
+ return this._texts.get(id);
38262
+ };
38263
+ EShapeResourceManagerDeserialization.prototype.setText = function (id, text) {
38264
+ this._texts.set(id, text);
38265
+ };
38266
+ EShapeResourceManagerDeserialization.prototype.getTextOutline = function (id) {
38267
+ return this._textOutlines.get(id);
38268
+ };
38269
+ EShapeResourceManagerDeserialization.prototype.setTextOutline = function (id, textOutline) {
38270
+ this._textOutlines.set(id, textOutline);
38271
+ };
38272
+ EShapeResourceManagerDeserialization.prototype.getExtension = function (id) {
38273
+ return this._extensions.get(id);
38274
+ };
38275
+ EShapeResourceManagerDeserialization.prototype.setExtension = function (id, extension) {
38276
+ this._extensions.set(id, extension);
38277
+ };
38278
+ return EShapeResourceManagerDeserialization;
38279
+ }());
38447
38280
 
38448
38281
  /*
38449
38282
  * Copyright (C) 2019 Toshiba Corporation
38450
38283
  * SPDX-License-Identifier: Apache-2.0
38451
38284
  */
38452
- var createImage = function (dataUrl) {
38453
- return EShapeImageElements.toImageElement(dataUrl).then(function (imageElement) {
38454
- return new EShapeImage(imageElement);
38455
- });
38456
- };
38457
-
38458
- var createLine = function (points, segments, strokeWidth, pointsStyle) {
38459
- // Calculate the boundary
38460
- var boundary = toPointsBoundary(points, [0, 0, 0, 0]);
38461
- var cx = (boundary[2] + boundary[0]) * 0.5;
38462
- var cy = (boundary[3] + boundary[1]) * 0.5;
38463
- var sx = boundary[2] - boundary[0];
38464
- var sy = boundary[3] - boundary[1];
38465
- // Calculate values
38466
- var values = [];
38467
- for (var i = 0, imax = points.length; i < imax; i += 2) {
38468
- values.push(points[i] - cx, points[i + 1] - cy);
38285
+ var DDiagrams = /** @class */ (function () {
38286
+ function DDiagrams() {
38469
38287
  }
38470
- // Create a line
38471
- var result = new EShapeLine();
38472
- result.stroke.set(true, undefined, undefined, strokeWidth);
38473
- result.transform.position.set(cx, cy);
38474
- result.size.set(sx, sy);
38475
- result.points.set(values, segments, pointsStyle);
38476
- return result;
38477
- };
38288
+ DDiagrams.toSimple = function (serialized) {
38289
+ return {
38290
+ version: serialized.version,
38291
+ id: serialized.id,
38292
+ name: serialized.name,
38293
+ thumbnail: serialized.thumbnail,
38294
+ data: JSON.stringify({
38295
+ width: serialized.width,
38296
+ height: serialized.height,
38297
+ background: serialized.background,
38298
+ tile: serialized.tile,
38299
+ resources: serialized.resources,
38300
+ data: serialized.data || serialized.tags,
38301
+ pieces: serialized.pieces,
38302
+ layers: serialized.layers,
38303
+ items: serialized.items,
38304
+ snap: serialized.snap
38305
+ })
38306
+ };
38307
+ };
38308
+ DDiagrams.toSerialized = function (target) {
38309
+ if (!("items" in target)) {
38310
+ var data = JSON.parse(target.data);
38311
+ var result = {
38312
+ version: target.version,
38313
+ id: target.id,
38314
+ name: target.name,
38315
+ width: data.width,
38316
+ height: data.height,
38317
+ background: data.background,
38318
+ tile: data.tile,
38319
+ resources: data.resources,
38320
+ data: data.data || data.tags,
38321
+ pieces: data.pieces,
38322
+ layers: data.layers,
38323
+ items: data.items,
38324
+ snap: data.snap,
38325
+ thumbnail: target.thumbnail
38326
+ };
38327
+ if (result.data == null) {
38328
+ var tags = target.tags;
38329
+ if (tags != null) {
38330
+ result.data = JSON.parse(tags);
38331
+ }
38332
+ }
38333
+ if (result.pieces == null) {
38334
+ var pieces = target.pieces;
38335
+ if (pieces != null) {
38336
+ result.pieces = JSON.parse(pieces);
38337
+ }
38338
+ }
38339
+ return result;
38340
+ }
38341
+ return target;
38342
+ };
38343
+ DDiagrams.newLayer = function (serialized, container, manager) {
38344
+ // Layers
38345
+ container.deserialize(serialized.layers, manager);
38346
+ // Items
38347
+ var serializedItems = serialized.items;
38348
+ var shapePromises = deserializeAll(serializedItems, manager);
38349
+ if (shapePromises != null) {
38350
+ return shapePromises.then(function (shapes) {
38351
+ var layers = container.children;
38352
+ for (var i = 0, imax = shapes.length; i < imax; ++i) {
38353
+ var serializedItem = serializedItems[i];
38354
+ var shape = shapes[i];
38355
+ var layer = layers[serializedItem[16]];
38356
+ if (layer != null) {
38357
+ shape.parent = layer;
38358
+ shape.uploaded = undefined;
38359
+ layer.children.push(shape);
38360
+ }
38361
+ }
38362
+ for (var i = 0, imax = layers.length; i < imax; ++i) {
38363
+ var layer = layers[i];
38364
+ layer.onChildTransformChange();
38365
+ layer.toDirty();
38366
+ var children = layer.children;
38367
+ for (var j = 0, jmax = children.length; j < jmax; ++j) {
38368
+ children[j].onAttach();
38369
+ }
38370
+ }
38371
+ return shapes;
38372
+ });
38373
+ }
38374
+ else {
38375
+ return Promise.resolve([]);
38376
+ }
38377
+ };
38378
+ DDiagrams.toPieceData = function (controller, pieces, isEditMode) {
38379
+ var result = new Map();
38380
+ var onFulfilled = function () {
38381
+ return result;
38382
+ };
38383
+ return this.toPieceData_(controller, pieces, result, isEditMode).then(onFulfilled, onFulfilled);
38384
+ };
38385
+ DDiagrams.toPieceData_ = function (controller, pieces, pieceData, isEditMode) {
38386
+ var _this = this;
38387
+ var promises = [];
38388
+ if (pieces && 0 < pieces.length && controller) {
38389
+ var _loop_1 = function (i, imax) {
38390
+ var piece = pieces[i];
38391
+ if (!pieceData.has(piece)) {
38392
+ pieceData.set(piece, null);
38393
+ promises.push(controller.piece.getByName(piece).then(function (found) {
38394
+ return _this.toPieceData__(controller, piece, found, isEditMode, pieceData);
38395
+ }, function () {
38396
+ return null;
38397
+ }));
38398
+ }
38399
+ };
38400
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
38401
+ _loop_1(i, imax);
38402
+ }
38403
+ }
38404
+ return Promise.all(promises);
38405
+ };
38406
+ DDiagrams.toPieceData__ = function (controller, name, serializedOrSimple, isEditMode, pieceData) {
38407
+ var _this = this;
38408
+ var serialized = this.toSerialized(serializedOrSimple);
38409
+ var width = serialized.width;
38410
+ var height = serialized.height;
38411
+ var container = new EShapeEmbeddedLayerContainer(width, height, isEditMode);
38412
+ pieceData.set(name, new EShapeEmbeddedDatum(name, width, height, container));
38413
+ var pieces = serialized.pieces;
38414
+ return this.toPieceData_(controller, pieces, pieceData, isEditMode).then(function () {
38415
+ return _this.newLayer(serialized, container, new EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode));
38416
+ });
38417
+ };
38418
+ return DDiagrams;
38419
+ }());
38478
38420
 
38479
- /*
38480
- * Copyright (C) 2019 Toshiba Corporation
38481
- * SPDX-License-Identifier: Apache-2.0
38482
- */
38483
- var createTriangleRoundedUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
38484
- var tcount = toTextBufferCount(shape);
38485
- var tvcount = tcount * TEXT_VERTEX_COUNT;
38486
- var ticount = tcount * TEXT_INDEX_COUNT;
38487
- var vcount = TRIANGLE_ROUNDED_VERTEX_COUNT + tvcount;
38488
- var icount = TRIANGLE_ROUNDED_INDEX_COUNT + ticount;
38489
- if (buffer.check(voffset, ioffset, vcount, icount)) {
38490
- return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
38491
- new BuilderTriangleRounded(voffset, ioffset, vcount - tvcount, icount - ticount),
38492
- new BuilderText(voffset + TRIANGLE_ROUNDED_VERTEX_COUNT, ioffset + TRIANGLE_ROUNDED_INDEX_COUNT, tvcount, ticount)
38493
- ]).init(shape);
38421
+ var EShapeEmbeddeds = /** @class */ (function () {
38422
+ function EShapeEmbeddeds() {
38494
38423
  }
38495
- return null;
38496
- };
38424
+ EShapeEmbeddeds.from = function (serializedOrSimple, controller, isEditMode) {
38425
+ var _this = this;
38426
+ var serialized = DDiagrams.toSerialized(serializedOrSimple);
38427
+ var pieces = serialized.pieces;
38428
+ return DDiagrams.toPieceData(controller, pieces, isEditMode).then(function (pieceData) {
38429
+ return _this.from_(serialized, isEditMode, pieces, pieceData);
38430
+ });
38431
+ };
38432
+ EShapeEmbeddeds.from_ = function (serialized, isEditMode, pieces, pieceData) {
38433
+ var _this = this;
38434
+ var width = serialized.width;
38435
+ var height = serialized.height;
38436
+ var container = new EShapeEmbeddedLayerContainer(width, height, isEditMode);
38437
+ var manager = new EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode);
38438
+ return DDiagrams.newLayer(serialized, container, manager).then(function () {
38439
+ return _this.create(serialized.name, width, height, container, manager);
38440
+ });
38441
+ };
38442
+ EShapeEmbeddeds.create = function (name, width, height, container, manager) {
38443
+ var shape = new EShapeEmbedded(name, manager.isEditMode);
38444
+ shape.size.set(width, height);
38445
+ container.copyTo(shape);
38446
+ shape.size.init();
38447
+ return shape;
38448
+ };
38449
+ return EShapeEmbeddeds;
38450
+ }());
38497
38451
 
38498
38452
  /*
38499
38453
  * Copyright (C) 2019 Toshiba Corporation
38500
38454
  * SPDX-License-Identifier: Apache-2.0
38501
38455
  */
38502
- var createTriangleUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
38503
- var tcount = toTextBufferCount(shape);
38504
- var tvcount = tcount * TEXT_VERTEX_COUNT;
38505
- var ticount = tcount * TEXT_INDEX_COUNT;
38506
- var vcount = TRIANGLE_VERTEX_COUNT + tvcount;
38507
- var icount = TRIANGLE_INDEX_COUNT + ticount;
38508
- if (buffer.check(voffset, ioffset, vcount, icount)) {
38509
- return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
38510
- new BuilderTriangle(voffset, ioffset, vcount - tvcount, icount - ticount),
38511
- new BuilderText(voffset + TRIANGLE_VERTEX_COUNT, ioffset + TRIANGLE_INDEX_COUNT, tvcount, ticount)
38512
- ]).init(shape);
38456
+ var EShapeRectanglePivoted = /** @class */ (function (_super) {
38457
+ __extends(EShapeRectanglePivoted, _super);
38458
+ function EShapeRectanglePivoted(type) {
38459
+ if (type === void 0) { type = EShapeType.RECTANGLE_PIVOTED; }
38460
+ return _super.call(this, type) || this;
38513
38461
  }
38514
- return null;
38515
- };
38462
+ EShapeRectanglePivoted.prototype.toHitTestData = function (x, y) {
38463
+ var result = _super.prototype.toHitTestData.call(this, x, y);
38464
+ result.x -= result.width;
38465
+ result.y -= result.height;
38466
+ return result;
38467
+ };
38468
+ return EShapeRectanglePivoted;
38469
+ }(EShapeRectangle));
38516
38470
 
38517
38471
  /*
38518
38472
  * Copyright (C) 2019 Toshiba Corporation
38519
38473
  * SPDX-License-Identifier: Apache-2.0
38520
38474
  */
38521
- var deserializeRectangleRounded = function (item, manager) {
38522
- return EShapeDeserializer.deserialize(item, manager, new EShapeRectangleRounded());
38475
+ var toSvgUrl = function (svg) {
38476
+ return "data:image/svg+xml;base64," + btoa(svg);
38523
38477
  };
38524
38478
 
38525
38479
  /*
38526
38480
  * Copyright (C) 2019 Toshiba Corporation
38527
38481
  * SPDX-License-Identifier: Apache-2.0
38528
38482
  */
38529
- var deserializeTriangleRounded = function (item, manager) {
38530
- return EShapeDeserializer.deserialize(item, manager, new EShapeTriangleRounded());
38483
+ var toGradientImageUrl = function (gradient) {
38484
+ var direction = gradient.direction;
38485
+ var points = gradient.points;
38486
+ var stops = "";
38487
+ for (var i = 0, imax = points.length; i < imax; ++i) {
38488
+ var point = points[i];
38489
+ var color = UtilRgb.toCode(point.color);
38490
+ var alpha = point.alpha;
38491
+ var offset = point.position * 100;
38492
+ stops += "<stop offset=\"" + offset + "%\" stop-color=\"#" + color + "\" stop-opacity=\"" + alpha + "\" />";
38493
+ }
38494
+ var radian = (direction * Math.PI) / 180;
38495
+ var dx = 0.5 * Math.cos(radian);
38496
+ var dy = -0.5 * Math.sin(radian);
38497
+ var url = toSvgUrl(
38498
+ /* eslint-disable prettier/prettier */
38499
+ "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 32 32\">" +
38500
+ "<defs>" +
38501
+ ("<linearGradient id=\"o2glkm3aeu2oio\" x1=\"" + (0.5 - dx) + "\" x2=\"" + (0.5 + dx) + "\" y1=\"" + (0.5 - dy) + "\" y2=\"" + (0.5 + dy) + "\">") +
38502
+ stops +
38503
+ "</linearGradient>" +
38504
+ "</defs>" +
38505
+ "<rect x=\"0\" y=\"0\" width=\"32\" height=\"32\" stroke=\"none\" fill=\"url(#o2glkm3aeu2oio)\" />" +
38506
+ "</svg>"
38507
+ /* eslint-enable prettier/prettier */
38508
+ );
38509
+ return url;
38531
38510
  };
38532
38511
 
38533
38512
  /*
38534
38513
  * Copyright (C) 2019 Toshiba Corporation
38535
38514
  * SPDX-License-Identifier: Apache-2.0
38536
38515
  */
38537
- var deserializeTriangle = function (item, manager) {
38538
- return EShapeDeserializer.deserialize(item, manager, new EShapeTriangle());
38516
+ var toSizeRounded = function (value) {
38517
+ return Math.round(value * 100) / 100;
38539
38518
  };
38540
38519
 
38541
38520
  /*
38542
38521
  * Copyright (C) 2019 Toshiba Corporation
38543
38522
  * SPDX-License-Identifier: Apache-2.0
38544
38523
  */
38545
- var EShapeRectanglePivoted = /** @class */ (function (_super) {
38546
- __extends(EShapeRectanglePivoted, _super);
38547
- function EShapeRectanglePivoted(type) {
38548
- if (type === void 0) { type = EShapeType.RECTANGLE_PIVOTED; }
38549
- return _super.call(this, type) || this;
38524
+ var toResize = function (shape, from, to, centerMode, isPerfect) {
38525
+ shape.disallowUploadedUpdate();
38526
+ var position = shape.transform.position;
38527
+ if (centerMode) {
38528
+ var dx = Math.abs(to.x - from.x);
38529
+ var dy = Math.abs(to.y - from.y);
38530
+ if (isPerfect) {
38531
+ var hsize = Math.max(dx, dy);
38532
+ var size = hsize + hsize;
38533
+ shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
38534
+ position.set(toSizeRounded(from.x), toSizeRounded(from.y));
38535
+ }
38536
+ else {
38537
+ shape.size.set(toSizeNormalized(dx + dx), toSizeNormalized(dy + dy));
38538
+ position.set(toSizeRounded(from.x), toSizeRounded(from.y));
38539
+ }
38550
38540
  }
38551
- EShapeRectanglePivoted.prototype.toHitTestData = function (x, y) {
38552
- var result = _super.prototype.toHitTestData.call(this, x, y);
38553
- result.x -= result.width;
38554
- result.y -= result.height;
38555
- return result;
38556
- };
38557
- return EShapeRectanglePivoted;
38558
- }(EShapeRectangle));
38541
+ else {
38542
+ if (isPerfect) {
38543
+ var dx = to.x - from.x;
38544
+ var dy = to.y - from.y;
38545
+ var size = Math.max(Math.abs(dx), Math.abs(dy));
38546
+ var x2 = from.x + (dx < 0 ? -size : +size);
38547
+ var y2 = from.y + (dy < 0 ? -size : +size);
38548
+ var hsize = size * 0.5;
38549
+ var x = Math.min(from.x, x2) + hsize;
38550
+ var y = Math.min(from.y, y2) + hsize;
38551
+ shape.size.set(toSizeNormalized(size), toSizeNormalized(size));
38552
+ position.set(toSizeRounded(x), toSizeRounded(y));
38553
+ }
38554
+ else {
38555
+ var x0 = Math.min(from.x, to.x);
38556
+ var y0 = Math.min(from.y, to.y);
38557
+ var x1 = Math.max(from.x, to.x);
38558
+ var y1 = Math.max(from.y, to.y);
38559
+ var width = x1 - x0;
38560
+ var height = y1 - y0;
38561
+ var px = width * 0.5;
38562
+ var py = height * 0.5;
38563
+ shape.size.set(toSizeNormalized(width), toSizeNormalized(height));
38564
+ position.set(toSizeRounded(x0 + px), toSizeRounded(y0 + py));
38565
+ }
38566
+ }
38567
+ shape.allowUploadedUpdate();
38568
+ };
38559
38569
 
38560
38570
  /*
38561
38571
  * Copyright (C) 2019 Toshiba Corporation
38562
38572
  * SPDX-License-Identifier: Apache-2.0
38563
38573
  */
38564
- var deserializeRectanglePivoted = function (item, manager) {
38565
- return EShapeDeserializer.deserialize(item, manager, new EShapeRectanglePivoted());
38574
+ var deserializeRectanglePivoted = function (item, manager, shape) {
38575
+ return deserializeBase(item, manager, shape || new EShapeRectanglePivoted());
38566
38576
  };
38567
38577
 
38568
38578
  /*
@@ -67285,6 +67295,7 @@
67285
67295
  loadMenuItem: loadMenuItem,
67286
67296
  loadMenuSidedItemExpandable: loadMenuSidedItemExpandable,
67287
67297
  loadMenuSidedItem: loadMenuSidedItem,
67298
+ deserializeActionValue: deserializeActionValue,
67288
67299
  EShapeActionBases: EShapeActionBases,
67289
67300
  EShapeActionExpressions: EShapeActionExpressions,
67290
67301
  EShapeActionRuntimeBlinkBrighten: EShapeActionRuntimeBlinkBrighten,
@@ -67359,7 +67370,6 @@
67359
67370
  EShapeActionValueChangeCursor: EShapeActionValueChangeCursor,
67360
67371
  EShapeActionValueChangeTextType: EShapeActionValueChangeTextType,
67361
67372
  EShapeActionValueChangeText: EShapeActionValueChangeText,
67362
- EShapeActionValueDeserializer: EShapeActionValueDeserializer,
67363
67373
  EShapeActionValueEmitEvent: EShapeActionValueEmitEvent,
67364
67374
  EShapeActionValueMiscEmitEvent: EShapeActionValueMiscEmitEvent,
67365
67375
  EShapeActionValueMiscGestureType: EShapeActionValueMiscGestureType,
@@ -67546,12 +67556,15 @@
67546
67556
  createRectangleUploaded: createRectangleUploaded,
67547
67557
  createTriangleRoundedUploaded: createTriangleRoundedUploaded,
67548
67558
  createTriangleUploaded: createTriangleUploaded,
67559
+ deserializeAll: deserializeAll,
67549
67560
  deserializeBar: deserializeBar,
67561
+ deserializeBase: deserializeBase,
67550
67562
  deserializeButton: deserializeButton,
67551
67563
  deserializeCircle: deserializeCircle,
67552
67564
  deserializeConnectorLine: deserializeConnectorLine,
67553
- onConnectorLineDeserialized: onConnectorLineDeserialized,
67565
+ onDeserializedConnectorLine: onDeserializedConnectorLine,
67554
67566
  deserializeEmbedded: deserializeEmbedded,
67567
+ deserializeGradient: deserializeGradient,
67555
67568
  deserializeGroupShadowed: deserializeGroupShadowed,
67556
67569
  deserializeGroup: deserializeGroup,
67557
67570
  deserializeImageSdf: deserializeImageSdf,
@@ -67568,6 +67581,7 @@
67568
67581
  deserializeRectangle: deserializeRectangle,
67569
67582
  deserializeTriangleRounded: deserializeTriangleRounded,
67570
67583
  deserializeTriangle: deserializeTriangle,
67584
+ deserialize: deserialize,
67571
67585
  EShapeBarPoints: EShapeBarPoints,
67572
67586
  EShapeBarPosition: EShapeBarPosition,
67573
67587
  EShapeBar: EShapeBar,
@@ -67588,7 +67602,6 @@
67588
67602
  EShapeEmbedded: EShapeEmbedded,
67589
67603
  EShapeEmbeddeds: EShapeEmbeddeds,
67590
67604
  EShapeFillImpl: EShapeFillImpl,
67591
- EShapeGradients: EShapeGradients,
67592
67605
  EShapeGroupFillEditor: EShapeGroupFillEditor,
67593
67606
  EShapeGroupFillViewer: EShapeGroupFillViewer,
67594
67607
  EShapeGroupPoints: EShapeGroupPoints,
@@ -67651,9 +67664,15 @@
67651
67664
  isStatic: isStatic,
67652
67665
  toComputed: toComputed,
67653
67666
  toDash: toDash,
67654
- toThresholdDefault: toThresholdDefault,
67667
+ toGradientImageUrl: toGradientImageUrl,
67668
+ toGradientSerialized: toGradientSerialized,
67669
+ toImageElement: toImageElement,
67655
67670
  toLength: toLength,
67671
+ toResize: toResize,
67656
67672
  toScaleInvariant: toScaleInvariant,
67673
+ toSizeNormalized: toSizeNormalized,
67674
+ toSizeRounded: toSizeRounded,
67675
+ toThresholdDefault: toThresholdDefault,
67657
67676
  EShapeAcceptorImpl: EShapeAcceptorImpl,
67658
67677
  EShapeAcceptorType: EShapeAcceptorType,
67659
67678
  EShapeAcceptors: EShapeAcceptors,
@@ -67676,11 +67695,9 @@
67676
67695
  EShapeDataValueOrder: EShapeDataValueOrder,
67677
67696
  EShapeDefaults: EShapeDefaults,
67678
67697
  EShapeDeleter: EShapeDeleter,
67679
- EShapeDeserializer: EShapeDeserializer,
67680
67698
  EShapeDeserializers: EShapeDeserializers,
67681
- EShapeOnDeserialized: EShapeOnDeserialized,
67699
+ EShapeOnDeserializeds: EShapeOnDeserializeds,
67682
67700
  EShapeEditor: EShapeEditor,
67683
- EShapeImageElements: EShapeImageElements,
67684
67701
  EShapeLayerState: EShapeLayerState,
67685
67702
  toPointsBoundary: toPointsBoundary,
67686
67703
  eShapePointsFormatterCurve: eShapePointsFormatterCurve,
@@ -67702,7 +67719,6 @@
67702
67719
  EShapeRuntime: EShapeRuntime,
67703
67720
  EShapeRuntimes: EShapeRuntimes,
67704
67721
  EShapeSearch: EShapeSearch,
67705
- EShapeSizes: EShapeSizes,
67706
67722
  EShapeStateSetImplObservable: EShapeStateSetImplObservable,
67707
67723
  EShapeState: EShapeState,
67708
67724
  EShapeStrokeSide: EShapeStrokeSide,