@wcardinal/wcardinal-ui 0.149.0 → 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 (167) hide show
  1. package/dist/types/wcardinal/ui/d-view.d.ts +4 -4
  2. package/dist/types/wcardinal/ui/shape/action/{e-shape-action-value-deserializer.d.ts → deserialize-action-value.d.ts} +1 -4
  3. package/dist/types/wcardinal/ui/shape/action/index.d.ts +1 -1
  4. package/dist/types/wcardinal/ui/shape/e-shape-connector-bodies.d.ts +1 -1
  5. package/dist/types/wcardinal/ui/shape/e-shape-deserializers.d.ts +15 -4
  6. package/dist/types/wcardinal/ui/shape/index.d.ts +0 -3
  7. package/dist/types/wcardinal/ui/shape/variant/deserialize-all.d.ts +4 -0
  8. package/dist/types/wcardinal/ui/shape/variant/deserialize-bar.d.ts +1 -1
  9. package/dist/types/wcardinal/ui/shape/variant/deserialize-base.d.ts +4 -0
  10. package/dist/types/wcardinal/ui/shape/variant/deserialize-button.d.ts +1 -1
  11. package/dist/types/wcardinal/ui/shape/variant/deserialize-circle.d.ts +1 -1
  12. package/dist/types/wcardinal/ui/shape/variant/deserialize-connector-line.d.ts +2 -2
  13. package/dist/types/wcardinal/ui/shape/variant/deserialize-gradient.d.ts +2 -0
  14. package/dist/types/wcardinal/ui/shape/variant/deserialize-group-shadowed.d.ts +1 -1
  15. package/dist/types/wcardinal/ui/shape/variant/deserialize-group.d.ts +1 -1
  16. package/dist/types/wcardinal/ui/shape/variant/deserialize-image-sdf.d.ts +1 -1
  17. package/dist/types/wcardinal/ui/shape/variant/deserialize-image.d.ts +1 -1
  18. package/dist/types/wcardinal/ui/shape/variant/deserialize-label.d.ts +1 -1
  19. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-circles.d.ts +1 -1
  20. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-rectangle-roundeds.d.ts +1 -1
  21. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-rectangles.d.ts +1 -1
  22. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-triangle-roundeds.d.ts +1 -1
  23. package/dist/types/wcardinal/ui/shape/variant/deserialize-line-of-triangles.d.ts +1 -1
  24. package/dist/types/wcardinal/ui/shape/variant/deserialize-line.d.ts +1 -1
  25. package/dist/types/wcardinal/ui/shape/variant/deserialize-null.d.ts +1 -1
  26. package/dist/types/wcardinal/ui/shape/variant/deserialize-rectangle-pivoted.d.ts +1 -1
  27. package/dist/types/wcardinal/ui/shape/variant/deserialize-rectangle-rounded.d.ts +1 -1
  28. package/dist/types/wcardinal/ui/shape/variant/deserialize-rectangle.d.ts +1 -1
  29. package/dist/types/wcardinal/ui/shape/variant/deserialize-triangle-rounded.d.ts +1 -1
  30. package/dist/types/wcardinal/ui/shape/variant/deserialize-triangle.d.ts +1 -1
  31. package/dist/types/wcardinal/ui/shape/variant/deserialize.d.ts +4 -0
  32. package/dist/types/wcardinal/ui/shape/variant/e-shape-embeddeds.d.ts +1 -2
  33. package/dist/types/wcardinal/ui/shape/variant/index.d.ts +11 -2
  34. package/dist/types/wcardinal/ui/shape/variant/to-gradient-image-url.d.ts +2 -0
  35. package/dist/types/wcardinal/ui/shape/variant/to-gradient-serialized.d.ts +2 -0
  36. package/dist/types/wcardinal/ui/shape/variant/to-image-element.d.ts +1 -0
  37. package/dist/types/wcardinal/ui/shape/variant/to-resized.d.ts +3 -0
  38. package/dist/types/wcardinal/ui/shape/variant/to-size-normalized.d.ts +1 -0
  39. package/dist/types/wcardinal/ui/shape/variant/to-size-rounded.d.ts +1 -0
  40. package/dist/wcardinal/ui/d-diagrams.js +2 -2
  41. package/dist/wcardinal/ui/d-diagrams.js.map +1 -1
  42. package/dist/wcardinal/ui/d-view.js.map +1 -1
  43. package/dist/wcardinal/ui/shape/action/deserialize-action-value.js +109 -0
  44. package/dist/wcardinal/ui/shape/action/deserialize-action-value.js.map +1 -0
  45. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-absolute.js +2 -2
  46. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-absolute.js.map +1 -1
  47. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-relative.js +2 -2
  48. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-height-relative.js.map +1 -1
  49. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-absolute.js +2 -2
  50. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-absolute.js.map +1 -1
  51. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-relative.js +2 -2
  52. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-size-relative.js.map +1 -1
  53. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-absolute.js +2 -2
  54. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-absolute.js.map +1 -1
  55. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-relative.js +2 -2
  56. package/dist/wcardinal/ui/shape/action/e-shape-action-runtime-transform-resize-width-relative.js.map +1 -1
  57. package/dist/wcardinal/ui/shape/action/index.js +1 -1
  58. package/dist/wcardinal/ui/shape/action/index.js.map +1 -1
  59. package/dist/wcardinal/ui/shape/e-shape-connector-bodies.js +24 -3
  60. package/dist/wcardinal/ui/shape/e-shape-connector-bodies.js.map +1 -1
  61. package/dist/wcardinal/ui/shape/e-shape-deserializers.js +7 -1
  62. package/dist/wcardinal/ui/shape/e-shape-deserializers.js.map +1 -1
  63. package/dist/wcardinal/ui/shape/e-shape-transforms.js +3 -3
  64. package/dist/wcardinal/ui/shape/e-shape-transforms.js.map +1 -1
  65. package/dist/wcardinal/ui/shape/index.js +0 -3
  66. package/dist/wcardinal/ui/shape/index.js.map +1 -1
  67. package/dist/wcardinal/ui/shape/load/load-shape-connector-line.js +3 -3
  68. package/dist/wcardinal/ui/shape/load/load-shape-connector-line.js.map +1 -1
  69. package/dist/wcardinal/ui/shape/variant/create-image-sdf.js +3 -3
  70. package/dist/wcardinal/ui/shape/variant/create-image-sdf.js.map +1 -1
  71. package/dist/wcardinal/ui/shape/variant/create-image.js +2 -2
  72. package/dist/wcardinal/ui/shape/variant/create-image.js.map +1 -1
  73. package/dist/wcardinal/ui/shape/variant/deserialize-all.js +32 -0
  74. package/dist/wcardinal/ui/shape/variant/deserialize-all.js.map +1 -0
  75. package/dist/wcardinal/ui/shape/variant/deserialize-bar.js +4 -4
  76. package/dist/wcardinal/ui/shape/variant/deserialize-bar.js.map +1 -1
  77. package/dist/wcardinal/ui/shape/variant/deserialize-base.js +100 -0
  78. package/dist/wcardinal/ui/shape/variant/deserialize-base.js.map +1 -0
  79. package/dist/wcardinal/ui/shape/variant/deserialize-button.js +4 -5
  80. package/dist/wcardinal/ui/shape/variant/deserialize-button.js.map +1 -1
  81. package/dist/wcardinal/ui/shape/variant/deserialize-circle.js +3 -3
  82. package/dist/wcardinal/ui/shape/variant/deserialize-circle.js.map +1 -1
  83. package/dist/wcardinal/ui/shape/variant/deserialize-connector-line.js +7 -6
  84. package/dist/wcardinal/ui/shape/variant/deserialize-connector-line.js.map +1 -1
  85. package/dist/wcardinal/ui/shape/variant/deserialize-embedded.js +15 -2
  86. package/dist/wcardinal/ui/shape/variant/deserialize-embedded.js.map +1 -1
  87. package/dist/wcardinal/ui/shape/variant/deserialize-gradient.js +34 -0
  88. package/dist/wcardinal/ui/shape/variant/deserialize-gradient.js.map +1 -0
  89. package/dist/wcardinal/ui/shape/variant/deserialize-group-shadowed.js +4 -4
  90. package/dist/wcardinal/ui/shape/variant/deserialize-group-shadowed.js.map +1 -1
  91. package/dist/wcardinal/ui/shape/variant/deserialize-group.js +4 -4
  92. package/dist/wcardinal/ui/shape/variant/deserialize-group.js.map +1 -1
  93. package/dist/wcardinal/ui/shape/variant/deserialize-image-sdf.js +3 -3
  94. package/dist/wcardinal/ui/shape/variant/deserialize-image-sdf.js.map +1 -1
  95. package/dist/wcardinal/ui/shape/variant/deserialize-image.js +3 -3
  96. package/dist/wcardinal/ui/shape/variant/deserialize-image.js.map +1 -1
  97. package/dist/wcardinal/ui/shape/variant/deserialize-label.js +3 -3
  98. package/dist/wcardinal/ui/shape/variant/deserialize-label.js.map +1 -1
  99. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-circles.js +3 -3
  100. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-circles.js.map +1 -1
  101. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangle-roundeds.js +3 -3
  102. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangle-roundeds.js.map +1 -1
  103. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangles.js +3 -3
  104. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-rectangles.js.map +1 -1
  105. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangle-roundeds.js +3 -3
  106. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangle-roundeds.js.map +1 -1
  107. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangles.js +3 -3
  108. package/dist/wcardinal/ui/shape/variant/deserialize-line-of-triangles.js.map +1 -1
  109. package/dist/wcardinal/ui/shape/variant/deserialize-line.js +4 -4
  110. package/dist/wcardinal/ui/shape/variant/deserialize-line.js.map +1 -1
  111. package/dist/wcardinal/ui/shape/variant/deserialize-null.js +3 -3
  112. package/dist/wcardinal/ui/shape/variant/deserialize-null.js.map +1 -1
  113. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-pivoted.js +3 -3
  114. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-pivoted.js.map +1 -1
  115. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-rounded.js +3 -3
  116. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle-rounded.js.map +1 -1
  117. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle.js +3 -3
  118. package/dist/wcardinal/ui/shape/variant/deserialize-rectangle.js.map +1 -1
  119. package/dist/wcardinal/ui/shape/variant/deserialize-triangle-rounded.js +3 -3
  120. package/dist/wcardinal/ui/shape/variant/deserialize-triangle-rounded.js.map +1 -1
  121. package/dist/wcardinal/ui/shape/variant/deserialize-triangle.js +3 -3
  122. package/dist/wcardinal/ui/shape/variant/deserialize-triangle.js.map +1 -1
  123. package/dist/wcardinal/ui/shape/variant/deserialize.js +17 -0
  124. package/dist/wcardinal/ui/shape/variant/deserialize.js.map +1 -0
  125. package/dist/wcardinal/ui/shape/variant/e-shape-base.js +9 -2
  126. package/dist/wcardinal/ui/shape/variant/e-shape-base.js.map +1 -1
  127. package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js +2 -0
  128. package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js.map +1 -1
  129. package/dist/wcardinal/ui/shape/variant/e-shape-embeddeds.js +0 -13
  130. package/dist/wcardinal/ui/shape/variant/e-shape-embeddeds.js.map +1 -1
  131. package/dist/wcardinal/ui/shape/variant/index.js +11 -2
  132. package/dist/wcardinal/ui/shape/variant/index.js.map +1 -1
  133. package/dist/wcardinal/ui/shape/variant/to-gradient-image-url.js +35 -0
  134. package/dist/wcardinal/ui/shape/variant/to-gradient-image-url.js.map +1 -0
  135. package/dist/wcardinal/ui/shape/variant/to-gradient-serialized.js +15 -0
  136. package/dist/wcardinal/ui/shape/variant/to-gradient-serialized.js.map +1 -0
  137. package/dist/wcardinal/ui/shape/variant/to-image-element.js +32 -0
  138. package/dist/wcardinal/ui/shape/variant/to-image-element.js.map +1 -0
  139. package/dist/wcardinal/ui/shape/variant/to-resized.js +52 -0
  140. package/dist/wcardinal/ui/shape/variant/to-resized.js.map +1 -0
  141. package/dist/wcardinal/ui/shape/variant/to-size-normalized.js +12 -0
  142. package/dist/wcardinal/ui/shape/variant/to-size-normalized.js.map +1 -0
  143. package/dist/wcardinal/ui/shape/variant/to-size-rounded.js +8 -0
  144. package/dist/wcardinal/ui/shape/variant/to-size-rounded.js.map +1 -0
  145. package/dist/wcardinal-ui-theme-dark.js +1 -1
  146. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  147. package/dist/wcardinal-ui-theme-white.js +1 -1
  148. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  149. package/dist/wcardinal-ui.cjs.js +2519 -2479
  150. package/dist/wcardinal-ui.js +1954 -1914
  151. package/dist/wcardinal-ui.min.js +2 -2
  152. package/dist/wcardinal-ui.min.js.map +1 -1
  153. package/package.json +1 -1
  154. package/dist/types/wcardinal/ui/shape/e-shape-deserializer.d.ts +0 -10
  155. package/dist/types/wcardinal/ui/shape/e-shape-image-elements.d.ts +0 -6
  156. package/dist/types/wcardinal/ui/shape/e-shape-sizes.d.ts +0 -7
  157. package/dist/types/wcardinal/ui/shape/variant/e-shape-gradients.d.ts +0 -9
  158. package/dist/wcardinal/ui/shape/action/e-shape-action-value-deserializer.js +0 -115
  159. package/dist/wcardinal/ui/shape/action/e-shape-action-value-deserializer.js.map +0 -1
  160. package/dist/wcardinal/ui/shape/e-shape-deserializer.js +0 -143
  161. package/dist/wcardinal/ui/shape/e-shape-deserializer.js.map +0 -1
  162. package/dist/wcardinal/ui/shape/e-shape-image-elements.js +0 -35
  163. package/dist/wcardinal/ui/shape/e-shape-image-elements.js.map +0 -1
  164. package/dist/wcardinal/ui/shape/e-shape-sizes.js +0 -66
  165. package/dist/wcardinal/ui/shape/e-shape-sizes.js.map +0 -1
  166. package/dist/wcardinal/ui/shape/variant/e-shape-gradients.js +0 -89
  167. package/dist/wcardinal/ui/shape/variant/e-shape-gradients.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.149.0
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
  /*
@@ -30915,14 +30744,35 @@
30915
30744
  var EShapeConnectorBodies = /** @class */ (function () {
30916
30745
  function EShapeConnectorBodies() {
30917
30746
  }
30918
- EShapeConnectorBodies.from = function (values) {
30747
+ EShapeConnectorBodies.from = function (values, tailMargin, headMargin) {
30919
30748
  var result = [];
30920
30749
  var length = values.length;
30921
30750
  if (4 < length) {
30751
+ var threshold = 0.000001;
30922
30752
  var x0 = values[0];
30923
30753
  var y0 = values[1];
30754
+ if (tailMargin !== 0) {
30755
+ var ex = x0 - values[2];
30756
+ var ey = y0 - values[3];
30757
+ var n = ex * ex + ey * ey;
30758
+ if (threshold < n) {
30759
+ var f = tailMargin / Math.sqrt(n);
30760
+ x0 += ex * f;
30761
+ y0 += ey * f;
30762
+ }
30763
+ }
30924
30764
  var x1 = values[length - 2];
30925
30765
  var y1 = values[length - 1];
30766
+ if (headMargin !== 0) {
30767
+ var ex = x1 - values[length - 4];
30768
+ var ey = y1 - values[length - 3];
30769
+ var n = ex * ex + ey * ey;
30770
+ if (threshold < n) {
30771
+ var f = headMargin / Math.sqrt(n);
30772
+ x1 += ex * f;
30773
+ y1 += ey * f;
30774
+ }
30775
+ }
30926
30776
  var cx = (x1 + x0) * 0.5;
30927
30777
  var cy = (y1 + y0) * 0.5;
30928
30778
  var dx = x1 - x0;
@@ -30931,11 +30781,11 @@
30931
30781
  var c = Math.cos(a);
30932
30782
  var s = Math.sin(a);
30933
30783
  var l = dx * dx + dy * dy;
30934
- var m = 0.000001 < l ? 1 / Math.sqrt(l) : 1;
30784
+ var m = threshold < l ? 1 / Math.sqrt(l) : 1;
30935
30785
  for (var i = 2, imax = length - 2; i < imax; i += 2) {
30936
30786
  var x = values[i + 0] - cx;
30937
30787
  var y = values[i + 1] - cy;
30938
- result.push((c * x - s * y) * m, (c * y + s * x) * m);
30788
+ result.push((c * x + s * y) * m, (c * y - s * x) * m);
30939
30789
  }
30940
30790
  }
30941
30791
  return result;
@@ -31664,6 +31514,8 @@
31664
31514
  values[3 + bodyValuesLength] = y1 + dy * f;
31665
31515
  }
31666
31516
  }
31517
+ // Remove the rest
31518
+ values.length = bodyValuesLength + 4;
31667
31519
  // Center & size
31668
31520
  var boundary = ((_a = EShapeConnectorLine.WORK_BOUNDARY) !== null && _a !== void 0 ? _a : (EShapeConnectorLine.WORK_BOUNDARY = [0, 0, 0, 0]));
31669
31521
  toPointsBoundary(values, boundary);
@@ -31714,10 +31566,10 @@
31714
31566
  * Copyright (C) 2019 Toshiba Corporation
31715
31567
  * SPDX-License-Identifier: Apache-2.0
31716
31568
  */
31717
- var deserializeConnectorLine = function (item, manager) {
31718
- return EShapeDeserializer.deserialize(item, manager, new EShapeConnectorLine());
31569
+ var deserializeConnectorLine = function (item, manager, shape) {
31570
+ return deserializeBase(item, manager, shape || new EShapeConnectorLine());
31719
31571
  };
31720
- var onConnectorLineDeserialized = function (item, shape, mapping, manager) {
31572
+ var onDeserializedConnectorLine = function (item, shape, mapping, manager) {
31721
31573
  if (shape instanceof EShapeConnectorLine) {
31722
31574
  var resources = manager.resources;
31723
31575
  var resourceId = item[15];
@@ -31733,7 +31585,8 @@
31733
31585
  var points = shape.points;
31734
31586
  points.deserialize(parsed[1], manager);
31735
31587
  // Edge
31736
- shape.edge.deserialize(parsed[0], mapping, manager);
31588
+ var edge = shape.edge;
31589
+ edge.deserialize(parsed[0], mapping, manager);
31737
31590
  // Body
31738
31591
  var body = shape.body;
31739
31592
  var bodyId = parsed[2];
@@ -31742,7 +31595,7 @@
31742
31595
  }
31743
31596
  else {
31744
31597
  // The following is for backward compatibility.
31745
- body.set(EShapeConnectorBodies.from(points.values));
31598
+ body.set(EShapeConnectorBodies.from(points.values, edge.tail.margin, edge.head.margin));
31746
31599
  }
31747
31600
  // Unlock
31748
31601
  shape.unlock();
@@ -31757,7 +31610,7 @@
31757
31610
  var loadShapeConnectorLine = function () {
31758
31611
  EShapeUploadeds[EShapeType.CONNECTOR_LINE] = createLineUploaded;
31759
31612
  EShapeDeserializers[EShapeType.CONNECTOR_LINE] = deserializeConnectorLine;
31760
- EShapeOnDeserialized[EShapeType.CONNECTOR_LINE] = onConnectorLineDeserialized;
31613
+ EShapeOnDeserializeds[EShapeType.CONNECTOR_LINE] = onDeserializedConnectorLine;
31761
31614
  EShapeCapabilities.set(EShapeType.CONNECTOR_LINE, EShapeCapability.CONNECTOR);
31762
31615
  };
31763
31616
 
@@ -31866,251 +31719,694 @@
31866
31719
  * Copyright (C) 2019 Toshiba Corporation
31867
31720
  * SPDX-License-Identifier: Apache-2.0
31868
31721
  */
31869
- var EShapeResourceManagerDeserialization = /** @class */ (function () {
31870
- function EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode) {
31871
- this.resources = serialized.resources;
31872
- this.data = serialized.data || serialized.tags || serialized.resources;
31873
- this.pieces = pieces;
31874
- this.pieceData = pieceData;
31875
- this.isEditMode = isEditMode;
31876
- this._actions = new Map();
31877
- this._fills = new Map();
31878
- this._strokes = new Map();
31879
- this._data = new Map();
31880
- this._dataValues = new Map();
31881
- this._ranges = new Map();
31882
- this._aligns = new Map();
31883
- this._margins = new Map();
31884
- this._texts = new Map();
31885
- this._textOutlines = new Map();
31886
- this._extensions = new Map();
31722
+ var EShapeGroupTextAlignEditor = /** @class */ (function () {
31723
+ function EShapeGroupTextAlignEditor(parent) {
31724
+ this._parent = parent;
31887
31725
  }
31888
- EShapeResourceManagerDeserialization.prototype.getAction = function (id) {
31889
- return this._actions.get(id);
31890
- };
31891
- EShapeResourceManagerDeserialization.prototype.setAction = function (id, action) {
31892
- this._actions.set(id, action);
31893
- };
31894
- EShapeResourceManagerDeserialization.prototype.getFill = function (id) {
31895
- return this._fills.get(id);
31896
- };
31897
- EShapeResourceManagerDeserialization.prototype.setFill = function (id, fill) {
31898
- this._fills.set(id, fill);
31899
- };
31900
- EShapeResourceManagerDeserialization.prototype.getStroke = function (id) {
31901
- return this._strokes.get(id);
31902
- };
31903
- EShapeResourceManagerDeserialization.prototype.setStroke = function (id, stroke) {
31904
- this._strokes.set(id, stroke);
31905
- };
31906
- EShapeResourceManagerDeserialization.prototype.getData = function (id) {
31907
- return this._data.get(id);
31908
- };
31909
- EShapeResourceManagerDeserialization.prototype.setData = function (id, data) {
31910
- this._data.set(id, data);
31911
- };
31912
- EShapeResourceManagerDeserialization.prototype.getDataValue = function (id) {
31913
- return this._dataValues.get(id);
31914
- };
31915
- EShapeResourceManagerDeserialization.prototype.setDataValue = function (id, dataValue) {
31916
- this._dataValues.set(id, dataValue);
31917
- };
31918
- EShapeResourceManagerDeserialization.prototype.getRange = function (id) {
31919
- return this._ranges.get(id);
31920
- };
31921
- EShapeResourceManagerDeserialization.prototype.setRange = function (id, range) {
31922
- this._ranges.set(id, range);
31923
- };
31924
- EShapeResourceManagerDeserialization.prototype.getAlign = function (id) {
31925
- return this._aligns.get(id);
31926
- };
31927
- EShapeResourceManagerDeserialization.prototype.setAlign = function (id, align) {
31928
- this._aligns.set(id, align);
31929
- };
31930
- EShapeResourceManagerDeserialization.prototype.getMargin = function (id) {
31931
- return this._margins.get(id);
31932
- };
31933
- EShapeResourceManagerDeserialization.prototype.setMargin = function (id, margin) {
31934
- this._margins.set(id, margin);
31935
- };
31936
- EShapeResourceManagerDeserialization.prototype.getText = function (id) {
31937
- return this._texts.get(id);
31938
- };
31939
- EShapeResourceManagerDeserialization.prototype.setText = function (id, text) {
31940
- 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
+ }
31941
31765
  };
31942
- EShapeResourceManagerDeserialization.prototype.getTextOutline = function (id) {
31943
- 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
+ }
31944
31771
  };
31945
- EShapeResourceManagerDeserialization.prototype.setTextOutline = function (id, textOutline) {
31946
- 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
+ };
31947
31781
  };
31948
- EShapeResourceManagerDeserialization.prototype.getExtension = function (id) {
31949
- return this._extensions.get(id);
31782
+ EShapeGroupTextAlignEditor.prototype.serialize = function (manager) {
31783
+ return -1;
31950
31784
  };
31951
- EShapeResourceManagerDeserialization.prototype.setExtension = function (id, extension) {
31952
- this._extensions.set(id, extension);
31785
+ EShapeGroupTextAlignEditor.prototype.deserialize = function (target, manager) {
31786
+ // DO NOTHING
31953
31787
  };
31954
- return EShapeResourceManagerDeserialization;
31955
- }());
31956
-
31957
- var EShapeEmbeddedDatum = /** @class */ (function () {
31958
- function EShapeEmbeddedDatum(name, width, height, layer) {
31959
- this.name = name;
31960
- this.width = width;
31961
- this.height = height;
31962
- this.layer = layer;
31963
- }
31964
- return EShapeEmbeddedDatum;
31788
+ return EShapeGroupTextAlignEditor;
31965
31789
  }());
31966
31790
 
31967
31791
  /*
31968
31792
  * Copyright (C) 2019 Toshiba Corporation
31969
31793
  * SPDX-License-Identifier: Apache-2.0
31970
31794
  */
31971
- var EShapeConnectors = /** @class */ (function () {
31972
- function EShapeConnectors() {
31795
+ var EShapeGroupTextOffsetEditor = /** @class */ (function () {
31796
+ function EShapeGroupTextOffsetEditor(parent) {
31797
+ this._parent = parent;
31973
31798
  }
31974
- EShapeConnectors.isConnector = function (target) {
31975
- return target != null && target.type === EShapeType.CONNECTOR_LINE;
31976
- };
31977
- EShapeConnectors.newMapping = function (sources, destinations, result) {
31978
- var _a;
31979
- if (result == null) {
31980
- result = (_a = EShapeConnectors._MAPPING) !== null && _a !== void 0 ? _a : (EShapeConnectors._MAPPING = new Map());
31981
- 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);
31982
31837
  }
31983
- for (var i = 0, imax = sources.length; i < imax; ++i) {
31984
- var fromChild = sources[i];
31985
- var toChild = destinations[i];
31986
- result.set(fromChild, toChild);
31987
- 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);
31988
31843
  }
31989
- return result;
31990
31844
  };
31991
- EShapeConnectors.moveAll = function (rootSources, rootDestinations, sources, destinations, mapping) {
31992
- for (var i = 0, imax = sources.length; i < imax; ++i) {
31993
- var source = sources[i];
31994
- var destination = destinations[i];
31995
- if (this.isConnector(source)) {
31996
- if (this.isConnector(destination)) {
31997
- var sourceEdge = source.edge;
31998
- var destEdge = destination.edge;
31999
- var sourceHead = sourceEdge.head;
32000
- var sourceHeadShape = sourceHead.acceptor.shape;
32001
- if (sourceHeadShape) {
32002
- if (mapping == null) {
32003
- mapping = this.newMapping(rootSources, rootDestinations);
32004
- }
32005
- var destHeadShape = mapping.get(sourceHeadShape);
32006
- if (destHeadShape) {
32007
- var destHead = destEdge.head;
32008
- destHead.detach();
32009
- destHead.set(destHeadShape);
32010
- destHead.attach();
32011
- destHeadShape.connector.remove(sourceHead);
32012
- }
32013
- }
32014
- var sourceTail = sourceEdge.tail;
32015
- var sourceTailShape = sourceTail.acceptor.shape;
32016
- if (sourceTailShape) {
32017
- if (mapping == null) {
32018
- mapping = this.newMapping(rootSources, rootDestinations);
32019
- }
32020
- var destTailShape = mapping.get(sourceTailShape);
32021
- if (destTailShape) {
32022
- var destTail = destEdge.tail;
32023
- destTail.detach();
32024
- destTail.set(destTailShape);
32025
- destTail.attach();
32026
- destTailShape.connector.remove(sourceTail);
32027
- }
32028
- }
32029
- }
32030
- }
32031
- 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();
32032
31849
  }
32033
- return mapping;
31850
+ return {
31851
+ horizontal: 0,
31852
+ vertical: 0
31853
+ };
32034
31854
  };
32035
- EShapeConnectors.move = function (from, to) {
32036
- var fromChildren = from.children;
32037
- var toChildren = to.children;
32038
- this.moveAll(fromChildren, toChildren, fromChildren, toChildren);
31855
+ EShapeGroupTextOffsetEditor.prototype.serialize = function (manager) {
31856
+ return -1;
32039
31857
  };
32040
- return EShapeConnectors;
31858
+ EShapeGroupTextOffsetEditor.prototype.deserialize = function (target, manager) {
31859
+ // DO NOTHING
31860
+ };
31861
+ return EShapeGroupTextOffsetEditor;
32041
31862
  }());
32042
31863
 
32043
31864
  /*
32044
31865
  * Copyright (C) 2019 Toshiba Corporation
32045
31866
  * SPDX-License-Identifier: Apache-2.0
32046
31867
  */
32047
- var EShapeLayerState = {
32048
- INVISIBLE: "INVISIBLE",
32049
- INTERACTIVE: "INTERACTIVE",
32050
- DRAGGABLE: "DRAGGABLE",
32051
- PINCHABLE: "PINCHABLE"
32052
- };
32053
-
32054
- /*
32055
- * Copyright (C) 2019 Toshiba Corporation
32056
- * SPDX-License-Identifier: Apache-2.0
32057
- */
32058
- var EShapeGroupFillViewer = /** @class */ (function () {
32059
- function EShapeGroupFillViewer() {
32060
- // DO NOTHING
31868
+ var EShapeGroupTextOutlineEditor = /** @class */ (function () {
31869
+ function EShapeGroupTextOutlineEditor(parent) {
31870
+ this._parent = parent;
32061
31871
  }
32062
- Object.defineProperty(EShapeGroupFillViewer.prototype, "enable", {
31872
+ Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "enable", {
32063
31873
  get: function () {
32064
- 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;
32065
31879
  },
32066
31880
  set: function (enable) {
32067
- // 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
+ }
32068
31885
  },
32069
31886
  enumerable: false,
32070
31887
  configurable: true
32071
31888
  });
32072
- Object.defineProperty(EShapeGroupFillViewer.prototype, "color", {
31889
+ Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "color", {
32073
31890
  get: function () {
31891
+ var children = this._parent.children;
31892
+ if (0 < children.length) {
31893
+ return children[children.length - 1].text.outline.color;
31894
+ }
32074
31895
  return 0xffffff;
32075
31896
  },
32076
31897
  set: function (color) {
32077
- // 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
+ }
32078
31902
  },
32079
31903
  enumerable: false,
32080
31904
  configurable: true
32081
31905
  });
32082
- Object.defineProperty(EShapeGroupFillViewer.prototype, "alpha", {
31906
+ Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "alpha", {
32083
31907
  get: function () {
31908
+ var children = this._parent.children;
31909
+ if (0 < children.length) {
31910
+ return children[children.length - 1].text.outline.alpha;
31911
+ }
32084
31912
  return 1.0;
32085
31913
  },
32086
31914
  set: function (alpha) {
32087
- // 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
+ }
32088
31919
  },
32089
31920
  enumerable: false,
32090
31921
  configurable: true
32091
31922
  });
32092
- EShapeGroupFillViewer.prototype.copy = function (target) {
32093
- // DO NOTHING
32094
- };
32095
- EShapeGroupFillViewer.prototype.set = function (enable, color, alpha) {
32096
- // DO NOTHING
32097
- };
32098
- EShapeGroupFillViewer.prototype.clone = function () {
32099
- return new EShapeGroupFillViewer();
32100
- };
32101
- EShapeGroupFillViewer.prototype.toObject = function () {
32102
- return {
32103
- enable: true,
32104
- color: 0xffffff,
32105
- alpha: 1.0
32106
- };
32107
- };
32108
- EShapeGroupFillViewer.prototype.serialize = function (manager) {
32109
- return -1;
32110
- };
32111
- EShapeGroupFillViewer.prototype.deserialize = function (target, manager) {
32112
- // DO NOTHING
32113
- };
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
+ }
31945
+ };
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();
32396
+ };
32397
+ EShapeGroupFillViewer.prototype.toObject = function () {
32398
+ return {
32399
+ enable: true,
32400
+ color: 0xffffff,
32401
+ alpha: 1.0
32402
+ };
32403
+ };
32404
+ EShapeGroupFillViewer.prototype.serialize = function (manager) {
32405
+ return -1;
32406
+ };
32407
+ EShapeGroupFillViewer.prototype.deserialize = function (target, manager) {
32408
+ // DO NOTHING
32409
+ };
32114
32410
  return EShapeGroupFillViewer;
32115
32411
  }());
32116
32412
 
@@ -32139,7 +32435,7 @@
32139
32435
  EShapeTransforms.prepare = function (shape) {
32140
32436
  var editor = shape.editor || new EShapeEditor();
32141
32437
  shape.editor = editor;
32142
- // Ttransform
32438
+ // Transform
32143
32439
  shape.updateTransform();
32144
32440
  var parent = shape.parent;
32145
32441
  if (parent instanceof EShapeBase) {
@@ -32210,7 +32506,7 @@
32210
32506
  if (bx != null && by != null) {
32211
32507
  var sx = Math.sqrt(a * a + b * b);
32212
32508
  var sy = Math.sqrt(c * c + d * d);
32213
- shape.size.set(EShapeSizes.toNormalized(bx * sx), EShapeSizes.toNormalized(by * sy));
32509
+ shape.size.set(toSizeNormalized(bx * sx), toSizeNormalized(by * sy));
32214
32510
  }
32215
32511
  //
32216
32512
  shape.allowUploadedUpdate();
@@ -33234,949 +33530,6 @@
33234
33530
  return EShapeGroupViewer;
33235
33531
  }(EShapeBase));
33236
33532
 
33237
- /*
33238
- * Copyright (C) 2019 Toshiba Corporation
33239
- * SPDX-License-Identifier: Apache-2.0
33240
- */
33241
- var EShapeEmbeddedLayer = /** @class */ (function (_super) {
33242
- __extends(EShapeEmbeddedLayer, _super);
33243
- function EShapeEmbeddedLayer(name, isEditMode, type) {
33244
- if (type === void 0) { type = EShapeType.EMBEDDED_LAYER; }
33245
- var _this = _super.call(this, isEditMode, type) || this;
33246
- _this._name = name;
33247
- return _this;
33248
- }
33249
- Object.defineProperty(EShapeEmbeddedLayer.prototype, "name", {
33250
- get: function () {
33251
- return this._name;
33252
- },
33253
- enumerable: false,
33254
- configurable: true
33255
- });
33256
- EShapeEmbeddedLayer.prototype.newGroupFill = function () {
33257
- return new EShapeFillImpl(this, false, 0xffffff, 1);
33258
- };
33259
- EShapeEmbeddedLayer.prototype.isGroupSizeFittable = function () {
33260
- return false;
33261
- };
33262
- EShapeEmbeddedLayer.prototype.clone = function () {
33263
- var result = this.newClone().copy(this);
33264
- var children = this.children;
33265
- for (var i = 0, imax = children.length; i < imax; ++i) {
33266
- var clone = children[i].clone();
33267
- clone.parent = result;
33268
- result.children.push(clone);
33269
- }
33270
- result.onChildTransformChange();
33271
- result.toDirty();
33272
- result.size.init();
33273
- return result;
33274
- };
33275
- EShapeEmbeddedLayer.prototype.newClone = function () {
33276
- var constructor = this.constructor;
33277
- return new constructor(this._name, this._isEditMode, this.type);
33278
- };
33279
- EShapeEmbeddedLayer.prototype.serializeChildren = function (manager) {
33280
- return [];
33281
- };
33282
- EShapeEmbeddedLayer.prototype.serializeImage = function (manager) {
33283
- return -1;
33284
- };
33285
- EShapeEmbeddedLayer.prototype.serializeGradient = function (manager) {
33286
- return -1;
33287
- };
33288
- EShapeEmbeddedLayer.deserialize = function (serialized, manager, width, height) {
33289
- var _a, _b, _c;
33290
- var result = new EShapeEmbeddedLayer(this.deserializeName(serialized[0], manager), manager.isEditMode);
33291
- var visibility = serialized[1];
33292
- var visible = visibility == null || !!(visibility & 0x2);
33293
- if (!visible) {
33294
- result.visible = false;
33295
- result.state.add(EShapeLayerState.INVISIBLE);
33296
- }
33297
- var positionX = -0.5 * width + (serialized[2] || 0);
33298
- var positionY = -0.5 * height + (serialized[3] || 0);
33299
- result.transform.position.set(positionX, positionY);
33300
- var sizeX = (_a = serialized[4]) !== null && _a !== void 0 ? _a : width;
33301
- var sizeY = (_b = serialized[5]) !== null && _b !== void 0 ? _b : height;
33302
- result.size.set(sizeX, sizeY);
33303
- var fillId = serialized[6];
33304
- if (fillId != null) {
33305
- result.fill.deserialize(fillId, manager);
33306
- }
33307
- if (!manager.isEditMode) {
33308
- var state = (_c = serialized[7]) !== null && _c !== void 0 ? _c : 1;
33309
- var isInteractive = state & 0x1;
33310
- var isDraggable = state & 0x2;
33311
- var isPinchable = state & 0x4;
33312
- if (isDraggable || isPinchable) {
33313
- var gestureType = (isDraggable
33314
- ? EShapeActionValueMiscGestureType.DRAG
33315
- : EShapeActionValueMiscGestureType.NONE) |
33316
- (isPinchable
33317
- ? EShapeActionValueMiscGestureType.PINCH
33318
- : EShapeActionValueMiscGestureType.NONE);
33319
- result.action.add(new EShapeActionValueMiscLayerGesture("", gestureType));
33320
- }
33321
- if (isInteractive || isDraggable || isPinchable) {
33322
- result.interactive = true;
33323
- }
33324
- }
33325
- return result;
33326
- };
33327
- EShapeEmbeddedLayer.deserializeName = function (target, manager) {
33328
- if (isString(target)) {
33329
- return target;
33330
- }
33331
- else {
33332
- var resources = manager.resources;
33333
- if (0 <= target && target <= resources.length) {
33334
- return resources[target];
33335
- }
33336
- return "";
33337
- }
33338
- };
33339
- return EShapeEmbeddedLayer;
33340
- }(EShapeGroupViewer));
33341
-
33342
- /*
33343
- * Copyright (C) 2019 Toshiba Corporation
33344
- * SPDX-License-Identifier: Apache-2.0
33345
- */
33346
- var EShapeEmbeddedLayerContainer = /** @class */ (function () {
33347
- function EShapeEmbeddedLayerContainer(width, height, isEditMode) {
33348
- this.children = [];
33349
- this._width = width;
33350
- this._height = height;
33351
- this._isEditMode = isEditMode;
33352
- }
33353
- EShapeEmbeddedLayerContainer.prototype.hasConnectors = function (shapes) {
33354
- for (var i = 0, imax = shapes.length; i < imax; ++i) {
33355
- var shape = shapes[i];
33356
- if (shape.type === EShapeType.CONNECTOR_LINE) {
33357
- return true;
33358
- }
33359
- var children = shape.children;
33360
- if (0 < children.length) {
33361
- if (this.hasConnectors(children)) {
33362
- return true;
33363
- }
33364
- }
33365
- }
33366
- return false;
33367
- };
33368
- EShapeEmbeddedLayerContainer.prototype.newHasConnectors = function () {
33369
- var result = new Map();
33370
- var layers = this.children;
33371
- for (var i = 0, imax = layers.length; i < imax; ++i) {
33372
- var layer = layers[i];
33373
- result.set(layer, this.hasConnectors(layer.children));
33374
- }
33375
- return result;
33376
- };
33377
- EShapeEmbeddedLayerContainer.prototype.copyTo = function (destination) {
33378
- var _a;
33379
- var hasConnectors = ((_a = this._hasConnectors) !== null && _a !== void 0 ? _a : (this._hasConnectors = this.newHasConnectors()));
33380
- var layers = this.children;
33381
- var children = destination.children;
33382
- for (var i = 0, imax = layers.length; i < imax; ++i) {
33383
- var layer = layers[i];
33384
- var clone = layer.clone();
33385
- clone.parent = destination;
33386
- children.push(clone);
33387
- if (hasConnectors.get(layer)) {
33388
- EShapeConnectors.move(layer, clone);
33389
- }
33390
- }
33391
- destination.onChildTransformChange();
33392
- destination.toDirty();
33393
- destination.onAttach();
33394
- };
33395
- EShapeEmbeddedLayerContainer.prototype.deserialize = function (serializedLayers, manager) {
33396
- var serializedLayersLength = serializedLayers.length;
33397
- if (0 < serializedLayersLength) {
33398
- var width = this._width;
33399
- var height = this._height;
33400
- for (var i = 0; i < serializedLayersLength; ++i) {
33401
- this.children.push(EShapeEmbeddedLayer.deserialize(serializedLayers[i], manager, width, height));
33402
- }
33403
- }
33404
- };
33405
- return EShapeEmbeddedLayerContainer;
33406
- }());
33407
-
33408
- /*
33409
- * Copyright (C) 2019 Toshiba Corporation
33410
- * SPDX-License-Identifier: Apache-2.0
33411
- */
33412
- var DDiagrams = /** @class */ (function () {
33413
- function DDiagrams() {
33414
- }
33415
- DDiagrams.toSimple = function (serialized) {
33416
- return {
33417
- version: serialized.version,
33418
- id: serialized.id,
33419
- name: serialized.name,
33420
- thumbnail: serialized.thumbnail,
33421
- data: JSON.stringify({
33422
- width: serialized.width,
33423
- height: serialized.height,
33424
- background: serialized.background,
33425
- tile: serialized.tile,
33426
- resources: serialized.resources,
33427
- data: serialized.data || serialized.tags,
33428
- pieces: serialized.pieces,
33429
- layers: serialized.layers,
33430
- items: serialized.items,
33431
- snap: serialized.snap
33432
- })
33433
- };
33434
- };
33435
- DDiagrams.toSerialized = function (target) {
33436
- if (!("items" in target)) {
33437
- var data = JSON.parse(target.data);
33438
- var result = {
33439
- version: target.version,
33440
- id: target.id,
33441
- name: target.name,
33442
- width: data.width,
33443
- height: data.height,
33444
- background: data.background,
33445
- tile: data.tile,
33446
- resources: data.resources,
33447
- data: data.data || data.tags,
33448
- pieces: data.pieces,
33449
- layers: data.layers,
33450
- items: data.items,
33451
- snap: data.snap,
33452
- thumbnail: target.thumbnail
33453
- };
33454
- if (result.data == null) {
33455
- var tags = target.tags;
33456
- if (tags != null) {
33457
- result.data = JSON.parse(tags);
33458
- }
33459
- }
33460
- if (result.pieces == null) {
33461
- var pieces = target.pieces;
33462
- if (pieces != null) {
33463
- result.pieces = JSON.parse(pieces);
33464
- }
33465
- }
33466
- return result;
33467
- }
33468
- return target;
33469
- };
33470
- DDiagrams.newLayer = function (serialized, container, manager) {
33471
- // Layers
33472
- container.deserialize(serialized.layers, manager);
33473
- // Items
33474
- var serializedItems = serialized.items;
33475
- var shapePromises = EShapeDeserializer.deserializeAll(serializedItems, manager);
33476
- if (shapePromises != null) {
33477
- return shapePromises.then(function (shapes) {
33478
- var layers = container.children;
33479
- for (var i = 0, imax = shapes.length; i < imax; ++i) {
33480
- var serializedItem = serializedItems[i];
33481
- var shape = shapes[i];
33482
- var layer = layers[serializedItem[16]];
33483
- if (layer != null) {
33484
- shape.parent = layer;
33485
- shape.uploaded = undefined;
33486
- layer.children.push(shape);
33487
- }
33488
- }
33489
- for (var i = 0, imax = layers.length; i < imax; ++i) {
33490
- var layer = layers[i];
33491
- layer.onChildTransformChange();
33492
- layer.toDirty();
33493
- var children = layer.children;
33494
- for (var j = 0, jmax = children.length; j < jmax; ++j) {
33495
- children[j].onAttach();
33496
- }
33497
- }
33498
- return shapes;
33499
- });
33500
- }
33501
- else {
33502
- return Promise.resolve([]);
33503
- }
33504
- };
33505
- DDiagrams.toPieceData = function (controller, pieces, isEditMode) {
33506
- var result = new Map();
33507
- var onFulfilled = function () {
33508
- return result;
33509
- };
33510
- return this.toPieceData_(controller, pieces, result, isEditMode).then(onFulfilled, onFulfilled);
33511
- };
33512
- DDiagrams.toPieceData_ = function (controller, pieces, pieceData, isEditMode) {
33513
- var _this = this;
33514
- var promises = [];
33515
- if (pieces && 0 < pieces.length && controller) {
33516
- var _loop_1 = function (i, imax) {
33517
- var piece = pieces[i];
33518
- if (!pieceData.has(piece)) {
33519
- pieceData.set(piece, null);
33520
- promises.push(controller.piece.getByName(piece).then(function (found) {
33521
- return _this.toPieceData__(controller, piece, found, isEditMode, pieceData);
33522
- }, function () {
33523
- return null;
33524
- }));
33525
- }
33526
- };
33527
- for (var i = 0, imax = pieces.length; i < imax; ++i) {
33528
- _loop_1(i, imax);
33529
- }
33530
- }
33531
- return Promise.all(promises);
33532
- };
33533
- DDiagrams.toPieceData__ = function (controller, name, serializedOrSimple, isEditMode, pieceData) {
33534
- var _this = this;
33535
- var serialized = this.toSerialized(serializedOrSimple);
33536
- var width = serialized.width;
33537
- var height = serialized.height;
33538
- var container = new EShapeEmbeddedLayerContainer(width, height, isEditMode);
33539
- pieceData.set(name, new EShapeEmbeddedDatum(name, width, height, container));
33540
- var pieces = serialized.pieces;
33541
- return this.toPieceData_(controller, pieces, pieceData, isEditMode).then(function () {
33542
- return _this.newLayer(serialized, container, new EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode));
33543
- });
33544
- };
33545
- return DDiagrams;
33546
- }());
33547
-
33548
- /*
33549
- * Copyright (C) 2019 Toshiba Corporation
33550
- * SPDX-License-Identifier: Apache-2.0
33551
- */
33552
- var EShapeGroupTextAlignEditor = /** @class */ (function () {
33553
- function EShapeGroupTextAlignEditor(parent) {
33554
- this._parent = parent;
33555
- }
33556
- Object.defineProperty(EShapeGroupTextAlignEditor.prototype, "horizontal", {
33557
- get: function () {
33558
- var children = this._parent.children;
33559
- if (0 < children.length) {
33560
- return children[children.length - 1].text.align.horizontal;
33561
- }
33562
- return EShapeTextAlignHorizontal.CENTER;
33563
- },
33564
- set: function (horizontal) {
33565
- var children = this._parent.children;
33566
- for (var i = 0, imax = children.length; i < imax; ++i) {
33567
- children[i].text.align.horizontal = horizontal;
33568
- }
33569
- },
33570
- enumerable: false,
33571
- configurable: true
33572
- });
33573
- Object.defineProperty(EShapeGroupTextAlignEditor.prototype, "vertical", {
33574
- get: function () {
33575
- var children = this._parent.children;
33576
- if (0 < children.length) {
33577
- return children[children.length - 1].text.align.vertical;
33578
- }
33579
- return EShapeTextAlignVertical.MIDDLE;
33580
- },
33581
- set: function (vertical) {
33582
- var children = this._parent.children;
33583
- for (var i = 0, imax = children.length; i < imax; ++i) {
33584
- children[i].text.align.vertical = vertical;
33585
- }
33586
- },
33587
- enumerable: false,
33588
- configurable: true
33589
- });
33590
- EShapeGroupTextAlignEditor.prototype.copy = function (target) {
33591
- var children = this._parent.children;
33592
- for (var i = 0, imax = children.length; i < imax; ++i) {
33593
- children[i].text.align.copy(target);
33594
- }
33595
- };
33596
- EShapeGroupTextAlignEditor.prototype.set = function (horizontal, vertical) {
33597
- var children = this._parent.children;
33598
- for (var i = 0, imax = children.length; i < imax; ++i) {
33599
- children[i].text.align.set(horizontal, vertical);
33600
- }
33601
- };
33602
- EShapeGroupTextAlignEditor.prototype.toObject = function () {
33603
- var children = this._parent.children;
33604
- if (0 < children.length) {
33605
- return children[children.length - 1].text.align.toObject();
33606
- }
33607
- return {
33608
- horizontal: EShapeTextAlignHorizontal.CENTER,
33609
- vertical: EShapeTextAlignVertical.MIDDLE
33610
- };
33611
- };
33612
- EShapeGroupTextAlignEditor.prototype.serialize = function (manager) {
33613
- return -1;
33614
- };
33615
- EShapeGroupTextAlignEditor.prototype.deserialize = function (target, manager) {
33616
- // DO NOTHING
33617
- };
33618
- return EShapeGroupTextAlignEditor;
33619
- }());
33620
-
33621
- /*
33622
- * Copyright (C) 2019 Toshiba Corporation
33623
- * SPDX-License-Identifier: Apache-2.0
33624
- */
33625
- var EShapeGroupTextOffsetEditor = /** @class */ (function () {
33626
- function EShapeGroupTextOffsetEditor(parent) {
33627
- this._parent = parent;
33628
- }
33629
- Object.defineProperty(EShapeGroupTextOffsetEditor.prototype, "horizontal", {
33630
- get: function () {
33631
- var children = this._parent.children;
33632
- if (0 < children.length) {
33633
- return children[children.length - 1].text.offset.horizontal;
33634
- }
33635
- return 0;
33636
- },
33637
- set: function (horizontal) {
33638
- var children = this._parent.children;
33639
- for (var i = 0, imax = children.length; i < imax; ++i) {
33640
- children[i].text.offset.horizontal = horizontal;
33641
- }
33642
- },
33643
- enumerable: false,
33644
- configurable: true
33645
- });
33646
- Object.defineProperty(EShapeGroupTextOffsetEditor.prototype, "vertical", {
33647
- get: function () {
33648
- var children = this._parent.children;
33649
- if (0 < children.length) {
33650
- return children[children.length - 1].text.offset.vertical;
33651
- }
33652
- return 0;
33653
- },
33654
- set: function (vertical) {
33655
- var children = this._parent.children;
33656
- for (var i = 0, imax = children.length; i < imax; ++i) {
33657
- children[i].text.offset.vertical = vertical;
33658
- }
33659
- },
33660
- enumerable: false,
33661
- configurable: true
33662
- });
33663
- EShapeGroupTextOffsetEditor.prototype.copy = function (target) {
33664
- var children = this._parent.children;
33665
- for (var i = 0, imax = children.length; i < imax; ++i) {
33666
- children[i].text.offset.copy(target);
33667
- }
33668
- };
33669
- EShapeGroupTextOffsetEditor.prototype.set = function (horizontal, vertical) {
33670
- var children = this._parent.children;
33671
- for (var i = 0, imax = children.length; i < imax; ++i) {
33672
- children[i].text.offset.set(horizontal, vertical);
33673
- }
33674
- };
33675
- EShapeGroupTextOffsetEditor.prototype.toObject = function () {
33676
- var children = this._parent.children;
33677
- if (0 < children.length) {
33678
- return children[children.length - 1].text.offset.toObject();
33679
- }
33680
- return {
33681
- horizontal: 0,
33682
- vertical: 0
33683
- };
33684
- };
33685
- EShapeGroupTextOffsetEditor.prototype.serialize = function (manager) {
33686
- return -1;
33687
- };
33688
- EShapeGroupTextOffsetEditor.prototype.deserialize = function (target, manager) {
33689
- // DO NOTHING
33690
- };
33691
- return EShapeGroupTextOffsetEditor;
33692
- }());
33693
-
33694
- /*
33695
- * Copyright (C) 2019 Toshiba Corporation
33696
- * SPDX-License-Identifier: Apache-2.0
33697
- */
33698
- var EShapeGroupTextOutlineEditor = /** @class */ (function () {
33699
- function EShapeGroupTextOutlineEditor(parent) {
33700
- this._parent = parent;
33701
- }
33702
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "enable", {
33703
- get: function () {
33704
- var children = this._parent.children;
33705
- if (0 < children.length) {
33706
- return children[children.length - 1].text.outline.enable;
33707
- }
33708
- return false;
33709
- },
33710
- set: function (enable) {
33711
- var children = this._parent.children;
33712
- for (var i = 0, imax = children.length; i < imax; ++i) {
33713
- children[i].text.outline.enable = enable;
33714
- }
33715
- },
33716
- enumerable: false,
33717
- configurable: true
33718
- });
33719
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "color", {
33720
- get: function () {
33721
- var children = this._parent.children;
33722
- if (0 < children.length) {
33723
- return children[children.length - 1].text.outline.color;
33724
- }
33725
- return 0xffffff;
33726
- },
33727
- set: function (color) {
33728
- var children = this._parent.children;
33729
- for (var i = 0, imax = children.length; i < imax; ++i) {
33730
- children[i].text.outline.color = color;
33731
- }
33732
- },
33733
- enumerable: false,
33734
- configurable: true
33735
- });
33736
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "alpha", {
33737
- get: function () {
33738
- var children = this._parent.children;
33739
- if (0 < children.length) {
33740
- return children[children.length - 1].text.outline.alpha;
33741
- }
33742
- return 1.0;
33743
- },
33744
- set: function (alpha) {
33745
- var children = this._parent.children;
33746
- for (var i = 0, imax = children.length; i < imax; ++i) {
33747
- children[i].text.outline.alpha = alpha;
33748
- }
33749
- },
33750
- enumerable: false,
33751
- configurable: true
33752
- });
33753
- Object.defineProperty(EShapeGroupTextOutlineEditor.prototype, "width", {
33754
- get: function () {
33755
- var children = this._parent.children;
33756
- if (0 < children.length) {
33757
- return children[children.length - 1].text.outline.width;
33758
- }
33759
- return 1.0;
33760
- },
33761
- set: function (width) {
33762
- var children = this._parent.children;
33763
- for (var i = 0, imax = children.length; i < imax; ++i) {
33764
- children[i].text.outline.width = width;
33765
- }
33766
- },
33767
- enumerable: false,
33768
- configurable: true
33769
- });
33770
- EShapeGroupTextOutlineEditor.prototype.copy = function (target) {
33771
- var children = this._parent.children;
33772
- for (var i = 0, imax = children.length; i < imax; ++i) {
33773
- children[i].text.outline.copy(target);
33774
- }
33775
- };
33776
- EShapeGroupTextOutlineEditor.prototype.set = function (enable, color, alpha, width) {
33777
- var children = this._parent.children;
33778
- for (var i = 0, imax = children.length; i < imax; ++i) {
33779
- children[i].text.outline.set(enable, color, alpha, width);
33780
- }
33781
- };
33782
- EShapeGroupTextOutlineEditor.prototype.clone = function () {
33783
- return new EShapeGroupTextOutlineEditor(this._parent);
33784
- };
33785
- EShapeGroupTextOutlineEditor.prototype.toObject = function () {
33786
- var children = this._parent.children;
33787
- if (0 < children.length) {
33788
- return children[children.length - 1].text.outline.toObject();
33789
- }
33790
- return {
33791
- enable: false,
33792
- color: 0xffffff,
33793
- alpha: 1.0,
33794
- width: 1.0
33795
- };
33796
- };
33797
- EShapeGroupTextOutlineEditor.prototype.serialize = function (manager) {
33798
- return -1;
33799
- };
33800
- EShapeGroupTextOutlineEditor.prototype.deserialize = function (target, manager) {
33801
- //
33802
- };
33803
- return EShapeGroupTextOutlineEditor;
33804
- }());
33805
-
33806
- /*
33807
- * Copyright (C) 2019 Toshiba Corporation
33808
- * SPDX-License-Identifier: Apache-2.0
33809
- */
33810
- var EShapeGroupTextPaddingEditor = /** @class */ (function () {
33811
- function EShapeGroupTextPaddingEditor(parent) {
33812
- this._parent = parent;
33813
- }
33814
- Object.defineProperty(EShapeGroupTextPaddingEditor.prototype, "horizontal", {
33815
- get: function () {
33816
- var children = this._parent.children;
33817
- if (0 < children.length) {
33818
- return children[children.length - 1].text.padding.horizontal;
33819
- }
33820
- return 0;
33821
- },
33822
- set: function (horizontal) {
33823
- var children = this._parent.children;
33824
- for (var i = 0, imax = children.length; i < imax; ++i) {
33825
- children[i].text.padding.horizontal = horizontal;
33826
- }
33827
- },
33828
- enumerable: false,
33829
- configurable: true
33830
- });
33831
- Object.defineProperty(EShapeGroupTextPaddingEditor.prototype, "vertical", {
33832
- get: function () {
33833
- var children = this._parent.children;
33834
- if (0 < children.length) {
33835
- return children[children.length - 1].text.padding.vertical;
33836
- }
33837
- return 0;
33838
- },
33839
- set: function (vertical) {
33840
- var children = this._parent.children;
33841
- for (var i = 0, imax = children.length; i < imax; ++i) {
33842
- children[i].text.padding.vertical = vertical;
33843
- }
33844
- },
33845
- enumerable: false,
33846
- configurable: true
33847
- });
33848
- EShapeGroupTextPaddingEditor.prototype.copy = function (target) {
33849
- var children = this._parent.children;
33850
- for (var i = 0, imax = children.length; i < imax; ++i) {
33851
- children[i].text.padding.copy(target);
33852
- }
33853
- };
33854
- EShapeGroupTextPaddingEditor.prototype.set = function (horizontal, vertical) {
33855
- var children = this._parent.children;
33856
- for (var i = 0, imax = children.length; i < imax; ++i) {
33857
- children[i].text.padding.set(horizontal, vertical);
33858
- }
33859
- };
33860
- EShapeGroupTextPaddingEditor.prototype.toObject = function () {
33861
- var children = this._parent.children;
33862
- if (0 < children.length) {
33863
- return children[children.length - 1].text.padding.toObject();
33864
- }
33865
- return {
33866
- horizontal: 0,
33867
- vertical: 0
33868
- };
33869
- };
33870
- EShapeGroupTextPaddingEditor.prototype.serialize = function (manager) {
33871
- return -1;
33872
- };
33873
- EShapeGroupTextPaddingEditor.prototype.deserialize = function (target, manager) {
33874
- // DO NOTHING
33875
- };
33876
- return EShapeGroupTextPaddingEditor;
33877
- }());
33878
-
33879
- /*
33880
- * Copyright (C) 2019 Toshiba Corporation
33881
- * SPDX-License-Identifier: Apache-2.0
33882
- */
33883
- var EShapeGroupTextSpacingEditor = /** @class */ (function () {
33884
- function EShapeGroupTextSpacingEditor(parent) {
33885
- this._parent = parent;
33886
- }
33887
- Object.defineProperty(EShapeGroupTextSpacingEditor.prototype, "horizontal", {
33888
- get: function () {
33889
- var children = this._parent.children;
33890
- if (0 < children.length) {
33891
- return children[children.length - 1].text.spacing.horizontal;
33892
- }
33893
- return 0;
33894
- },
33895
- set: function (horizontal) {
33896
- var children = this._parent.children;
33897
- for (var i = 0, imax = children.length; i < imax; ++i) {
33898
- children[i].text.spacing.horizontal = horizontal;
33899
- }
33900
- },
33901
- enumerable: false,
33902
- configurable: true
33903
- });
33904
- Object.defineProperty(EShapeGroupTextSpacingEditor.prototype, "vertical", {
33905
- get: function () {
33906
- var children = this._parent.children;
33907
- if (0 < children.length) {
33908
- return children[children.length - 1].text.spacing.vertical;
33909
- }
33910
- return 0;
33911
- },
33912
- set: function (vertical) {
33913
- var children = this._parent.children;
33914
- for (var i = 0, imax = children.length; i < imax; ++i) {
33915
- children[i].text.spacing.vertical = vertical;
33916
- }
33917
- },
33918
- enumerable: false,
33919
- configurable: true
33920
- });
33921
- EShapeGroupTextSpacingEditor.prototype.copy = function (target) {
33922
- var children = this._parent.children;
33923
- for (var i = 0, imax = children.length; i < imax; ++i) {
33924
- children[i].text.spacing.copy(target);
33925
- }
33926
- };
33927
- EShapeGroupTextSpacingEditor.prototype.set = function (horizontal, vertical) {
33928
- var children = this._parent.children;
33929
- for (var i = 0, imax = children.length; i < imax; ++i) {
33930
- children[i].text.spacing.set(horizontal, vertical);
33931
- }
33932
- };
33933
- EShapeGroupTextSpacingEditor.prototype.toObject = function () {
33934
- var children = this._parent.children;
33935
- if (0 < children.length) {
33936
- return children[children.length - 1].text.spacing.toObject();
33937
- }
33938
- return {
33939
- horizontal: 0,
33940
- vertical: 0
33941
- };
33942
- };
33943
- EShapeGroupTextSpacingEditor.prototype.serialize = function (manager) {
33944
- return -1;
33945
- };
33946
- EShapeGroupTextSpacingEditor.prototype.deserialize = function (target, manager) {
33947
- // DO NOTHING
33948
- };
33949
- return EShapeGroupTextSpacingEditor;
33950
- }());
33951
-
33952
- /*
33953
- * Copyright (C) 2019 Toshiba Corporation
33954
- * SPDX-License-Identifier: Apache-2.0
33955
- */
33956
- var EShapeGroupTextEditor = /** @class */ (function () {
33957
- function EShapeGroupTextEditor(parent) {
33958
- this._parent = parent;
33959
- this.align = new EShapeGroupTextAlignEditor(parent);
33960
- this.offset = new EShapeGroupTextOffsetEditor(parent);
33961
- this.outline = new EShapeGroupTextOutlineEditor(parent);
33962
- this.spacing = new EShapeGroupTextSpacingEditor(parent);
33963
- this.padding = new EShapeGroupTextPaddingEditor(parent);
33964
- }
33965
- Object.defineProperty(EShapeGroupTextEditor.prototype, "enable", {
33966
- get: function () {
33967
- var children = this._parent.children;
33968
- if (0 < children.length) {
33969
- return children[children.length - 1].text.enable;
33970
- }
33971
- return true;
33972
- },
33973
- set: function (enable) {
33974
- var children = this._parent.children;
33975
- for (var i = 0, imax = children.length; i < imax; ++i) {
33976
- children[i].text.enable = enable;
33977
- }
33978
- },
33979
- enumerable: false,
33980
- configurable: true
33981
- });
33982
- Object.defineProperty(EShapeGroupTextEditor.prototype, "value", {
33983
- get: function () {
33984
- var children = this._parent.children;
33985
- if (0 < children.length) {
33986
- return children[children.length - 1].text.value;
33987
- }
33988
- return "";
33989
- },
33990
- set: function (value) {
33991
- var children = this._parent.children;
33992
- for (var i = 0, imax = children.length; i < imax; ++i) {
33993
- children[i].text.value = value;
33994
- }
33995
- },
33996
- enumerable: false,
33997
- configurable: true
33998
- });
33999
- Object.defineProperty(EShapeGroupTextEditor.prototype, "color", {
34000
- get: function () {
34001
- var children = this._parent.children;
34002
- if (0 < children.length) {
34003
- return children[children.length - 1].text.color;
34004
- }
34005
- return 0x000000;
34006
- },
34007
- set: function (color) {
34008
- var children = this._parent.children;
34009
- for (var i = 0, imax = children.length; i < imax; ++i) {
34010
- children[i].text.color = color;
34011
- }
34012
- },
34013
- enumerable: false,
34014
- configurable: true
34015
- });
34016
- Object.defineProperty(EShapeGroupTextEditor.prototype, "alpha", {
34017
- get: function () {
34018
- var children = this._parent.children;
34019
- if (0 < children.length) {
34020
- return children[children.length - 1].text.alpha;
34021
- }
34022
- return 1.0;
34023
- },
34024
- set: function (alpha) {
34025
- var children = this._parent.children;
34026
- for (var i = 0, imax = children.length; i < imax; ++i) {
34027
- children[i].text.alpha = alpha;
34028
- }
34029
- },
34030
- enumerable: false,
34031
- configurable: true
34032
- });
34033
- Object.defineProperty(EShapeGroupTextEditor.prototype, "family", {
34034
- get: function () {
34035
- var children = this._parent.children;
34036
- if (0 < children.length) {
34037
- return children[children.length - 1].text.family;
34038
- }
34039
- return "auto";
34040
- },
34041
- set: function (family) {
34042
- var children = this._parent.children;
34043
- for (var i = 0, imax = children.length; i < imax; ++i) {
34044
- children[i].text.family = family;
34045
- }
34046
- },
34047
- enumerable: false,
34048
- configurable: true
34049
- });
34050
- Object.defineProperty(EShapeGroupTextEditor.prototype, "size", {
34051
- get: function () {
34052
- var children = this._parent.children;
34053
- if (0 < children.length) {
34054
- return children[children.length - 1].text.size;
34055
- }
34056
- return 24;
34057
- },
34058
- set: function (size) {
34059
- var children = this._parent.children;
34060
- for (var i = 0, imax = children.length; i < imax; ++i) {
34061
- children[i].text.size = size;
34062
- }
34063
- },
34064
- enumerable: false,
34065
- configurable: true
34066
- });
34067
- Object.defineProperty(EShapeGroupTextEditor.prototype, "weight", {
34068
- get: function () {
34069
- var children = this._parent.children;
34070
- if (0 < children.length) {
34071
- return children[children.length - 1].text.weight;
34072
- }
34073
- return EShapeTextWeight.NORMAL;
34074
- },
34075
- set: function (weight) {
34076
- var children = this._parent.children;
34077
- for (var i = 0, imax = children.length; i < imax; ++i) {
34078
- children[i].text.weight = weight;
34079
- }
34080
- },
34081
- enumerable: false,
34082
- configurable: true
34083
- });
34084
- Object.defineProperty(EShapeGroupTextEditor.prototype, "style", {
34085
- get: function () {
34086
- var children = this._parent.children;
34087
- if (0 < children.length) {
34088
- return children[children.length - 1].text.style;
34089
- }
34090
- return EShapeTextStyle.NORMAL;
34091
- },
34092
- set: function (style) {
34093
- var children = this._parent.children;
34094
- for (var i = 0, imax = children.length; i < imax; ++i) {
34095
- children[i].text.style = style;
34096
- }
34097
- },
34098
- enumerable: false,
34099
- configurable: true
34100
- });
34101
- Object.defineProperty(EShapeGroupTextEditor.prototype, "direction", {
34102
- get: function () {
34103
- var children = this._parent.children;
34104
- if (0 < children.length) {
34105
- return children[children.length - 1].text.direction;
34106
- }
34107
- return 0;
34108
- },
34109
- set: function (direction) {
34110
- var children = this._parent.children;
34111
- for (var i = 0, imax = children.length; i < imax; ++i) {
34112
- children[i].text.direction = direction;
34113
- }
34114
- },
34115
- enumerable: false,
34116
- configurable: true
34117
- });
34118
- Object.defineProperty(EShapeGroupTextEditor.prototype, "clipping", {
34119
- get: function () {
34120
- var children = this._parent.children;
34121
- if (0 < children.length) {
34122
- return children[children.length - 1].text.clipping;
34123
- }
34124
- return false;
34125
- },
34126
- set: function (clipping) {
34127
- var children = this._parent.children;
34128
- for (var i = 0, imax = children.length; i < imax; ++i) {
34129
- children[i].text.clipping = clipping;
34130
- }
34131
- },
34132
- enumerable: false,
34133
- configurable: true
34134
- });
34135
- EShapeGroupTextEditor.prototype.copy = function (target) {
34136
- var children = this._parent.children;
34137
- for (var i = 0, imax = children.length; i < imax; ++i) {
34138
- children[i].text.copy(target);
34139
- }
34140
- return this;
34141
- };
34142
- EShapeGroupTextEditor.prototype.set = function (value, color, alpha, family, size, weight, style, direction) {
34143
- var children = this._parent.children;
34144
- for (var i = 0, imax = children.length; i < imax; ++i) {
34145
- children[i].text.set(value, color, alpha, family, size, weight, style, direction);
34146
- }
34147
- return this;
34148
- };
34149
- EShapeGroupTextEditor.prototype.toObject = function () {
34150
- var children = this._parent.children;
34151
- if (0 < children.length) {
34152
- return children[children.length - 1].text.toObject();
34153
- }
34154
- return {
34155
- value: "",
34156
- color: 0x000000,
34157
- alpha: 1.0,
34158
- family: "auto",
34159
- size: 24,
34160
- weight: EShapeTextWeight.NORMAL,
34161
- align: this.align.toObject(),
34162
- offset: this.offset.toObject(),
34163
- style: EShapeTextStyle.NORMAL,
34164
- outline: this.outline.toObject(),
34165
- spacing: this.spacing.toObject(),
34166
- direction: EShapeTextDirection.LEFT_TO_RIGHT,
34167
- padding: this.padding.toObject(),
34168
- clipping: false
34169
- };
34170
- };
34171
- EShapeGroupTextEditor.prototype.serialize = function (manager) {
34172
- return -1;
34173
- };
34174
- EShapeGroupTextEditor.prototype.deserialize = function (target, manager) {
34175
- // DO NOTHING
34176
- };
34177
- return EShapeGroupTextEditor;
34178
- }());
34179
-
34180
33533
  var EShapeEmbedded = /** @class */ (function (_super) {
34181
33534
  __extends(EShapeEmbedded, _super);
34182
33535
  function EShapeEmbedded(name, isEditMode, type) {
@@ -34237,53 +33590,22 @@
34237
33590
  return EShapeEmbedded;
34238
33591
  }(EShapeGroupViewer));
34239
33592
 
34240
- var EShapeEmbeddeds = /** @class */ (function () {
34241
- function EShapeEmbeddeds() {
34242
- }
34243
- EShapeEmbeddeds.from = function (serializedOrSimple, controller, isEditMode) {
34244
- var _this = this;
34245
- var serialized = DDiagrams.toSerialized(serializedOrSimple);
34246
- var pieces = serialized.pieces;
34247
- return DDiagrams.toPieceData(controller, pieces, isEditMode).then(function (pieceData) {
34248
- return _this.from_(serialized, isEditMode, pieces, pieceData);
34249
- });
34250
- };
34251
- EShapeEmbeddeds.from_ = function (serialized, isEditMode, pieces, pieceData) {
34252
- var _this = this;
34253
- var width = serialized.width;
34254
- var height = serialized.height;
34255
- var container = new EShapeEmbeddedLayerContainer(width, height, isEditMode);
34256
- var manager = new EShapeResourceManagerDeserialization(serialized, pieces, pieceData, isEditMode);
34257
- return DDiagrams.newLayer(serialized, container, manager).then(function () {
34258
- return _this.create(serialized.name, width, height, container, manager);
34259
- });
34260
- };
34261
- EShapeEmbeddeds.deserialize = function (name, width, height, container, manager, item) {
34262
- var shape = new EShapeEmbedded(name, manager.isEditMode);
34263
- var result = EShapeDeserializer.deserialize(item, manager, shape);
34264
- var shapeSize = shape.size;
34265
- var sizeX = shapeSize.x;
34266
- var sizeY = shapeSize.y;
34267
- shape.size.set(width, height);
34268
- container.copyTo(shape);
34269
- shape.size.init();
34270
- shape.size.set(sizeX, sizeY);
34271
- return result;
34272
- };
34273
- EShapeEmbeddeds.create = function (name, width, height, container, manager) {
34274
- var shape = new EShapeEmbedded(name, manager.isEditMode);
34275
- shape.size.set(width, height);
34276
- container.copyTo(shape);
34277
- shape.size.init();
34278
- return shape;
34279
- };
34280
- return EShapeEmbeddeds;
34281
- }());
34282
-
34283
33593
  /*
34284
33594
  * Copyright (C) 2019 Toshiba Corporation
34285
33595
  * SPDX-License-Identifier: Apache-2.0
34286
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
+ };
34287
33609
  var deserializeEmbedded = function (item, manager) {
34288
33610
  var pieces = manager.pieces;
34289
33611
  var pieceId = item[15];
@@ -34293,7 +33615,7 @@
34293
33615
  var piece = pieces[pieceId];
34294
33616
  var pieceDatum = pieceData.get(piece);
34295
33617
  if (pieceDatum) {
34296
- return EShapeEmbeddeds.deserialize(piece, pieceDatum.width, pieceDatum.height, pieceDatum.layer, manager, item);
33618
+ return create(piece, pieceDatum.width, pieceDatum.height, pieceDatum.layer, manager, item);
34297
33619
  }
34298
33620
  }
34299
33621
  }
@@ -34982,9 +34304,9 @@
34982
34304
  * Copyright (C) 2019 Toshiba Corporation
34983
34305
  * SPDX-License-Identifier: Apache-2.0
34984
34306
  */
34985
- var deserializeGroup = function (item, manager) {
34986
- var shape = new EShapeGroup(manager.isEditMode);
34987
- 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);
34988
34310
  shape.size.init();
34989
34311
  return result;
34990
34312
  };
@@ -35118,9 +34440,9 @@
35118
34440
  * Copyright (C) 2019 Toshiba Corporation
35119
34441
  * SPDX-License-Identifier: Apache-2.0
35120
34442
  */
35121
- var deserializeGroupShadowed = function (item, manager) {
35122
- var shape = new EShapeGroupShadowed(manager.isEditMode);
35123
- 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);
35124
34446
  shape.size.init();
35125
34447
  return result;
35126
34448
  };
@@ -35273,8 +34595,8 @@
35273
34595
  * Copyright (C) 2019 Toshiba Corporation
35274
34596
  * SPDX-License-Identifier: Apache-2.0
35275
34597
  */
35276
- var deserializeImage = function (item, manager) {
35277
- return EShapeDeserializer.deserialize(item, manager, new EShapeImage());
34598
+ var deserializeImage = function (item, manager, shape) {
34599
+ return deserializeBase(item, manager, shape || new EShapeImage());
35278
34600
  };
35279
34601
 
35280
34602
  /*
@@ -35582,8 +34904,8 @@
35582
34904
  * Copyright (C) 2019 Toshiba Corporation
35583
34905
  * SPDX-License-Identifier: Apache-2.0
35584
34906
  */
35585
- var deserializeImageSdf = function (item, manager) {
35586
- return EShapeDeserializer.deserialize(item, manager, new EShapeImageSdf());
34907
+ var deserializeImageSdf = function (item, manager, shape) {
34908
+ return deserializeBase(item, manager, shape || new EShapeImageSdf());
35587
34909
  };
35588
34910
 
35589
34911
  /*
@@ -35667,8 +34989,8 @@
35667
34989
  * Copyright (C) 2019 Toshiba Corporation
35668
34990
  * SPDX-License-Identifier: Apache-2.0
35669
34991
  */
35670
- var deserializeLabel = function (item, manager) {
35671
- return EShapeDeserializer.deserialize(item, manager, new EShapeLabel());
34992
+ var deserializeLabel = function (item, manager, shape) {
34993
+ return deserializeBase(item, manager, shape || new EShapeLabel());
35672
34994
  };
35673
34995
 
35674
34996
  /*
@@ -35714,9 +35036,9 @@
35714
35036
  * Copyright (C) 2019 Toshiba Corporation
35715
35037
  * SPDX-License-Identifier: Apache-2.0
35716
35038
  */
35717
- var deserializeLine = function (item, manager) {
35718
- var shape = new EShapeLine();
35719
- 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);
35720
35042
  shape.points.deserialize(item[15], manager);
35721
35043
  var style = shape.points.style;
35722
35044
  var mask = EShapePointsStyle.NON_SCALING_MASK |
@@ -36760,8 +36082,8 @@
36760
36082
  * Copyright (C) 2019 Toshiba Corporation
36761
36083
  * SPDX-License-Identifier: Apache-2.0
36762
36084
  */
36763
- var deserializeLineOfCircles = function (item, manager) {
36764
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfCircles());
36085
+ var deserializeLineOfCircles = function (item, manager, shape) {
36086
+ return deserializeBase(item, manager, shape || new EShapeLineOfCircles());
36765
36087
  };
36766
36088
 
36767
36089
  /*
@@ -36987,8 +36309,8 @@
36987
36309
  * Copyright (C) 2019 Toshiba Corporation
36988
36310
  * SPDX-License-Identifier: Apache-2.0
36989
36311
  */
36990
- var deserializeLineOfRectangleRoundeds = function (item, manager) {
36991
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfRectangleRoundeds());
36312
+ var deserializeLineOfRectangleRoundeds = function (item, manager, shape) {
36313
+ return deserializeBase(item, manager, shape || new EShapeLineOfRectangleRoundeds());
36992
36314
  };
36993
36315
 
36994
36316
  /*
@@ -37205,8 +36527,8 @@
37205
36527
  * Copyright (C) 2019 Toshiba Corporation
37206
36528
  * SPDX-License-Identifier: Apache-2.0
37207
36529
  */
37208
- var deserializeLineOfRectangles = function (item, manager) {
37209
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfRectangles());
36530
+ var deserializeLineOfRectangles = function (item, manager, shape) {
36531
+ return deserializeBase(item, manager, shape || new EShapeLineOfRectangles());
37210
36532
  };
37211
36533
 
37212
36534
  /*
@@ -37982,8 +37304,8 @@
37982
37304
  * Copyright (C) 2019 Toshiba Corporation
37983
37305
  * SPDX-License-Identifier: Apache-2.0
37984
37306
  */
37985
- var deserializeLineOfTriangleRoundeds = function (item, manager) {
37986
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfTriangleRoundeds());
37307
+ var deserializeLineOfTriangleRoundeds = function (item, manager, shape) {
37308
+ return deserializeBase(item, manager, shape || new EShapeLineOfTriangleRoundeds());
37987
37309
  };
37988
37310
 
37989
37311
  /*
@@ -38204,8 +37526,8 @@
38204
37526
  * Copyright (C) 2019 Toshiba Corporation
38205
37527
  * SPDX-License-Identifier: Apache-2.0
38206
37528
  */
38207
- var deserializeLineOfTriangles = function (item, manager) {
38208
- return EShapeDeserializer.deserialize(item, manager, new EShapeLineOfTriangles());
37529
+ var deserializeLineOfTriangles = function (item, manager, shape) {
37530
+ return deserializeBase(item, manager, shape || new EShapeLineOfTriangles());
38209
37531
  };
38210
37532
 
38211
37533
  /*
@@ -38231,8 +37553,24 @@
38231
37553
  * Copyright (C) 2019 Toshiba Corporation
38232
37554
  * SPDX-License-Identifier: Apache-2.0
38233
37555
  */
38234
- var deserializeNull = function (item, manager) {
38235
- 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());
38236
37574
  };
38237
37575
 
38238
37576
  /*
@@ -38248,8 +37586,8 @@
38248
37586
  * Copyright (C) 2019 Toshiba Corporation
38249
37587
  * SPDX-License-Identifier: Apache-2.0
38250
37588
  */
38251
- var deserializeRectangle = function (item, manager) {
38252
- return EShapeDeserializer.deserialize(item, manager, new EShapeRectangle());
37589
+ var deserializeRectangle = function (item, manager, shape) {
37590
+ return deserializeBase(item, manager, shape || new EShapeRectangle());
38253
37591
  };
38254
37592
 
38255
37593
  /*
@@ -38323,222 +37661,918 @@
38323
37661
  buffer.updateClippings();
38324
37662
  buildTriangleRoundedClipping(buffer.clippings, voffset, corner, radius);
38325
37663
  }
38326
- if (isVertexChanged || isTransformChanged || isCornerChanged) {
38327
- buffer.updateSteps();
38328
- 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;
38329
38104
  }
38330
- if (isVertexChanged || isTextureChanged) {
38331
- buffer.updateUvs();
38332
- 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];
38333
38116
  }
38117
+ return "";
38334
38118
  }
38335
38119
  };
38336
- return BuilderTriangleRounded;
38337
- }(BuilderBase));
38120
+ return EShapeEmbeddedLayer;
38121
+ }(EShapeGroupViewer));
38338
38122
 
38339
38123
  /*
38340
38124
  * Copyright (C) 2019 Toshiba Corporation
38341
38125
  * SPDX-License-Identifier: Apache-2.0
38342
38126
  */
38343
- var BuilderTriangle = /** @class */ (function (_super) {
38344
- __extends(BuilderTriangle, _super);
38345
- function BuilderTriangle() {
38346
- 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;
38347
38133
  }
38348
- BuilderTriangle.prototype.init = function (buffer) {
38349
- buffer.updateClippings();
38350
- buffer.updateIndices();
38351
- buildTriangleClipping(buffer.clippings, this.vertexOffset);
38352
- 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;
38353
38148
  };
38354
- BuilderTriangle.prototype.update = function (buffer, shape) {
38355
- this.updateVertexStepAndUv(buffer, shape);
38356
- this.updateColorFill(buffer, shape);
38357
- 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;
38358
38157
  };
38359
- BuilderTriangle.prototype.updateVertexStepAndUv = function (buffer, shape) {
38360
- var size = shape.size;
38361
- var sizeX = size.x;
38362
- var sizeY = size.y;
38363
- var isSizeChanged = sizeX !== this.sizeX || sizeY !== this.sizeY;
38364
- var transformLocalId = toTransformLocalId(shape);
38365
- var isTransformChanged = this.transformLocalId !== transformLocalId;
38366
- var stroke = shape.stroke;
38367
- var strokeAlign = stroke.align;
38368
- var strokeWidth = stroke.enable ? stroke.width : 0;
38369
- var strokeStyle = stroke.style;
38370
- var isStrokeChanged = this.strokeAlign !== strokeAlign ||
38371
- this.strokeWidth !== strokeWidth ||
38372
- this.strokeStyle !== strokeStyle;
38373
- var texture = toTexture(shape);
38374
- var textureTransformId = toTextureTransformId(texture);
38375
- var isTextureChanged = texture !== this.texture || textureTransformId !== this.textureTransformId;
38376
- var isVertexChanged = isSizeChanged || isStrokeChanged;
38377
- if (isVertexChanged || isTransformChanged || isTextureChanged) {
38378
- this.sizeX = sizeX;
38379
- this.sizeY = sizeY;
38380
- this.transformLocalId = transformLocalId;
38381
- this.strokeAlign = strokeAlign;
38382
- this.strokeWidth = strokeWidth;
38383
- this.strokeStyle = strokeStyle;
38384
- this.texture = texture;
38385
- this.textureTransformId = textureTransformId;
38386
- var voffset = this.vertexOffset;
38387
- buffer.updateVertices();
38388
- buildTriangleVertex(buffer.vertices, voffset, 0, 0, sizeX, sizeY, strokeAlign, strokeWidth, shape.transform.internalTransform, TRIANGLE_WORLD_SIZE);
38389
- if (isVertexChanged || isTransformChanged) {
38390
- buffer.updateSteps();
38391
- 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);
38392
38170
  }
38393
- if (isVertexChanged || isTextureChanged) {
38394
- buffer.updateUvs();
38395
- 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));
38396
38183
  }
38397
38184
  }
38398
38185
  };
38399
- return BuilderTriangle;
38400
- }(BuilderBase));
38186
+ return EShapeEmbeddedLayerContainer;
38187
+ }());
38401
38188
 
38402
38189
  /*
38403
38190
  * Copyright (C) 2019 Toshiba Corporation
38404
38191
  * SPDX-License-Identifier: Apache-2.0
38405
38192
  */
38406
- var createImageSdf = function (dataUrl, convertToSdf) {
38407
- if (convertToSdf) {
38408
- return EShapeImageElements.toImageElement(dataUrl).then(function (imageElement) {
38409
- var generator = DynamicSDFFontGenerator.getInstance().init();
38410
- generator.updateTexture(imageElement);
38411
- generator.render();
38412
- var canvas = document.createElement("canvas");
38413
- generator.read(canvas);
38414
- return createImageSdf(canvas.toDataURL(), false);
38415
- });
38416
- }
38417
- else {
38418
- return EShapeImageElements.toImageElement(dataUrl).then(function (imageElement) {
38419
- return new EShapeImageSdf(imageElement);
38420
- });
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();
38421
38211
  }
38422
- };
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
+ }());
38423
38280
 
