jclic 2.1.21 → 2.1.23

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 (175) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/jclic-node.js +9 -8
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +4 -4
  7. package/src/GlobalData.js +1 -1
  8. package/src/JClicPlayer.js +2 -2
  9. package/src/bags/MediaBag.js +6 -5
  10. package/dist/1078.jclic-node.js +0 -282
  11. package/dist/1078.jclic-node.js.map +0 -1
  12. package/dist/1196.jclic-node.js +0 -808
  13. package/dist/1196.jclic-node.js.map +0 -1
  14. package/dist/1253.jclic-node.js +0 -1432
  15. package/dist/1253.jclic-node.js.map +0 -1
  16. package/dist/13.jclic-node.js +0 -103
  17. package/dist/13.jclic-node.js.map +0 -1
  18. package/dist/1567.jclic-node.js +0 -2313
  19. package/dist/1567.jclic-node.js.map +0 -1
  20. package/dist/1588.jclic-node.js +0 -602
  21. package/dist/1588.jclic-node.js.map +0 -1
  22. package/dist/1725.jclic-node.js +0 -836
  23. package/dist/1725.jclic-node.js.map +0 -1
  24. package/dist/1731.jclic-node.js +0 -438
  25. package/dist/1731.jclic-node.js.map +0 -1
  26. package/dist/1842.jclic-node.js +0 -651
  27. package/dist/1842.jclic-node.js.map +0 -1
  28. package/dist/2160.jclic-node.js +0 -1016
  29. package/dist/2160.jclic-node.js.map +0 -1
  30. package/dist/222.jclic-node.js +0 -129
  31. package/dist/222.jclic-node.js.map +0 -1
  32. package/dist/2316.jclic-node.js +0 -949
  33. package/dist/2316.jclic-node.js.map +0 -1
  34. package/dist/2355.jclic-node.js +0 -371
  35. package/dist/2355.jclic-node.js.map +0 -1
  36. package/dist/2366.jclic-node.js +0 -431
  37. package/dist/2366.jclic-node.js.map +0 -1
  38. package/dist/2379.jclic-node.js +0 -202
  39. package/dist/2379.jclic-node.js.map +0 -1
  40. package/dist/2437.jclic-node.js +0 -450
  41. package/dist/2437.jclic-node.js.map +0 -1
  42. package/dist/2531.jclic-node.js +0 -869
  43. package/dist/2531.jclic-node.js.map +0 -1
  44. package/dist/2608.jclic-node.js +0 -160
  45. package/dist/2608.jclic-node.js.map +0 -1
  46. package/dist/2715.jclic-node.js +0 -554
  47. package/dist/2715.jclic-node.js.map +0 -1
  48. package/dist/277.jclic-node.js +0 -22
  49. package/dist/277.jclic-node.js.map +0 -1
  50. package/dist/2921.jclic-node.js +0 -660
  51. package/dist/2921.jclic-node.js.map +0 -1
  52. package/dist/2952.jclic-node.js +0 -101
  53. package/dist/2952.jclic-node.js.map +0 -1
  54. package/dist/3018.jclic-node.js +0 -421
  55. package/dist/3018.jclic-node.js.map +0 -1
  56. package/dist/3019.jclic-node.js +0 -682
  57. package/dist/3019.jclic-node.js.map +0 -1
  58. package/dist/3231.jclic-node.js +0 -274
  59. package/dist/3231.jclic-node.js.map +0 -1
  60. package/dist/331.jclic-node.js +0 -115
  61. package/dist/331.jclic-node.js.map +0 -1
  62. package/dist/3391.jclic-node.js +0 -276
  63. package/dist/3391.jclic-node.js.map +0 -1
  64. package/dist/3502.jclic-node.js +0 -671
  65. package/dist/3502.jclic-node.js.map +0 -1
  66. package/dist/3653.jclic-node.js +0 -982
  67. package/dist/3653.jclic-node.js.map +0 -1
  68. package/dist/371.jclic.min.js +0 -2
  69. package/dist/371.jclic.min.js.map +0 -1
  70. package/dist/3856.jclic-node.js +0 -575
  71. package/dist/3856.jclic-node.js.map +0 -1
  72. package/dist/4112.jclic-node.js +0 -659
  73. package/dist/4112.jclic-node.js.map +0 -1
  74. package/dist/4123.jclic-node.js +0 -910
  75. package/dist/4123.jclic-node.js.map +0 -1
  76. package/dist/427.jclic-node.js +0 -894
  77. package/dist/427.jclic-node.js.map +0 -1
  78. package/dist/4483.jclic-node.js +0 -327
  79. package/dist/4483.jclic-node.js.map +0 -1
  80. package/dist/4548.jclic-node.js +0 -1078
  81. package/dist/4548.jclic-node.js.map +0 -1
  82. package/dist/466.jclic-node.js +0 -99
  83. package/dist/466.jclic-node.js.map +0 -1
  84. package/dist/485.jclic-node.js +0 -783
  85. package/dist/485.jclic-node.js.map +0 -1
  86. package/dist/4921.jclic-node.js +0 -500
  87. package/dist/4921.jclic-node.js.map +0 -1
  88. package/dist/5091.jclic-node.js +0 -239
  89. package/dist/5091.jclic-node.js.map +0 -1
  90. package/dist/520.jclic-node.js +0 -550
  91. package/dist/520.jclic-node.js.map +0 -1
  92. package/dist/5312.jclic-node.js +0 -1126
  93. package/dist/5312.jclic-node.js.map +0 -1
  94. package/dist/5338.jclic-node.js +0 -212
  95. package/dist/5338.jclic-node.js.map +0 -1
  96. package/dist/5344.jclic-node.js +0 -229
  97. package/dist/5344.jclic-node.js.map +0 -1
  98. package/dist/5550.jclic-node.js +0 -238
  99. package/dist/5550.jclic-node.js.map +0 -1
  100. package/dist/5626.jclic-node.js +0 -614
  101. package/dist/5626.jclic-node.js.map +0 -1
  102. package/dist/5977.jclic-node.js +0 -1081
  103. package/dist/5977.jclic-node.js.map +0 -1
  104. package/dist/6148.jclic-node.js +0 -345
  105. package/dist/6148.jclic-node.js.map +0 -1
  106. package/dist/6176.jclic-node.js +0 -481
  107. package/dist/6176.jclic-node.js.map +0 -1
  108. package/dist/6221.jclic-node.js +0 -1072
  109. package/dist/6221.jclic-node.js.map +0 -1
  110. package/dist/6238.jclic-node.js +0 -718
  111. package/dist/6238.jclic-node.js.map +0 -1
  112. package/dist/6454.jclic-node.js +0 -1413
  113. package/dist/6454.jclic-node.js.map +0 -1
  114. package/dist/6565.jclic-node.js +0 -294
  115. package/dist/6565.jclic-node.js.map +0 -1
  116. package/dist/6579.jclic-node.js +0 -719
  117. package/dist/6579.jclic-node.js.map +0 -1
  118. package/dist/6715.jclic-node.js +0 -148
  119. package/dist/6715.jclic-node.js.map +0 -1
  120. package/dist/6777.jclic-node.js +0 -171
  121. package/dist/6777.jclic-node.js.map +0 -1
  122. package/dist/6782.jclic-node.js +0 -1611
  123. package/dist/6782.jclic-node.js.map +0 -1
  124. package/dist/6847.jclic-node.js +0 -601
  125. package/dist/6847.jclic-node.js.map +0 -1
  126. package/dist/6856.jclic-node.js +0 -252
  127. package/dist/6856.jclic-node.js.map +0 -1
  128. package/dist/696.jclic-node.js +0 -1821
  129. package/dist/696.jclic-node.js.map +0 -1
  130. package/dist/698.jclic-node.js +0 -583
  131. package/dist/698.jclic-node.js.map +0 -1
  132. package/dist/704.jclic-node.js +0 -80
  133. package/dist/704.jclic-node.js.map +0 -1
  134. package/dist/7046.jclic-node.js +0 -735
  135. package/dist/7046.jclic-node.js.map +0 -1
  136. package/dist/7220.jclic-node.js +0 -156
  137. package/dist/7220.jclic-node.js.map +0 -1
  138. package/dist/7257.jclic-node.js +0 -931
  139. package/dist/7257.jclic-node.js.map +0 -1
  140. package/dist/743.jclic-node.js +0 -583
  141. package/dist/743.jclic-node.js.map +0 -1
  142. package/dist/757.jclic-node.js +0 -1072
  143. package/dist/757.jclic-node.js.map +0 -1
  144. package/dist/7781.jclic-node.js +0 -202
  145. package/dist/7781.jclic-node.js.map +0 -1
  146. package/dist/7912.jclic-node.js +0 -2103
  147. package/dist/7912.jclic-node.js.map +0 -1
  148. package/dist/827.jclic-node.js +0 -708
  149. package/dist/827.jclic-node.js.map +0 -1
  150. package/dist/8276.jclic-node.js +0 -409
  151. package/dist/8276.jclic-node.js.map +0 -1
  152. package/dist/8322.jclic-node.js +0 -498
  153. package/dist/8322.jclic-node.js.map +0 -1
  154. package/dist/8641.jclic-node.js +0 -360
  155. package/dist/8641.jclic-node.js.map +0 -1
  156. package/dist/8837.jclic-node.js +0 -651
  157. package/dist/8837.jclic-node.js.map +0 -1
  158. package/dist/8895.jclic-node.js +0 -151
  159. package/dist/8895.jclic-node.js.map +0 -1
  160. package/dist/9072.jclic-node.js +0 -1285
  161. package/dist/9072.jclic-node.js.map +0 -1
  162. package/dist/9078.jclic-node.js +0 -935
  163. package/dist/9078.jclic-node.js.map +0 -1
  164. package/dist/9103.jclic-node.js +0 -718
  165. package/dist/9103.jclic-node.js.map +0 -1
  166. package/dist/9359.jclic-node.js +0 -145
  167. package/dist/9359.jclic-node.js.map +0 -1
  168. package/dist/9409.jclic-node.js +0 -921
  169. package/dist/9409.jclic-node.js.map +0 -1
  170. package/dist/9513.jclic-node.js +0 -720
  171. package/dist/9513.jclic-node.js.map +0 -1
  172. package/dist/9704.jclic-node.js +0 -81
  173. package/dist/9704.jclic-node.js.map +0 -1
  174. package/dist/9950.jclic-node.js +0 -827
  175. package/dist/9950.jclic-node.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"2921.jclic-node.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEuB;AACqC;AACH;AACd;AACK;AACO;;AAEvD;AACA,kBAAkB,yCAAyC,oBAAoB,kDAAkD;AACjI;AACA;AACA;AACA;AACO,sBAAsB,2DAAQ;AACrC;AACA;AACA,aAAa,0CAA0C,eAAe,6DAA6D;AACnI;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,mDAAmD,OAAO,wDAAwD;AAC1H;AACA;AACO,2BAA2B,gEAAa;AAC/C;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F,aAAa,gCAAgC;AAC7C;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6BAA6B,6CAAC;AAC9B,uCAAuC,qBAAqB;AAC5D;AACA;AACA;AACA,WAAW;AACX;;AAEA;AACA;;AAEA;AACA;;AAEA,iBAAiB,+DAAa;AAC9B;AACA,qBAAqB,+DAAa,0EAA0E,+DAAW;;AAEvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,mCAAmC;AACzE;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,wDAAS;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC,eAAe;AACf;AACA;AACA;AACA;AACA,MAAM,wDAAM;AACZ;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,6CAAC,mBAAmB,eAAe,YAAY,gBAAgB;AACpF;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC,qBAAqB,kBAAkB;AACvC,gCAAgC,iBAAiB,KAAK,kBAAkB;AACxE,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B,eAAe,SAAS;AACxB,6CAA6C;AAC7C;AACA;AACA;AACA,oBAAoB,oDAAK;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,2DAA2D;AACrE;AACA,YAAY,wCAAwC;AACpD;AACA;AACA,UAAU,2DAA2D;AACrE;AACA;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA,CAAC;;AAED;AACA,qDAAqD;AACrD,UAAU,OAAO;AACjB;;AAEA;AACA,iEAAe,2DAAQ,0CAA0C,EAAC;;;;;;;;;;;;;;;;AC5VlE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE6C;AACN;AACiB;AACR;;AAEhD;AACA,uBAAuB,2DAA2D;AAClF,IAAI,2CAA2C,uBAAuB,iDAAiD;AACvH;AACA;AACA;AACA;AACO,4BAA4B,wDAAY;AAC/C;AACA;AACA,aAAa,sCAAsC;AACnD,aAAa,sBAAsB;AACnC,aAAa,sBAAsB;AACnC,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,wDAAS;AAC3B,UAAU,oDAAK;AACf,UAAU,wDAAS;AACnB;AACA;;AAEA;AACA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA,iBAAiB,qDAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,qDAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,uEAAuE;AAC7E,aAAa,sCAAsC;AACnD,aAAa,sBAAsB;AACnC,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,gDAAgD;AAC7D,aAAa,8BAA8B;AAC3C,aAAa,8BAA8B;AAC3C;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB,MAAM,yDAAQ;AACd,MAAM,yDAAQ;AACd;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB,MAAM,4DAAO;AACb,MAAM,4DAAO;AACb;;AAEA;AACA,sDAAsD,iDAAiD;AACvG;AACA;AACA,aAAa,kCAAkC;AAC/C,eAAe;AACf;AACA;AACA,eAAe,oDAAK;AACpB;;AAEA;AACA,kDAAkD,kDAAkD;AACpG;AACA;AACA,aAAa,kCAAkC;AAC/C,aAAa,kCAAkC;AAC/C,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,eAAe,oDAAK;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED,iEAAe,aAAa,EAAC;;;;;;;;;;;;;;AClL7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEiC;AACuB;;AAExD;AACA;AACA,yBAAyB,0CAA0C;AACnE;AACA;AACA;AACO,0BAA0B,kDAAM;AACvC;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC,sBAAsB,gBAAgB;AACtC,iDAAiD,wDAAS,KAAK,oDAAK,oBAAoB,wDAAS;AACjG;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,YAAY,SAAS;AACrB;AACA,CAAC;;AAED;AACA,iEAAe,kDAAM,2CAA2C,EAAC","sources":["webpack://jclic/./src/activities/panels/Explore.js","webpack://jclic/./src/boxes/ActiveBoxGrid.js","webpack://jclic/./src/shapers/Rectangular.js"],"sourcesContent":["/**\n * File : activities/panels/Explore.js\n * Created : 04/06/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport $ from 'jquery';\nimport { Activity, ActivityPanel } from '../../Activity.js';\nimport ActiveBoxGrid from '../../boxes/ActiveBoxGrid.js';\nimport BoxBag from '../../boxes/BoxBag.js';\nimport { Rectangle, Point } from '../../AWT.js';\nimport Rectangular from '../../shapers/Rectangular.js';\n\n/**\n * This class of {@link module:Activity.Activity Activity} shows a panel with {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects. Users can click\n * on this objects to obtain associated information. This associated information, displayed in\n * a second panel, can be text graphics, sound, video... or a combination of them.\n * @extends module:Activity.Activity\n */\nexport class Explore extends Activity {\n /**\n * Explore constructor\n * @param {module:project/JClicProject.JClicProject} project - The {@link module:project/JClicProject.JClicProject JClicProject} to which this activity belongs\n */\n constructor(project) {\n super(project);\n }\n\n /**\n * Activities of this type never end, so automatic sequences must pause here\n * @override\n * @returns {boolean}\n */\n mustPauseSequence() {\n return true;\n }\n\n /**\n * Retrieves the minimum number of actions needed to solve this activity\n * @override\n * @returns {number}\n */\n getMinNumActions() {\n return 0;\n }\n\n /**\n * Usually this activity don't use random to shuffle internal components, but in some cases\n * can make use of it.\n * @override\n * @returns {boolean}\n */\n hasRandom() {\n return true;\n }\n}\n\n/**\n * The {@link module:Activity.ActivityPanel ActivityPanel} where {@link module:activities/panels/Explore.Explore Explore} activities are played.\n * @extends module:Activity.ActivityPanel\n */\nexport class ExplorePanel extends ActivityPanel {\n /**\n * ExplorePanel constructor\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs\n * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the\n * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.\n * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy\n */\n constructor(act, ps, $div) {\n super(act, ps, $div);\n }\n\n /**\n * Miscellaneous cleaning operations\n * @override\n */\n clear() {\n if (this.bgA) {\n this.bgA.end();\n this.bgA = null;\n }\n if (this.bgB) {\n this.bgB.end();\n this.bgB = null;\n }\n }\n\n /**\n * Prepares the visual components of the activity\n * @override\n */\n buildVisualComponents() {\n if (this.firstRun)\n super.buildVisualComponents();\n this.clear();\n const\n abcA = this.act.abc['primary'],\n abcB = this.act.abc['secondary'];\n\n if (abcA && abcB) {\n if (abcA.image) {\n abcA.setImgContent(this.act.project.mediaBag, null, false);\n if (abcA.animatedGifFile && !abcA.shaper.rectangularShapes && !this.act.shuffleA)\n this.$animatedBg = $('<span/>').css({\n 'background-image': `url(${abcA.animatedGifFile})`,\n 'background-position': 'center',\n 'background-repeat': 'no-repeat',\n position: 'absolute'\n }).appendTo(this.$div);\n }\n\n if (abcB.image)\n abcB.setImgContent(this.act.project.mediaBag, null, false);\n\n if (this.act.acp !== null)\n this.act.acp.generateContent(abcA.nch, abcA.ncw, [abcA, abcB], false);\n\n this.bgA = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abcA);\n const w = (this.act.boxGridPos === 'AUB' || this.act.boxGridPos === 'BUA') ? abcA.getTotalWidth() : abcB.w;\n this.bgB = new ActiveBoxGrid(null, this, abcB.style, this.act.margin, this.act.margin, w, abcB.h, new Rectangular(1, 1));\n\n this.bgA.setContent(abcA);\n this.bgA.setDefaultIdAss();\n if (this.$animatedBg)\n this.bgA.setCellAttr('tmpTrans', true);\n this.bgB.getActiveBox(0).setInactive(false);\n this.bgA.setVisible(true);\n this.bgB.setVisible(true);\n }\n }\n\n /**\n * Basic initialization procedure\n * @override\n */\n initActivity() {\n super.initActivity();\n if (!this.firstRun)\n this.buildVisualComponents();\n else\n this.firstRun = false;\n\n if (this.bgA && this.bgB) {\n // Scramble cells\n if (this.act.shuffleA)\n this.shuffle([this.bgA], true, true);\n\n if (this.useOrder)\n this.currentItem = this.bgA.getNextItem(-1);\n\n this.setAndPlayMsg('initial', 'start');\n this.invalidate().update();\n this.playing = true;\n }\n }\n\n /**\n * Updates the graphic content of this panel.\n * This method will be called from {@link module:AWT.Container#update} when needed.\n * @override\n * @param {module:AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,\n * it's the whole panel.\n */\n updateContent(dirtyRegion) {\n super.updateContent(dirtyRegion);\n if (this.bgA && this.bgB && this.$canvas) {\n const\n canvas = this.$canvas.get(-1),\n ctx = canvas.getContext('2d');\n if (!dirtyRegion)\n dirtyRegion = new Rectangle(0, 0, canvas.width, canvas.height);\n ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);\n this.bgA.update(ctx, dirtyRegion);\n this.bgB.update(ctx, dirtyRegion);\n }\n return this;\n }\n\n /**\n * Sets the real dimension of this panel.\n * @override\n * @param {module:AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel\n * @returns {module:AWT.Dimension}\n */\n setDimension(preferredMaxSize) {\n return !this.bgA || !this.bgB || this.getBounds().equals(preferredMaxSize) ?\n preferredMaxSize :\n BoxBag.layoutDouble(preferredMaxSize, this.bgA, this.bgB, this.act.boxGridPos, this.act.margin);\n }\n\n /**\n * Sets the size and position of this activity panel\n * @override\n * @param {module:AWT.Rectangle} rect\n */\n setBounds(rect) {\n if (this.$canvas)\n this.$canvas.remove();\n super.setBounds(rect);\n\n if (this.bgA || this.bgB) {\n // Create the main canvas\n this.$canvas = $(`<canvas width=\"${rect.dim.width}\" height=\"${rect.dim.height}\"/>`).css({\n position: 'absolute',\n top: 0,\n left: 0\n });\n // Resize animated gif background\n if (this.$animatedBg) {\n const bgRect = this.bgA.getBounds();\n this.$animatedBg.css({\n left: bgRect.pos.x,\n top: bgRect.pos.y,\n width: `${bgRect.dim.width}px`,\n height: `${bgRect.dim.height}px`,\n 'background-size': `${bgRect.dim.width}px ${bgRect.dim.height}px`\n });\n }\n this.$div.append(this.$canvas);\n // Repaint all\n this.invalidate().update();\n }\n }\n\n /**\n * Builds the accessible components needed for this ActivityPanel\n * This method is called when all main elements are placed and visible, when the activity is ready\n * to start or when resized.\n * @override\n */\n buildAccessibleComponents() {\n if (this.$canvas && this.accessibleCanvas) {\n super.buildAccessibleComponents();\n if (this.bgA)\n this.bgA.buildAccessibleElements(this.$canvas, this.$div);\n if (this.bgB)\n this.bgB.buildAccessibleElements(this.$canvas, this.$div);\n }\n }\n\n /**\n * Main handler used to process mouse, touch, keyboard and edit events\n * @override\n * @param {external:Event} event - The HTML event to be processed\n * @returns {boolean} - When this event handler returns `false`, jQuery will stop its\n * propagation through the DOM tree. See: {@link http://api.jquery.com/on}\n */\n processEvent(event) {\n if (this.playing) {\n const p = new Point(\n event.pageX - this.$div.offset().left,\n event.pageY - this.$div.offset().top),\n // Array to be filled with actions to be executed at the end of event processing\n delayedActions = [];\n\n switch (event.type) {\n case 'click':\n this.ps.stopMedia(1);\n const bx1 = this.bgA.findActiveBox(p);\n if (bx1) {\n const bx2 = this.bgB.getActiveBox(0);\n if (bx1.idAss !== -1 && (!this.act.useOrder || bx1.idOrder === this.currentItem)) {\n bx2.setContent(this.act.abc['secondary'], bx1.idAss);\n if (!bx2.playMedia(this.ps, delayedActions) && !bx1.playMedia(this.ps, delayedActions))\n this.playEvent('CLICK');\n if (this.act.useOrder)\n this.currentItem = this.bgA.getNextItem(this.currentItem);\n this.ps.reportNewAction(this.act, 'SELECT', bx1.getDescription(), bx2.getDescription(), true, 0);\n // Modified May 2020: Focusing `accessibleElement` will always draw a border on bx2\n // if (bx2.$accessibleElement)\n // bx2.$accessibleElement.focus();\n\n // Clic 3.0 behavior, applied only to one-cell activities:\n if (bx1.idAss === 0 && this.bgA.getNumCells() === 1) {\n const seq = this.act.project.activitySequence;\n const ase = seq.getCurrentAct();\n if (ase && seq.hasNextAct(true) && ase.delay > 0\n && (seq.getNavButtonsFlag() !== 'both' && seq.getNavButtonsFlag() !== 'fwd')) {\n this.finishActivity(true);\n }\n }\n\n } else {\n bx2.clear();\n bx2.setInactive(false);\n }\n this.update();\n }\n break;\n }\n delayedActions.forEach(action => action());\n event.preventDefault();\n }\n }\n}\n\nObject.assign(ExplorePanel.prototype, {\n /**\n * The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} object containing the information to be displayed in the `primary` panel\n * @name module:activities/panels/Explore.ExplorePanel#bgA\n * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */\n bgA: null,\n /**\n * The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} object containing the information associated to `primary` elements.\n * Only one of this elements will be showed for each click done in the `primary` panel.\n * @name module:activities/panels/Explore.ExplorePanel#bgB\n * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */\n bgB: null,\n /**\n * List of mouse, touch and keyboard events intercepted by this panel\n * @override\n * @name module:activities/panels/Explore.ExplorePanel#events\n * @type {string[]} */\n events: ['click'],\n});\n\n/**\n * Panel class associated to this type of activity: {@link module:activities/panels/Explore.ExplorePanel ExplorePanel}\n * @type {class} */\nExplore.Panel = ExplorePanel;\n\n// Register activity class\nexport default Activity.registerClass('@panels.Explore', Explore);\n","/**\n * File : boxes/ActiveBoxGrid.js\n * Created : 19/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport ActiveBoxBag from './ActiveBoxBag.js';\nimport ActiveBox from './ActiveBox.js';\nimport { Rectangle, Dimension, Point } from '../AWT.js';\nimport { settings, roundTo } from '../Utils.js';\n\n/**\n * This class extends {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} with constructors that take an argument of type\n * {@link module:shapers/Shaper.Shaper Shaper} used to build all its {@link module:boxes/ActiveBox.ActiveBox ActiveBox}components. It also maintains information\n * about the number of \"rows\" and \"columns\", useful to compute valid (integer) values when\n * resizing or moving its components.\n * @extends module:boxes/ActiveBoxBag.ActiveBoxBag\n */\nexport class ActiveBoxGrid extends ActiveBoxBag {\n /**\n * ActiveBxGrid constructor\n * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs\n * @param {module:AWT.Container} container - The container where this box grid is placed.\n * @param {module:boxes/BoxBase} boxBase - The object where colors, fonts, border and other graphic properties\n * @param {number} px - `X` coordinate of the upper left corner of this box grid\n * @param {number} py - `Y` coordinate of the upper left corner of this box grid\n * @param {number} setWidth - Total width of the box grid\n * @param {number} setHeight - Total height of the box grid\n * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects\n */\n constructor(parent, container, boxBase, px, py, setWidth, setHeight, sh) {\n // ActiveBoxGrid derives from ActiveBoxBag\n super(parent, container, boxBase);\n\n this.nCols = sh.nCols;\n this.nRows = sh.nRows;\n\n // This will be the enclosing rectangle of this ActiveBox bag\n const r = new Rectangle(\n new Point(px, py),\n new Dimension(\n Math.round(setWidth / this.nCols) * this.nCols,\n Math.round(setHeight / this.nRows) * this.nRows));\n\n // Create all the [ActiveBox](ActiveBox.html) objects based on the\n // shapes provided by the [Shaper](Shaper.html)\n for (let i = 0; i < sh.nCells; i++) {\n const\n tmpSh = sh.getShape(i, r),\n bx = new ActiveBox(this, container, boxBase, i, tmpSh.getBounds());\n if (!sh.rectangularShapes)\n bx.setShape(tmpSh);\n this.addActiveBox(bx);\n }\n\n // If the Shaper has `remainder` (extra space), set the background box of this\n // [BoxBag](BoxBag.html)\n if (sh.hasRemainder) {\n const\n tmpSh = sh.getRemainderShape(r),\n bx = new ActiveBox(this, container, boxBase, 0, tmpSh.getBounds());\n bx.setShape(tmpSh);\n this.setBackgroundBox(bx);\n }\n }\n\n /**\n * This factory constructor creates a new empty grid with the number of cells indicated by the\n * {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} `abc`, not filling the cells with any content.\n * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs\n * @param {module:AWT.Container} container - The container where this box grid is placed.\n * @param {number} px - `X` coordinate of the upper left corner of this box grid\n * @param {number} py - `Y` coordinate of the upper left corner of this box grid\n * @param {module:boxes/ActiveBagContent.ActiveBagContent} abc - Used only to get the number of cells and the shaper (when `sh` is `null`)\n * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects\n * @param {module:boxes/BoxBase.BoxBase} boxBase - The object where colors, fonts, border and other graphic properties\n * of this box grid are defined.\n * @returns {module:boxes/ActiveBoxGrid.ActiveBoxGrid}\n */\n static createEmptyGrid(parent, container, px, py, abc, sh, boxBase) {\n const result = abc ? new ActiveBoxGrid(parent, container,\n boxBase || abc.style,\n px, py,\n abc.getTotalWidth(), abc.getTotalHeight(),\n sh || abc.getShaper()) : null;\n\n if (result)\n result.setBorder(abc.border);\n\n return result;\n }\n\n /**\n * Gets the minimum size of this grid\n * @returns {module:AWT.Dimension}\n */\n getMinimumSize() {\n return new Dimension(\n settings.MIN_CELL_SIZE * this.nCols,\n settings.MIN_CELL_SIZE * this.nRows);\n }\n\n /**\n * Gets a scaled size of this grid, rounded to the nearest integer values\n * @param {number} scale - The scale factor\n * @returns {module:AWT.Dimension}\n */\n getScaledSize(scale) {\n return new Dimension(\n roundTo(scale * this.preferredBounds.dim.width, this.nCols),\n roundTo(scale * this.preferredBounds.dim.height, this.nRows));\n }\n\n /**\n * Returns the logical coordinates of the provided {@link module:boxes/ActiveBox.ActiveBox ActiveBox}.\n * The units of the result are not pixels, but ordinal numbers (relative positions) of columns\n * and rows in the grid.\n * @param {module:boxes/ActiveBox.ActiveBox} bx - The box to process\n * @returns {module:AWT.Point}\n */\n getCoord(bx) {\n return new Point(bx.idLoc % this.nCols, Math.floor(bx.idLoc / this.nCols));\n }\n\n /**\n * Calculates the logical distance between two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects.\n * Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows\n * in the grid.\n * @param {module:boxes/ActiveBox.ActiveBox} src - First box\n * @param {module:boxes/ActiveBox.ActiveBox} dest - Second box\n * @returns {module:AWT.Point}\n */\n getCoordDist(src, dest) {\n const\n ptSrc = this.getCoord(src),\n ptDest = this.getCoord(dest);\n return new Point(ptDest.x - ptSrc.x, ptDest.y - ptSrc.y);\n }\n}\n\nObject.assign(ActiveBoxGrid.prototype, {\n /**\n * Number of columns of this box grid\n * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nCols\n * @type {number} */\n nCols: 1,\n /**\n * Number of rows of this box grid\n * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nRows\n * @type {number} */\n nRows: 1,\n});\n\nexport default ActiveBoxGrid;\n","/**\n * File : shapers/Rectangular.js\n * Created : 19/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport Shaper from './Shaper.js';\nimport { Rectangle, Point, Dimension } from '../AWT.js';\n\n/**\n *\n * This is the simplest {@link module:shapers/Shaper.Shaper Shaper}. It divides the graphic object in a set of rectangular\n * shapes distributed in the specified number of rows and columns.\n * @extends module:shapers/Shaper.Shaper\n */\nexport class Rectangular extends Shaper {\n /**\n * Rectangular constructor\n * @param {number} nx - Number of columns\n * @param {number} ny - Number of rows\n */\n constructor(nx, ny) {\n super(nx, ny);\n }\n\n /**\n * Builds the rectangular shapes based on the number of rows and columns\n * @override\n */\n buildShapes() {\n const\n w = 1 / this.nCols,\n h = 1 / this.nRows;\n for (let y = 0; y < this.nRows; y++) {\n for (let x = 0; x < this.nCols; x++) {\n this.shapeData[y * this.nCols + x] = new Rectangle(new Point(x * w, y * h), new Dimension(w, h));\n }\n }\n this.initiated = true;\n }\n}\n\nObject.assign(Rectangular.prototype, {\n /**\n * Overrides same flag in {@link module:/shapers/Shaper.Shaper#rectangularShapes Shaper#rectangularShapes}\n * @name module:shapers/Rectangular.Rectangular#rectangularShapes\n * @override\n * @type {boolean} */\n rectangularShapes: true,\n});\n\n// Register this class in the list of known shapers\nexport default Shaper.registerClass('@Rectangular', Rectangular);\n"],"names":[],"sourceRoot":""}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- exports.id = 2952;