38424
38281
  /*
38425
38282
  * Copyright (C) 2019 Toshiba Corporation
38426
38283
  * SPDX-License-Identifier: Apache-2.0
38427
38284
  */
38428
- var createImage = function (dataUrl) {
38429
- return EShapeImageElements.toImageElement(dataUrl).then(function (imageElement) {
38430
- return new EShapeImage(imageElement);
38431
- });
38432
- };
38433
-
38434
- var createLine = function (points, segments, strokeWidth, pointsStyle) {
38435
- // Calculate the boundary
38436
- var boundary = toPointsBoundary(points, [0, 0, 0, 0]);
38437
- var cx = (boundary[2] + boundary[0]) * 0.5;
38438
- var cy = (boundary[3] + boundary[1]) * 0.5;
38439
- var sx = boundary[2] - boundary[0];
38440
- var sy = boundary[3] - boundary[1];
38441
- // Calculate values
38442
- var values = [];
38443
- for (var i = 0, imax = points.length; i < imax; i += 2) {
38444
- values.push(points[i] - cx, points[i + 1] - cy);
38285
+ var DDiagrams = /** @class */ (function () {
38286
+ function DDiagrams() {
38445
38287
  }
38446
- // Create a line
38447
- var result = new EShapeLine();
38448
- result.stroke.set(true, undefined, undefined, strokeWidth);
38449
- result.transform.position.set(cx, cy);
38450
- result.size.set(sx, sy);
38451
- result.points.set(values, segments, pointsStyle);
38452
- return result;
38453
- };
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
+ }());
38454
38420
 
38455
- /*
38456
- * Copyright (C) 2019 Toshiba Corporation
38457
- * SPDX-License-Identifier: Apache-2.0
38458
- */
38459
- var createTriangleRoundedUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
38460
- var tcount = toTextBufferCount(shape);
38461
- var tvcount = tcount * TEXT_VERTEX_COUNT;
38462
- var ticount = tcount * TEXT_INDEX_COUNT;
38463
- var vcount = TRIANGLE_ROUNDED_VERTEX_COUNT + tvcount;
38464
- var icount = TRIANGLE_ROUNDED_INDEX_COUNT + ticount;
38465
- if (buffer.check(voffset, ioffset, vcount, icount)) {
38466
- return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
38467
- new BuilderTriangleRounded(voffset, ioffset, vcount - tvcount, icount - ticount),
38468
- new BuilderText(voffset + TRIANGLE_ROUNDED_VERTEX_COUNT, ioffset + TRIANGLE_ROUNDED_INDEX_COUNT, tvcount, ticount)
38469
- ]).init(shape);
38421
+ var EShapeEmbeddeds = /** @class */ (function () {
38422
+ function EShapeEmbeddeds() {
38470
38423
  }
38471
- return null;
38472
- };
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
+ }());
38473
38451
 
38474
38452
  /*
38475
38453
  * Copyright (C) 2019 Toshiba Corporation
38476
38454
  * SPDX-License-Identifier: Apache-2.0
38477
38455
  */
38478
- var createTriangleUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
38479
- var tcount = toTextBufferCount(shape);
38480
- var tvcount = tcount * TEXT_VERTEX_COUNT;
38481
- var ticount = tcount * TEXT_INDEX_COUNT;
38482
- var vcount = TRIANGLE_VERTEX_COUNT + tvcount;
38483
- var icount = TRIANGLE_INDEX_COUNT + ticount;
38484
- if (buffer.check(voffset, ioffset, vcount, icount)) {
38485
- return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
38486
- new BuilderTriangle(voffset, ioffset, vcount - tvcount, icount - ticount),
38487
- new BuilderText(voffset + TRIANGLE_VERTEX_COUNT, ioffset + TRIANGLE_INDEX_COUNT, tvcount, ticount)
38488
- ]).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;
38489
38461
  }
38490
- return null;
38491
- };
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));
38492
38470
 
38493
38471
  /*
38494
38472
  * Copyright (C) 2019 Toshiba Corporation
38495
38473
  * SPDX-License-Identifier: Apache-2.0
38496
38474
  */
38497
- var deserializeRectangleRounded = function (item, manager) {
38498
- return EShapeDeserializer.deserialize(item, manager, new EShapeRectangleRounded());
38475
+ var toSvgUrl = function (svg) {
38476
+ return "data:image/svg+xml;base64," + btoa(svg);
38499
38477
  };
38500
38478
 
38501
38479
  /*
38502
38480
  * Copyright (C) 2019 Toshiba Corporation
38503
38481
  * SPDX-License-Identifier: Apache-2.0
38504
38482
  */
38505
- var deserializeTriangleRounded = function (item, manager) {
38506
- 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;
38507
38510
  };
38508
38511
 
38509
38512
  /*
38510
38513
  * Copyright (C) 2019 Toshiba Corporation
38511
38514
  * SPDX-License-Identifier: Apache-2.0
38512
38515
  */
38513
- var deserializeTriangle = function (item, manager) {
38514
- return EShapeDeserializer.deserialize(item, manager, new EShapeTriangle());
38516
+ var toSizeRounded = function (value) {
38517
+ return Math.round(value * 100) / 100;
38515
38518
  };
38516
38519
 
38517
38520
  /*
38518
38521
  * Copyright (C) 2019 Toshiba Corporation
38519
38522
  * SPDX-License-Identifier: Apache-2.0
38520
38523
  */
38521
- var EShapeRectanglePivoted = /** @class */ (function (_super) {
38522
- __extends(EShapeRectanglePivoted, _super);
38523
- function EShapeRectanglePivoted(type) {
38524
- if (type === void 0) { type = EShapeType.RECTANGLE_PIVOTED; }
38525
- 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
+ }
38526
38540
  }
38527
- EShapeRectanglePivoted.prototype.toHitTestData = function (x, y) {
38528
- var result = _super.prototype.toHitTestData.call(this, x, y);
38529
- result.x -= result.width;
38530
- result.y -= result.height;
38531
- return result;
38532
- };
38533
- return EShapeRectanglePivoted;
38534
- }(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
+ };
38535
38569
 
38536
38570
  /*
38537
38571
  * Copyright (C) 2019 Toshiba Corporation
38538
38572
  * SPDX-License-Identifier: Apache-2.0
38539
38573
  */
38540
- var deserializeRectanglePivoted = function (item, manager) {
38541
- return EShapeDeserializer.deserialize(item, manager, new EShapeRectanglePivoted());
38574
+ var deserializeRectanglePivoted = function (item, manager, shape) {
38575
+ return deserializeBase(item, manager, shape || new EShapeRectanglePivoted());
38542
38576
  };
38543
38577
 
38544
38578
  /*
@@ -67261,6 +67295,7 @@
67261
67295
  loadMenuItem: loadMenuItem,
67262
67296
  loadMenuSidedItemExpandable: loadMenuSidedItemExpandable,
67263
67297
  loadMenuSidedItem: loadMenuSidedItem,
67298
+ deserializeActionValue: deserializeActionValue,
67264
67299
  EShapeActionBases: EShapeActionBases,
67265
67300
  EShapeActionExpressions: EShapeActionExpressions,
67266
67301
  EShapeActionRuntimeBlinkBrighten: EShapeActionRuntimeBlinkBrighten,
@@ -67335,7 +67370,6 @@
67335
67370
  EShapeActionValueChangeCursor: EShapeActionValueChangeCursor,
67336
67371
  EShapeActionValueChangeTextType: EShapeActionValueChangeTextType,
67337
67372
  EShapeActionValueChangeText: EShapeActionValueChangeText,
67338
- EShapeActionValueDeserializer: EShapeActionValueDeserializer,
67339
67373
  EShapeActionValueEmitEvent: EShapeActionValueEmitEvent,
67340
67374
  EShapeActionValueMiscEmitEvent: EShapeActionValueMiscEmitEvent,
67341
67375
  EShapeActionValueMiscGestureType: EShapeActionValueMiscGestureType,
@@ -67522,12 +67556,15 @@
67522
67556
  createRectangleUploaded: createRectangleUploaded,
67523
67557
  createTriangleRoundedUploaded: createTriangleRoundedUploaded,
67524
67558
  createTriangleUploaded: createTriangleUploaded,
67559
+ deserializeAll: deserializeAll,
67525
67560
  deserializeBar: deserializeBar,
67561
+ deserializeBase: deserializeBase,
67526
67562
  deserializeButton: deserializeButton,
67527
67563
  deserializeCircle: deserializeCircle,
67528
67564
  deserializeConnectorLine: deserializeConnectorLine,
67529
- onConnectorLineDeserialized: onConnectorLineDeserialized,
67565
+ onDeserializedConnectorLine: onDeserializedConnectorLine,
67530
67566
  deserializeEmbedded: deserializeEmbedded,
67567
+ deserializeGradient: deserializeGradient,
67531
67568
  deserializeGroupShadowed: deserializeGroupShadowed,
67532
67569
  deserializeGroup: deserializeGroup,
67533
67570
  deserializeImageSdf: deserializeImageSdf,
@@ -67544,6 +67581,7 @@
67544
67581
  deserializeRectangle: deserializeRectangle,
67545
67582
  deserializeTriangleRounded: deserializeTriangleRounded,
67546
67583
  deserializeTriangle: deserializeTriangle,
67584
+ deserialize: deserialize,
67547
67585
  EShapeBarPoints: EShapeBarPoints,
67548
67586
  EShapeBarPosition: EShapeBarPosition,
67549
67587
  EShapeBar: EShapeBar,
@@ -67564,7 +67602,6 @@
67564
67602
  EShapeEmbedded: EShapeEmbedded,
67565
67603
  EShapeEmbeddeds: EShapeEmbeddeds,
67566
67604
  EShapeFillImpl: EShapeFillImpl,
67567
- EShapeGradients: EShapeGradients,
67568
67605
  EShapeGroupFillEditor: EShapeGroupFillEditor,
67569
67606
  EShapeGroupFillViewer: EShapeGroupFillViewer,
67570
67607
  EShapeGroupPoints: EShapeGroupPoints,
@@ -67627,9 +67664,15 @@
67627
67664
  isStatic: isStatic,
67628
67665
  toComputed: toComputed,
67629
67666
  toDash: toDash,
67630
- toThresholdDefault: toThresholdDefault,
67667
+ toGradientImageUrl: toGradientImageUrl,
67668
+ toGradientSerialized: toGradientSerialized,
67669
+ toImageElement: toImageElement,
67631
67670
  toLength: toLength,
67671
+ toResize: toResize,
67632
67672
  toScaleInvariant: toScaleInvariant,
67673
+ toSizeNormalized: toSizeNormalized,
67674
+ toSizeRounded: toSizeRounded,
67675
+ toThresholdDefault: toThresholdDefault,
67633
67676
  EShapeAcceptorImpl: EShapeAcceptorImpl,
67634
67677
  EShapeAcceptorType: EShapeAcceptorType,
67635
67678
  EShapeAcceptors: EShapeAcceptors,
@@ -67652,11 +67695,9 @@
67652
67695
  EShapeDataValueOrder: EShapeDataValueOrder,
67653
67696
  EShapeDefaults: EShapeDefaults,
67654
67697
  EShapeDeleter: EShapeDeleter,
67655
- EShapeDeserializer: EShapeDeserializer,
67656
67698
  EShapeDeserializers: EShapeDeserializers,
67657
- EShapeOnDeserialized: EShapeOnDeserialized,
67699
+ EShapeOnDeserializeds: EShapeOnDeserializeds,
67658
67700
  EShapeEditor: EShapeEditor,
67659
- EShapeImageElements: EShapeImageElements,
67660
67701
  EShapeLayerState: EShapeLayerState,
67661
67702
  toPointsBoundary: toPointsBoundary,
67662
67703
  eShapePointsFormatterCurve: eShapePointsFormatterCurve,
@@ -67678,7 +67719,6 @@
67678
67719
  EShapeRuntime: EShapeRuntime,
67679
67720
  EShapeRuntimes: EShapeRuntimes,
67680
67721
  EShapeSearch: EShapeSearch,
67681
- EShapeSizes: EShapeSizes,
67682
67722
  EShapeStateSetImplObservable: EShapeStateSetImplObservable,
67683
67723
  EShapeState: EShapeState,
67684
67724
  EShapeStrokeSide: EShapeStrokeSide,