3
- exports.ids = [2952];
4
- exports.modules = {
5
-
6
- /***/ 2952:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11
- /* harmony export */ });
12
- /* unused harmony export BlueSkin */
13
- /* harmony import */ var _Skin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(757);
14
- /* harmony import */ var _DefaultSkin_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1588);
15
- /**
16
- * File : skins/BlueSkin.js
17
- * Created : 04/07/2016
18
- * By : Francesc Busquets <francesc@gmail.com>
19
- *
20
- * JClic.js
21
- * An HTML5 player of JClic activities
22
- * https://projectestac.github.io/jclic.js
23
- *
24
- * @source https://github.com/projectestac/jclic.js
25
- *
26
- * @license EUPL-1.2
27
- * @licstart
28
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
29
- *
30
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
31
- * the European Commission- subsequent versions of the EUPL (the "Licence");
32
- * You may not use this work except in compliance with the Licence.
33
- *
34
- * You may obtain a copy of the Licence at:
35
- * https://joinup.ec.europa.eu/software/page/eupl
36
- *
37
- * Unless required by applicable law or agreed to in writing, software
38
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
39
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
40
- * Licence for the specific language governing permissions and limitations
41
- * under the Licence.
42
- * @licend
43
- * @module
44
- */
45
-
46
-
47
-
48
-
49
-
50
- /**
51
- * This is a variant of the default {@link module:skins/Skin.Skin Skin} used by JClic.js
52
- * It differs from {@link module:skins/DefaultSkin.DefaultSkin DefaultSkin} only in some colors
53
- * @extends module:skins/DefaultSkin.DefaultSkin
54
- */
55
- class BlueSkin extends _DefaultSkin_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
56
- /**
57
- * BlueSkin constructor
58
- * @param {module:JClicPlayer.JClicPlayer} ps - The PlayStation (currently a {@link module:JClicPlayer.JClicPlayer JClicPlayer}) used to load and
59
- * realize the media objects needed to build the Skin.
60
- * @param {string} [name] - The skin class name
61
- * @param {object} [options] - Optional parameter with additional options
62
- */
63
- constructor(ps, name = null, options = {}) {
64
- // BlueSkin extends [DefaultSkin](DefaultSkin.html)
65
- super(ps, name, options);
66
- }
67
-
68
- /**
69
- * Returns the CSS styles used by this skin. This method should be called only from
70
- * the `Skin` constructor, and overridded by subclasses if needed.
71
- * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
72
- * @returns {string}
73
- */
74
- _getStyleSheets(media = 'default') {
75
- return super._getStyleSheets(media) + (media === 'default' ? this.skinCSS : '');
76
- }
77
- }
78
-
79
- Object.assign(BlueSkin.prototype, {
80
- /**
81
- * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
82
- * @name module:skins/BlueSkin.BlueSkin#skinId
83
- * @override
84
- * @type {string} */
85
- skinId: 'JClicBlueSkin',
86
- /**
87
- * Styles used in this skin
88
- * @name module:skins/BlueSkin.BlueSkin#skinCSS
89
- * @type {string} */
90
- skinCSS: '.ID {background-color:#1990FF;}',
91
- });
92
-
93
- // Register this class in the list of available skins
94
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Skin_js__WEBPACK_IMPORTED_MODULE_0__["default"].registerClass('blue', BlueSkin));
95
-
96
-
97
- /***/ })
98
-
99
- };
100
- ;
101
- //# sourceMappingURL=2952.jclic-node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"2952.jclic-node.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE6B;AACc;;;AAG3C;AACA,qCAAqC,mCAAmC;AACxE,oBAAoB,wDAAwD;AAC5E;AACA;AACO,uBAAuB,uDAAW;AACzC;AACA;AACA,aAAa,gCAAgC,mCAAmC,iDAAiD;AACjI;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA,2CAA2C;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,iBAAiB,0BAA0B;AAC3C,CAAC;;AAED;AACA,iEAAe,gDAAI,gCAAgC,EAAC","sources":["webpack://jclic/./src/skins/BlueSkin.js"],"sourcesContent":["/**\n * File : skins/BlueSkin.js\n * Created : 04/07/2016\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport Skin from './Skin.js';\nimport DefaultSkin from './DefaultSkin.js';\n\n\n/**\n * This is a variant of the default {@link module:skins/Skin.Skin Skin} used by JClic.js\n * It differs from {@link module:skins/DefaultSkin.DefaultSkin DefaultSkin} only in some colors\n * @extends module:skins/DefaultSkin.DefaultSkin\n */\nexport class BlueSkin extends DefaultSkin {\n /**\n * BlueSkin constructor\n * @param {module:JClicPlayer.JClicPlayer} ps - The PlayStation (currently a {@link module:JClicPlayer.JClicPlayer JClicPlayer}) used to load and\n * realize the media objects needed to build the Skin.\n * @param {string} [name] - The skin class name\n * @param {object} [options] - Optional parameter with additional options\n */\n constructor(ps, name = null, options = {}) {\n // BlueSkin extends [DefaultSkin](DefaultSkin.html)\n super(ps, name, options);\n }\n\n /**\n * Returns the CSS styles used by this skin. This method should be called only from\n * the `Skin` constructor, and overridded by subclasses if needed.\n * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'\n * @returns {string}\n */\n _getStyleSheets(media = 'default') {\n return super._getStyleSheets(media) + (media === 'default' ? this.skinCSS : '');\n }\n}\n\nObject.assign(BlueSkin.prototype, {\n /**\n * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.\n * @name module:skins/BlueSkin.BlueSkin#skinId\n * @override\n * @type {string} */\n skinId: 'JClicBlueSkin',\n /**\n * Styles used in this skin\n * @name module:skins/BlueSkin.BlueSkin#skinCSS\n * @type {string} */\n skinCSS: '.ID {background-color:#1990FF;}',\n});\n\n// Register this class in the list of available skins\nexport default Skin.registerClass('blue', BlueSkin);\n"],"names":[],"sourceRoot":""}
@@ -1,421 +0,0 @@
1
- "use strict";
2
- exports.id = 3018;
3
- exports.ids = [3018];
4
- exports.modules = {
5
-
6
- /***/ 3018:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11
- /* harmony export */ });
12
- /* unused harmony export BoxBase */
13
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
14
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
15
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1253);
16
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7912);
17
- /**
18
- * File : boxes/BoxBase.js
19
- * Created : 12/04/2015
20
- * By : Francesc Busquets <francesc@gmail.com>
21
- *
22
- * JClic.js
23
- * An HTML5 player of JClic activities
24
- * https://projectestac.github.io/jclic.js
25
- *
26
- * @source https://github.com/projectestac/jclic.js
27
- *
28
- * @license EUPL-1.2
29
- * @licstart
30
- * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
31
- *
32
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
33
- * the European Commission- subsequent versions of the EUPL (the "Licence");
34
- * You may not use this work except in compliance with the Licence.
35
- *
36
- * You may obtain a copy of the Licence at:
37
- * https://joinup.ec.europa.eu/software/page/eupl
38
- *
39
- * Unless required by applicable law or agreed to in writing, software
40
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
41
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
42
- * Licence for the specific language governing permissions and limitations
43
- * under the Licence.
44
- * @licend
45
- * @module
46
- */
47
-
48
-
49
-
50
-
51
-
52
- const defaultValues = _Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .settings */ .W0.BoxBase;
53
-
54
- /**
55
- * This class contains all the main visual attributes needed to draw {@link module:boxes/AbstractBox.AbstractBox AbstractBox} objects:
56
- * background and foreground colors, gradients, colors for special states (inactive, alternative,
57
- * disabled...), margins, fonts, border strokes, etc.
58
- *
59
- * Objects derived from {@link module:boxes/AbstractBox.AbstractBox AbstractBox} can have inheritance: boxes that act as "containers"
60
- * of other boxes (like {@link module:boxes/BoxBag.BoxBag BoxBag}). Most of the attributes of `BoxBase` can be `null`,
61
- * meaning that the value of the ancestor -or the default value if the box has no ancestors- must
62
- * be used.
63
- */
64
- class BoxBase {
65
- /**
66
- * BoxBase constructor
67
- * @param {module:boxes/BoxBase.BoxBase} [parent] - Another BoxBase object used to determine the value of properties not
68
- * locally set.
69
- */
70
- constructor(parent) {
71
- this.parent = parent || null;
72
- }
73
-
74
- /**
75
- * Loads the BoxBase settings from a specific JQuery XML element
76
- * @param {external:jQuery} $xml - The XML element to parse
77
- */
78
- setProperties($xml) {
79
- //
80
- // Read attributes
81
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .attrForEach */ .GM)($xml.get(0).attributes, (name, val) => {
82
- switch (name) {
83
- case 'shadow':
84
- case 'transparent':
85
- this[name] = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getBoolean */ .pW)(val, false);
86
- break;
87
- case 'margin':
88
- this[name] = Number(val);
89
- break;
90
- case 'borderStroke':
91
- this.borderStroke = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(Number(val));
92
- break;
93
- case 'markerStroke':
94
- this.markerStroke = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(Number(val));
95
- break;
96
- }
97
- });
98
- //
99
- // Read inner elements
100
- $xml.children().each((_n, child) => {
101
- const $node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(child);
102
- switch (child.nodeName) {
103
- case 'font':
104
- this.font = (new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Font */ .KQ()).setProperties($node);
105
- break;
106
-
107
- case 'gradient':
108
- this.bgGradient = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Gradient */ .Hf().setProperties($node);
109
- break;
110
-
111
- case 'color':
112
- this.textColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('foreground'), this.textColor);
113
- this.backColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('background'), this.backColor);
114
- this.shadowColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('shadow'), this.shadowColor);
115
- this.inactiveColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('inactive'), this.inactiveColor);
116
- this.alternativeColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('alternative'), this.alternativeColor);
117
- this.borderColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('border'), this.borderColor);
118
- break;
119
- }
120
- });
121
- return this;
122
- }
123
-
124
- /**
125
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
126
- * parent references, constants and also attributes retaining the default value.
127
- * The resulting object is commonly usued to serialize elements in JSON format.
128
- * @returns {object} - The resulting object, with minimal attrributes
129
- */
130
- getAttributes() {
131
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getAttr */ .iu)(this, [
132
- 'shadow', 'transparent', 'margin',
133
- 'borderStroke', 'markerStroke', // AWT.Stroke
134
- 'font', // AWT.Font
135
- 'bgGradient', // AWT.Gradient
136
- `textColor|${BoxBase.prototype.textColor}`,
137
- `backColor|${BoxBase.prototype.backColor}`,
138
- `shadowColor|${BoxBase.prototype.shadowColor}`,
139
- `inactiveColor|${BoxBase.prototype.inactiveColor}`,
140
- `alternativeColor|${BoxBase.prototype.alternativeColor}`,
141
- `borderColor|${BoxBase.prototype.borderColor}`,
142
- ]);
143
- }
144
-
145
- /**
146
- * Reads the properties of this BoxBase from a data object
147
- * @param {object} data - The data object to be parsed
148
- * @returns {module:boxes/BoxBase.BoxBase}
149
- */
150
- setAttributes(data) {
151
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .setAttr */ .ob)(this, data, [
152
- 'shadow', 'transparent', 'margin',
153
- { key: 'borderStroke', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc },
154
- { key: 'markerStroke', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc },
155
- { key: 'font', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Font */ .KQ },
156
- { key: 'bgGradient', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Gradient */ .Hf },
157
- 'textColor',
158
- 'backColor',
159
- 'shadowColor',
160
- 'inactiveColor',
161
- 'alternativeColor',
162
- 'borderColor',
163
- ]);
164
- }
165
-
166
- /**
167
- * Gets the value of the specified property, scanning down to parents and prototype if not defined.
168
- * @param {string} property - The property to retrieve
169
- * @returns {any} - The object or value associated to this property
170
- */
171
- get(property) {
172
- if (this.hasOwnProperty(property) || this.parent === null)
173
- return this[property];
174
- else
175
- return this.parent.get(property);
176
- }
177
-
178
- /**
179
- * Sets the value of a specific property.
180
- * @param {string} property - The property name.
181
- * @param {any} value - Depends on the type of property
182
- */
183
- set(property, value) {
184
- this[property] = value;
185
- return this;
186
- }
187
-
188
- /**
189
- * Gets the value of the specified property, scanning down to parents if not defined, and returning
190
- * always an own property (not from prototype)
191
- * @param {string} property - The property to retrieve
192
- * @returns {any} - The object or value associated to this property
193
- */
194
- getOwn(property) {
195
- if (this.hasOwnProperty(property))
196
- return this[property];
197
- else if (this.parent !== null)
198
- return this.parent.getOwn(property);
199
- else {
200
- if (typeof this[property] === 'object')
201
- this[property] = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .cloneObject */ .h2)(BoxBase.prototype[property]);
202
- else
203
- this[property] = BoxBase.prototype[property];
204
- }
205
- return this[property];
206
- }
207
-
208
- /**
209
- * Gets the properties defined in this BoxBase as a collection of CSS attributes
210
- * @param {object} [css] - An optional set of initial CSS properties
211
- * @param {boolean} [inactive=false] - When `true`, get CSS attributes for an inactive cell
212
- * @param {boolean} [inverse=false] - When `true`, get CSS attributes for an inverse cell
213
- * @param {boolean} [alternative=false] - When `true`, get CSS attributes for an alternative cell
214
- * @returns {object}
215
- */
216
- getCSS(css, inactive = false, inverse = false, alternative = false) {
217
- // (css will be created by [AWT.Font.toCss](AWT.html) if null or undefined)
218
- const font = this.get('font');
219
- css = font.toCss(css);
220
-
221
- css['color'] = inverse ? this.get('backColor')
222
- : alternative ? this.get('alternativeColor')
223
- : this.get('textColor');
224
-
225
- const transparent = this.get('transparent');
226
- css['background-color'] = transparent ? 'transparent'
227
- : inactive ? this.get('inactiveColor')
228
- : inverse ? this.get('textColor') : this.get('backColor');
229
-
230
- const bgGradient = this.get('bgGradient');
231
- if (bgGradient && !transparent)
232
- css['background-image'] = bgGradient.getCss();
233
-
234
- if (this.shadow === 1) {
235
- const delta = Math.max(1, Math.round(font.size / 10));
236
- const color = this.get('shadowColor');
237
- css['text-shadow'] = `${delta}px ${delta}px 3px ${color}`;
238
- }
239
- return css;
240
- }
241
-
242
- /**
243
- * This utility method computes the width and height of text lines rendered on an HTML
244
- * __canvas__ element, reducing the font size of the BoxBase as needed when they exceed the maximum
245
- * width and/or height.
246
- * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the text.
247
- * @param {string} text - The text to drawn.
248
- * @param {number} maxWidth - Maximum width
249
- * @param {number} maxHeight - Maximum height
250
- * @returns {object[]} - An array of objects representing lines of text. Each object has a `text`
251
- * member with the text displayed in the line, and a `size` member with the line {@link module:AWT.Dimension}
252
- */
253
- prepareText(ctx, text, maxWidth, maxHeight) {
254
- const
255
- result = [],
256
- font = this.get('font'),
257
- height = font.getHeight();
258
- let totalHeight = 0;
259
-
260
- // divide the text in lines
261
- const lines = text.trim().split('\n');
262
- ctx.font = font.cssFont();
263
- for (let l = 0; l < lines.length; l++) {
264
- let line = lines[l].trim();
265
- let width = ctx.measureText(line).width;
266
- if (width > maxWidth) {
267
- // retain the last string offset that was inside maxWidth
268
- let
269
- lastOK = 0,
270
- lastOKWidth = 0;
271
- for (let p = 0; p < line.length; p++) {
272
- // Find next separator
273
- if ((0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .isSeparator */ .k$)(line[p])) {
274
- const w = ctx.measureText(line.substring(0, p).trim()).width;
275
- if (w > maxWidth)
276
- break;
277
- lastOK = p;
278
- lastOKWidth = w;
279
- }
280
- }
281
- if (lastOK > 0) {
282
- // Add a new line with the tail of the line
283
- lines.splice(l + 1, 0, line.substring(lastOK + 1).trim());
284
- // Adjust the current line
285
- line = lines[l] = line.substring(0, lastOK).trim();
286
- width = lastOKWidth;
287
- }
288
- else {
289
- // No solution found. Try resizing down the font.
290
- if (font.size > defaultValues.MIN_FONT_SIZE) {
291
- this.getOwn('font').zoom(-1);
292
- return this.prepareText(ctx, text, maxWidth, maxHeight);
293
- }
294
- }
295
- }
296
-
297
- // Add the line and the calculated dimension to `result`
298
- result.push({
299
- text: line,
300
- size: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(width, height)
301
- });
302
-
303
- totalHeight += height;
304
-
305
- if (totalHeight > maxHeight && font.size > defaultValues.MIN_FONT_SIZE) {
306
- // Max height exceeded. Try resizing down the font
307
- this.getOwn('font').zoom(-1);
308
- return this.prepareText(ctx, text, maxWidth, maxHeight);
309
- }
310
- }
311
- return result;
312
- }
313
- }
314
-
315
- Object.assign(BoxBase.prototype, {
316
- /**
317
- * The parent BoxBase object
318
- * @name module:boxes/BoxBase.BoxBase#parent
319
- * @type {module:boxes/BoxBase.BoxBase} */
320
- parent: null,
321
- /**
322
- * Default values
323
- * @name module:boxes/BoxBase.BoxBase#defaultValues
324
- * @type {object} */
325
- default: defaultValues,
326
- /**
327
- * Font size can be dynamically reduced to fit the available space if any element using this
328
- * `BoxBase` requests it. When this happen, this field contains the real font currently used
329
- * to draw text.
330
- * @name module:boxes/BoxBase.BoxBase#font
331
- * @type {module:AWT.Font} */
332
- font: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Font */ .KQ(),
333
- /**
334
- * The current font size of this BoxBase. Can be dynamically adjusted when drawing.
335
- * @name module:boxes/BoxBase.BoxBase#dynFontSize
336
- * @type {number} */
337
- dynFontSize: 0,
338
- /**
339
- * Counts the number of times the `dynFontSize` has been reset. This is useful to avoid excessive
340
- * recursive loops searching the optimal font size.
341
- * @name module:boxes/BoxBase.BoxBase#resetFontCounter
342
- * @type {number} */
343
- resetFontCounter: 0,
344
- /**
345
- * The background color
346
- * @name module:boxes/BoxBase.BoxBase#backColor
347
- * @type {string} */
348
- backColor: defaultValues.BACK_COLOR,
349
- /**
350
- * The background gradient. Default is `null`.
351
- * @name module:boxes/BoxBase.BoxBase#bgGradient
352
- * @type {module:AWT.Gradient} */
353
- bgGradient: null,
354
- /**
355
- * The color used to write text.
356
- * @name module:boxes/BoxBase.BoxBase#textColor
357
- * @type {string} */
358
- textColor: defaultValues.TEXT_COLOR,
359
- /**
360
- * The color used to draw a shadow below regular text.
361
- * @name module:boxes/BoxBase.BoxBase#shadowColor
362
- * @type {string} */
363
- shadowColor: defaultValues.SHADOW_COLOR,
364
- /**
365
- * The color of the border.
366
- * @name module:boxes/BoxBase.BoxBase#borderColor
367
- * @type {string} */
368
- borderColor: defaultValues.BORDER_COLOR,
369
- /**
370
- * The color used to draw text when a cell is in `inactive` state.
371
- * @name module:boxes/BoxBase.BoxBase#inactiveColor
372
- * @type {string} */
373
- inactiveColor: defaultValues.INACTIVE_COLOR,
374
- /**
375
- * The color used to draw text when a cell is in `alternative` state.
376
- * @name module:boxes/BoxBase.BoxBase#alternativeColor
377
- * @type {string} */
378
- alternativeColor: defaultValues.ALTERNATIVE_COLOR,
379
- /**
380
- * Whether the text should have a shadow or not
381
- * @name module:boxes/BoxBase.BoxBase#shadow
382
- * @type {boolean} */
383
- shadow: false,
384
- /**
385
- * Whether the cell's background (and its hosted component, if any) should be transparent
386
- * @name module:boxes/BoxBase.BoxBase#transparent
387
- * @type {boolean} */
388
- transparent: false,
389
- /**
390
- * Wheter the cell's background should be painted or not. This property has no effect on
391
- * hosted components.
392
- * @name module:boxes/BoxBase.BoxBase#dontFill
393
- * @type {boolean} */
394
- dontFill: false,
395
- /**
396
- * The margin to respect between text elements and the limits of the cell or other elements.
397
- * @name module:boxes/BoxBase.BoxBase#textMargin
398
- * @type {number} */
399
- textMargin: defaultValues.AC_MARGIN,
400
- /**
401
- * The stroke used to draw the border.
402
- * @name module:boxes/BoxBase.BoxBase#borderStroke
403
- * @type {module:AWT.Stroke} */
404
- borderStroke: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(defaultValues.BORDER_STROKE_WIDTH),
405
- /**
406
- * The stroke used to draw a border around marked cells.
407
- * @name module:boxes/BoxBase.BoxBase#markerStroke
408
- * @type {module:AWT.Stroke} */
409
- markerStroke: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(defaultValues.MARKER_STROKE_WIDTH),
410
- });
411
-
412
- BoxBase.DEFAULT_BOX_BASE = new BoxBase();
413
-
414
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BoxBase);
415
-
416
-
417
- /***/ })
418
-
419
- };
420
- ;
421
- //# sourceMappingURL=3018.jclic-node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"3018.jclic-node.js","mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEuB;AACiG;AAC1D;;AAE9D,sBAAsB,yDAAQ;;AAE9B;AACA,sEAAsE,wDAAwD;AAC9H;AACA;AACA;AACA,yBAAyB,wDAAwD;AACjF,yBAAyB,wCAAwC;AACjE;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA,IAAI,gEAAW;AACf;AACA;AACA;AACA,uBAAuB,+DAAU;AACjC;AACA;AACA;AACA;AACA;AACA,kCAAkC,qDAAM;AACxC;AACA;AACA,kCAAkC,qDAAM;AACxC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,oBAAoB,6CAAC;AACrB;AACA;AACA,2BAA2B,mDAAI;AAC/B;;AAEA;AACA,gCAAgC,uDAAQ;AACxC;;AAEA;AACA,2BAA2B,+DAAU;AACrC,2BAA2B,+DAAU;AACrC,6BAA6B,+DAAU;AACvC,+BAA+B,+DAAU;AACzC,kCAAkC,+DAAU;AAC5C,6BAA6B,+DAAU;AACvC;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,WAAW,4DAAO;AAClB;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C,mBAAmB,4BAA4B;AAC/C,qBAAqB,8BAA8B;AACnD,uBAAuB,gCAAgC;AACvD,0BAA0B,mCAAmC;AAC7D,qBAAqB,8BAA8B;AACnD;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,WAAW,4DAAO;AAClB;AACA,QAAQ,yBAAyB,qDAAM,EAAE;AACzC,QAAQ,yBAAyB,qDAAM,EAAE;AACzC,QAAQ,iBAAiB,mDAAI,EAAE;AAC/B,QAAQ,uBAAuB,uDAAQ,EAAE;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,gEAAW;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB,aAAa,SAAS;AACtB,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,MAAM,KAAK,MAAM,SAAS,MAAM;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,mCAAmC;AAChD,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe,UAAU;AACzB,oFAAoF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA,cAAc,gEAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,wDAAS;AAC3B,OAAO;;AAEP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,8BAA8B;AAC1C;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B,YAAY,mDAAI;AAChB;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,qBAAqB;AACjC;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,mBAAmB;AAC/B,oBAAoB,qDAAM;AAC1B;AACA;AACA;AACA,YAAY,mBAAmB;AAC/B,oBAAoB,qDAAM;AAC1B,CAAC;;AAED;;AAEA,iEAAe,OAAO,EAAC","sources":["webpack://jclic/./src/boxes/BoxBase.js"],"sourcesContent":["/**\n * File : boxes/BoxBase.js\n * Created : 12/04/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport $ from 'jquery';\nimport { settings, attrForEach, getBoolean, checkColor, getAttr, setAttr, cloneObject, isSeparator } from '../Utils.js';\nimport { Stroke, Gradient, Font, Dimension } from '../AWT.js';\n\nconst defaultValues = settings.BoxBase;\n\n/**\n * This class contains all the main visual attributes needed to draw {@link module:boxes/AbstractBox.AbstractBox AbstractBox} objects:\n * background and foreground colors, gradients, colors for special states (inactive, alternative,\n * disabled...), margins, fonts, border strokes, etc.\n *\n * Objects derived from {@link module:boxes/AbstractBox.AbstractBox AbstractBox} can have inheritance: boxes that act as \"containers\"\n * of other boxes (like {@link module:boxes/BoxBag.BoxBag BoxBag}). Most of the attributes of `BoxBase` can be `null`,\n * meaning that the value of the ancestor -or the default value if the box has no ancestors- must\n * be used.\n */\nexport class BoxBase {\n /**\n * BoxBase constructor\n * @param {module:boxes/BoxBase.BoxBase} [parent] - Another BoxBase object used to determine the value of properties not\n * locally set.\n */\n constructor(parent) {\n this.parent = parent || null;\n }\n\n /**\n * Loads the BoxBase settings from a specific JQuery XML element\n * @param {external:jQuery} $xml - The XML element to parse\n */\n setProperties($xml) {\n //\n // Read attributes\n attrForEach($xml.get(0).attributes, (name, val) => {\n switch (name) {\n case 'shadow':\n case 'transparent':\n this[name] = getBoolean(val, false);\n break;\n case 'margin':\n this[name] = Number(val);\n break;\n case 'borderStroke':\n this.borderStroke = new Stroke(Number(val));\n break;\n case 'markerStroke':\n this.markerStroke = new Stroke(Number(val));\n break;\n }\n });\n //\n // Read inner elements\n $xml.children().each((_n, child) => {\n const $node = $(child);\n switch (child.nodeName) {\n case 'font':\n this.font = (new Font()).setProperties($node);\n break;\n\n case 'gradient':\n this.bgGradient = new Gradient().setProperties($node);\n break;\n\n case 'color':\n this.textColor = checkColor($node.attr('foreground'), this.textColor);\n this.backColor = checkColor($node.attr('background'), this.backColor);\n this.shadowColor = checkColor($node.attr('shadow'), this.shadowColor);\n this.inactiveColor = checkColor($node.attr('inactive'), this.inactiveColor);\n this.alternativeColor = checkColor($node.attr('alternative'), this.alternativeColor);\n this.borderColor = checkColor($node.attr('border'), this.borderColor);\n break;\n }\n });\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n return getAttr(this, [\n 'shadow', 'transparent', 'margin',\n 'borderStroke', 'markerStroke', // AWT.Stroke\n 'font', // AWT.Font\n 'bgGradient', // AWT.Gradient\n `textColor|${BoxBase.prototype.textColor}`,\n `backColor|${BoxBase.prototype.backColor}`,\n `shadowColor|${BoxBase.prototype.shadowColor}`,\n `inactiveColor|${BoxBase.prototype.inactiveColor}`,\n `alternativeColor|${BoxBase.prototype.alternativeColor}`,\n `borderColor|${BoxBase.prototype.borderColor}`,\n ]);\n }\n\n /**\n * Reads the properties of this BoxBase from a data object\n * @param {object} data - The data object to be parsed\n * @returns {module:boxes/BoxBase.BoxBase}\n */\n setAttributes(data) {\n return setAttr(this, data, [\n 'shadow', 'transparent', 'margin',\n { key: 'borderStroke', fn: Stroke },\n { key: 'markerStroke', fn: Stroke },\n { key: 'font', fn: Font },\n { key: 'bgGradient', fn: Gradient },\n 'textColor',\n 'backColor',\n 'shadowColor',\n 'inactiveColor',\n 'alternativeColor',\n 'borderColor',\n ]);\n }\n\n /**\n * Gets the value of the specified property, scanning down to parents and prototype if not defined.\n * @param {string} property - The property to retrieve\n * @returns {any} - The object or value associated to this property\n */\n get(property) {\n if (this.hasOwnProperty(property) || this.parent === null)\n return this[property];\n else\n return this.parent.get(property);\n }\n\n /**\n * Sets the value of a specific property.\n * @param {string} property - The property name.\n * @param {any} value - Depends on the type of property\n */\n set(property, value) {\n this[property] = value;\n return this;\n }\n\n /**\n * Gets the value of the specified property, scanning down to parents if not defined, and returning\n * always an own property (not from prototype)\n * @param {string} property - The property to retrieve\n * @returns {any} - The object or value associated to this property\n */\n getOwn(property) {\n if (this.hasOwnProperty(property))\n return this[property];\n else if (this.parent !== null)\n return this.parent.getOwn(property);\n else {\n if (typeof this[property] === 'object')\n this[property] = cloneObject(BoxBase.prototype[property]);\n else\n this[property] = BoxBase.prototype[property];\n }\n return this[property];\n }\n\n /**\n * Gets the properties defined in this BoxBase as a collection of CSS attributes\n * @param {object} [css] - An optional set of initial CSS properties\n * @param {boolean} [inactive=false] - When `true`, get CSS attributes for an inactive cell\n * @param {boolean} [inverse=false] - When `true`, get CSS attributes for an inverse cell\n * @param {boolean} [alternative=false] - When `true`, get CSS attributes for an alternative cell\n * @returns {object}\n */\n getCSS(css, inactive = false, inverse = false, alternative = false) {\n // (css will be created by [AWT.Font.toCss](AWT.html) if null or undefined)\n const font = this.get('font');\n css = font.toCss(css);\n\n css['color'] = inverse ? this.get('backColor')\n : alternative ? this.get('alternativeColor')\n : this.get('textColor');\n\n const transparent = this.get('transparent');\n css['background-color'] = transparent ? 'transparent'\n : inactive ? this.get('inactiveColor')\n : inverse ? this.get('textColor') : this.get('backColor');\n\n const bgGradient = this.get('bgGradient');\n if (bgGradient && !transparent)\n css['background-image'] = bgGradient.getCss();\n\n if (this.shadow === 1) {\n const delta = Math.max(1, Math.round(font.size / 10));\n const color = this.get('shadowColor');\n css['text-shadow'] = `${delta}px ${delta}px 3px ${color}`;\n }\n return css;\n }\n\n /**\n * This utility method computes the width and height of text lines rendered on an HTML\n * __canvas__ element, reducing the font size of the BoxBase as needed when they exceed the maximum\n * width and/or height.\n * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the text.\n * @param {string} text - The text to drawn.\n * @param {number} maxWidth - Maximum width\n * @param {number} maxHeight - Maximum height\n * @returns {object[]} - An array of objects representing lines of text. Each object has a `text`\n * member with the text displayed in the line, and a `size` member with the line {@link module:AWT.Dimension}\n */\n prepareText(ctx, text, maxWidth, maxHeight) {\n const\n result = [],\n font = this.get('font'),\n height = font.getHeight();\n let totalHeight = 0;\n\n // divide the text in lines\n const lines = text.trim().split('\\n');\n ctx.font = font.cssFont();\n for (let l = 0; l < lines.length; l++) {\n let line = lines[l].trim();\n let width = ctx.measureText(line).width;\n if (width > maxWidth) {\n // retain the last string offset that was inside maxWidth\n let\n lastOK = 0,\n lastOKWidth = 0;\n for (let p = 0; p < line.length; p++) {\n // Find next separator\n if (isSeparator(line[p])) {\n const w = ctx.measureText(line.substring(0, p).trim()).width;\n if (w > maxWidth)\n break;\n lastOK = p;\n lastOKWidth = w;\n }\n }\n if (lastOK > 0) {\n // Add a new line with the tail of the line\n lines.splice(l + 1, 0, line.substring(lastOK + 1).trim());\n // Adjust the current line\n line = lines[l] = line.substring(0, lastOK).trim();\n width = lastOKWidth;\n }\n else {\n // No solution found. Try resizing down the font.\n if (font.size > defaultValues.MIN_FONT_SIZE) {\n this.getOwn('font').zoom(-1);\n return this.prepareText(ctx, text, maxWidth, maxHeight);\n }\n }\n }\n\n // Add the line and the calculated dimension to `result`\n result.push({\n text: line,\n size: new Dimension(width, height)\n });\n\n totalHeight += height;\n\n if (totalHeight > maxHeight && font.size > defaultValues.MIN_FONT_SIZE) {\n // Max height exceeded. Try resizing down the font\n this.getOwn('font').zoom(-1);\n return this.prepareText(ctx, text, maxWidth, maxHeight);\n }\n }\n return result;\n }\n}\n\nObject.assign(BoxBase.prototype, {\n /**\n * The parent BoxBase object\n * @name module:boxes/BoxBase.BoxBase#parent\n * @type {module:boxes/BoxBase.BoxBase} */\n parent: null,\n /**\n * Default values\n * @name module:boxes/BoxBase.BoxBase#defaultValues\n * @type {object} */\n default: defaultValues,\n /**\n * Font size can be dynamically reduced to fit the available space if any element using this\n * `BoxBase` requests it. When this happen, this field contains the real font currently used\n * to draw text.\n * @name module:boxes/BoxBase.BoxBase#font\n * @type {module:AWT.Font} */\n font: new Font(),\n /**\n * The current font size of this BoxBase. Can be dynamically adjusted when drawing.\n * @name module:boxes/BoxBase.BoxBase#dynFontSize\n * @type {number} */\n dynFontSize: 0,\n /**\n * Counts the number of times the `dynFontSize` has been reset. This is useful to avoid excessive\n * recursive loops searching the optimal font size.\n * @name module:boxes/BoxBase.BoxBase#resetFontCounter\n * @type {number} */\n resetFontCounter: 0,\n /**\n * The background color\n * @name module:boxes/BoxBase.BoxBase#backColor\n * @type {string} */\n backColor: defaultValues.BACK_COLOR,\n /**\n * The background gradient. Default is `null`.\n * @name module:boxes/BoxBase.BoxBase#bgGradient\n * @type {module:AWT.Gradient} */\n bgGradient: null,\n /**\n * The color used to write text.\n * @name module:boxes/BoxBase.BoxBase#textColor\n * @type {string} */\n textColor: defaultValues.TEXT_COLOR,\n /**\n * The color used to draw a shadow below regular text.\n * @name module:boxes/BoxBase.BoxBase#shadowColor\n * @type {string} */\n shadowColor: defaultValues.SHADOW_COLOR,\n /**\n * The color of the border.\n * @name module:boxes/BoxBase.BoxBase#borderColor\n * @type {string} */\n borderColor: defaultValues.BORDER_COLOR,\n /**\n * The color used to draw text when a cell is in `inactive` state.\n * @name module:boxes/BoxBase.BoxBase#inactiveColor\n * @type {string} */\n inactiveColor: defaultValues.INACTIVE_COLOR,\n /**\n * The color used to draw text when a cell is in `alternative` state.\n * @name module:boxes/BoxBase.BoxBase#alternativeColor\n * @type {string} */\n alternativeColor: defaultValues.ALTERNATIVE_COLOR,\n /**\n * Whether the text should have a shadow or not\n * @name module:boxes/BoxBase.BoxBase#shadow\n * @type {boolean} */\n shadow: false,\n /**\n * Whether the cell's background (and its hosted component, if any) should be transparent\n * @name module:boxes/BoxBase.BoxBase#transparent\n * @type {boolean} */\n transparent: false,\n /**\n * Wheter the cell's background should be painted or not. This property has no effect on\n * hosted components.\n * @name module:boxes/BoxBase.BoxBase#dontFill\n * @type {boolean} */\n dontFill: false,\n /**\n * The margin to respect between text elements and the limits of the cell or other elements.\n * @name module:boxes/BoxBase.BoxBase#textMargin\n * @type {number} */\n textMargin: defaultValues.AC_MARGIN,\n /**\n * The stroke used to draw the border.\n * @name module:boxes/BoxBase.BoxBase#borderStroke\n * @type {module:AWT.Stroke} */\n borderStroke: new Stroke(defaultValues.BORDER_STROKE_WIDTH),\n /**\n * The stroke used to draw a border around marked cells.\n * @name module:boxes/BoxBase.BoxBase#markerStroke\n * @type {module:AWT.Stroke} */\n markerStroke: new Stroke(defaultValues.MARKER_STROKE_WIDTH),\n});\n\nBoxBase.DEFAULT_BOX_BASE = new BoxBase();\n\nexport default BoxBase;\n"],"names":[],"sourceRoot":""}