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,498 +0,0 @@
1
- "use strict";
2
- exports.id = 8322;
3
- exports.ids = [8322,8276];
4
- exports.modules = {
5
-
6
- /***/ 8322:
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 Holes */
13
- /* harmony import */ var _Shaper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8276);
14
- /**
15
- * File : shapers/Holes.js
16
- * Created : 20/05/2015
17
- * By : Francesc Busquets <francesc@gmail.com>
18
- *
19
- * JClic.js
20
- * An HTML5 player of JClic activities
21
- * https://projectestac.github.io/jclic.js
22
- *
23
- * @source https://github.com/projectestac/jclic.js
24
- *
25
- * @license EUPL-1.2
26
- * @licstart
27
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
28
- *
29
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
30
- * the European Commission- subsequent versions of the EUPL (the "Licence");
31
- * You may not use this work except in compliance with the Licence.
32
- *
33
- * You may obtain a copy of the Licence at:
34
- * https://joinup.ec.europa.eu/software/page/eupl
35
- *
36
- * Unless required by applicable law or agreed to in writing, software
37
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
38
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
39
- * Licence for the specific language governing permissions and limitations
40
- * under the Licence.
41
- * @licend
42
- * @module
43
- */
44
-
45
-
46
-
47
- /**
48
- * This {@link module:shapers/Shaper.Shaper Shaper} consists of a set of arbitrary shapes placed over a main rectangle that
49
- * acts as a enclosure.
50
- * The components can be of type {@link module:AWT.Rectangle}, {@link module:AWT.Ellipse} or {@link module:AWT.Path}.
51
- * This components have internal dimension values relative to the horizontal and vertical
52
- * sizes of the enclosure. Its values (always between 0 and 1) must be scaled to real sizes
53
- * of graphic objects.
54
- * @extends module:shapers/Shaper.Shaper
55
- */
56
- class Holes extends _Shaper_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
57
- /**
58
- * Holes constructor
59
- * @param {number} nx - Not used
60
- * @param {number} ny - Not used
61
- */
62
- constructor(nx, ny) {
63
- super(1, 1);
64
- this.customShapes = true;
65
- this.nCols = nx;
66
- this.nRows = ny;
67
- this.showEnclosure = true;
68
- }
69
-
70
- /**
71
- * Shapes are already loaded by {@link module:shapers/Shaper.Shaper Shaper}, so this function just sets `initiated` to `true`
72
- * @override
73
- */
74
- buildShapes() {
75
- if (this.nCells > 0)
76
- this.initiated = true;
77
- }
78
-
79
- /**
80
- * Gets the rectangle that contains all shapes
81
- * @override
82
- * @returns {module:AWT.Rectangle}
83
- */
84
- getEnclosingShapeData() {
85
- return this.showEnclosure ? (this.enclosing || super.getEnclosingShapeData()) : null;
86
- }
87
- }
88
-
89
- // Register this class in the list of known shapers
90
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Shaper_js__WEBPACK_IMPORTED_MODULE_0__["default"].registerClass('@Holes', Holes));
91
-
92
-
93
- /***/ }),
94
-
95
- /***/ 8276:
96
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
97
-
98
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
99
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
100
- /* harmony export */ });
101
- /* unused harmony export Shaper */
102
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
103
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
104
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1253);
105
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7912);
106
- /**
107
- * File : shapers/Shaper.js
108
- * Created : 13/04/2015
109
- * By : Francesc Busquets <francesc@gmail.com>
110
- *
111
- * JClic.js
112
- * An HTML5 player of JClic activities
113
- * https://projectestac.github.io/jclic.js
114
- *
115
- * @source https://github.com/projectestac/jclic.js
116
- *
117
- * @license EUPL-1.2
118
- * @licstart
119
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
120
- *
121
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
122
- * the European Commission- subsequent versions of the EUPL (the "Licence");
123
- * You may not use this work except in compliance with the Licence.
124
- *
125
- * You may obtain a copy of the Licence at:
126
- * https://joinup.ec.europa.eu/software/page/eupl
127
- *
128
- * Unless required by applicable law or agreed to in writing, software
129
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
130
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
131
- * Licence for the specific language governing permissions and limitations
132
- * under the Licence.
133
- * @licend
134
- * @module
135
- */
136
-
137
-
138
-
139
-
140
-
141
- /**
142
- * The function of this class and its subclasses is to draw a set of "shapes" that will be used to
143
- * place {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects at a specific position, and to determine its dimension and
144
- * appearance.
145
- */
146
- class Shaper {
147
- /**
148
- * Shaper constructor
149
- * @param {number} nx - Number of columns (in grid-based shapers)
150
- * @param {number} ny - Number of rows (in grid-based shapers)
151
- */
152
- constructor(nx, ny) {
153
- this.reset(nx, ny);
154
- }
155
-
156
- /**
157
- * Registers a new type of shaper
158
- * @param {string} shaperName - The name used to identify this shaper
159
- * @param {function} shaperClass - The shaper class, usually extending Shaper
160
- * @returns {module:shapers/Shaper.Shaper} - The provided shaper class
161
- */
162
- static registerClass(shaperName, shaperClass) {
163
- Shaper.CLASSES[shaperName] = shaperClass;
164
- return shaperClass;
165
- }
166
-
167
- /**
168
- * Factory constructor that returns a Shaper of the requested class.
169
- * @param {string} className - The class name of the requested Shaper.
170
- * @param {number} nx - Number of columns (in grid-based shapers)
171
- * @param {number} ny - Number of rows (in grid-based shapers)
172
- * @returns {module:shapers/Shaper.Shaper}
173
- */
174
- static getShaper(className, nx, ny) {
175
- const cl = Shaper.CLASSES[(className || '').replace(/^edu\.xtec\.jclic\.shapers\./, '@')];
176
- if (!cl)
177
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .log */ .Rm)('error', `Unknown shaper: ${className}`);
178
- return cl ? new cl(nx, ny) : null;
179
- }
180
-
181
- /**
182
- * Initializes this Shaper to default values
183
- * @param {number} nCols - Number of columns
184
- * @param {number} nRows - Number of rows
185
- */
186
- reset(nCols, nRows) {
187
- this.nCols = nCols;
188
- this.nRows = nRows;
189
- this.nCells = nRows * nCols;
190
- this.initiated = false;
191
- this.shapeData = [];
192
- for (let i = 0; i < this.nCells; i++)
193
- this.shapeData[i] = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Shape */ .yp();
194
- }
195
-
196
- /**
197
- * Loads this shaper settings from a specific JQuery XML element
198
- * @param {external:jQuery} $xml - The XML element with the shaper data
199
- */
200
- setProperties($xml) {
201
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .attrForEach */ .GM)($xml.get(0).attributes, (name, value) => {
202
- switch (name) {
203
- case 'class':
204
- this.className = value;
205
- break;
206
- case 'cols':
207
- this.nCols = Number(value);
208
- break;
209
- case 'rows':
210
- this.nRows = Number(value);
211
- break;
212
- case 'baseWidthFactor':
213
- case 'toothHeightFactor':
214
- case 'scaleX':
215
- case 'scaleY':
216
- this[name] = Number(value);
217
- break;
218
- case 'randomLines':
219
- case 'showEnclosure':
220
- this[name] = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getBoolean */ .pW)(value, true);
221
- break;
222
- }
223
- });
224
-
225
- // Reads the 'enclosing'
226
- // (main shape area where the other shape elements are placed)
227
- $xml.children('enclosing:first').each((_n, child) => {
228
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(child).children('shape:first').each((_n, child2) => {
229
- let sh = Shaper.readShapeData(child2, this.scaleX, this.scaleY);
230
- this.enclosing = sh;
231
- this.showEnclosure = true;
232
- this.hasRemainder = true;
233
- });
234
- });
235
-
236
- // Read the shape elements
237
- $xml.children('shape').each((n, child) => {
238
- this.shapeData[n] = Shaper.readShapeData(child, this.scaleX, this.scaleY);
239
- });
240
-
241
- // Correction needed for '@Holes' shaper
242
- if (this.shapeData.length > 0 /* && this.shapeData.length !== this.nRows * this.nCols */) {
243
- //this.nRows = this.shapeData.length
244
- //this.nCols = 1
245
- //this.nCells = this.nCols * this.nRows
246
- this.nCells = this.shapeData.length;
247
- }
248
- return this;
249
- }
250
-
251
- /**
252
- * Reads an individual shape from an XML element.
253
- * Shapes are arrays of `stroke` objects.
254
- * Each `stroke` has an `action` (_move to_, _line to_, _quad to_...) and associated `data`.
255
- * @param {external:jQuery} $xml - The XML element with the shape data
256
- * @param {number} scaleX
257
- * @param {number} scaleY
258
- * @returns {module:AWT.Shape}
259
- */
260
- static readShapeData(xml, scaleX, scaleY) {
261
- const shd = [];
262
- let result = null;
263
- jquery__WEBPACK_IMPORTED_MODULE_0___default().each(xml.textContent.split('|'), (_n, txt) => {
264
- const sd = txt.split(':');
265
- // Possible strokes are: `rectangle`, `ellipse`, `M`, `L`, `Q`, `B`, `X`
266
- // Also possible, but not currently used in JClic: `roundRectangle` and `pie`
267
- let data = sd.length > 1 ? sd[1].split(',') : null;
268
- //
269
- // Data should be always divided by the scale (X or Y)
270
- if (data)
271
- data = data.map((d, n) => d / (n % 2 ? scaleY : scaleX));
272
-
273
- switch (sd[0]) {
274
- case 'rectangle':
275
- result = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_(data[0], data[1], data[2], data[3]);
276
- break;
277
- case 'ellipse':
278
- result = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Ellipse */ .Pp(data[0], data[1], data[2], data[3]);
279
- break;
280
- default:
281
- // It's an `AWT.PathStroke`
282
- shd.push(new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .PathStroke */ .kg(sd[0], data));
283
- break;
284
- }
285
- });
286
-
287
- return !result && shd.length > 0 ? new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Path */ .wA(shd) : result;
288
- }
289
-
290
- /**
291
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
292
- * parent references, constants and also attributes retaining the default value.
293
- * The resulting object is commonly usued to serialize elements in JSON format.
294
- * @returns {object} - The resulting object, with minimal attrributes
295
- */
296
- getAttributes() {
297
- const fields = [
298
- 'className', 'nCols', 'nRows',
299
- 'baseWidthFactor', 'toothHeightFactor',
300
- 'scaleX', 'scaleY',
301
- 'randomLines',
302
- ];
303
-
304
- if (this.customShapes) {
305
- ['showEnclosure', 'hasRemainder',
306
- 'enclosing', 'shapeData', // Array of AWT.Rectangle, AWT.Ellipse or (AWT.Path -> AWT.PathStroke)
307
- ].forEach(f => fields.push(f));
308
- }
309
-
310
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getAttr */ .iu)(this, fields);
311
- }
312
-
313
- /**
314
- * Builds a new shaper, based on the properties specified in a data object
315
- * @param {object} data - The data object to be parsed
316
- * @returns {module:shapers/Shaper.Shaper}
317
- */
318
- static factory(data) {
319
- const result = Shaper.getShaper(data.className, data.nCols, data.nRows);
320
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .setAttr */ .ob)(result, data, [
321
- 'className', 'nCols', 'nRows',
322
- 'baseWidthFactor', 'toothHeightFactor',
323
- 'scaleX', 'scaleY',
324
- 'randomLines',
325
- 'showEnclosure', 'hasRemainder',
326
- { key: 'enclosing', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Shape */ .yp },
327
- { key: 'shapeData', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Shape */ .yp, group: 'array' },
328
- ]);
329
-
330
- result.nCells = result.shapeData.length || result.nCols * result.nRows;
331
-
332
- return result;
333
- }
334
-
335
- /**
336
- * Builds the individual shapes that will form this Shaper
337
- */
338
- buildShapes() {
339
- }
340
-
341
- /**
342
- * Gets a clone of the nth Shape object, scaled and located inside a Rectangle
343
- * @param {number} n
344
- * @param {module:AWT.Rectangle} rect
345
- * @returns {module:AWT.Shape}
346
- */
347
- getShape(n, rect) {
348
- if (!this.initiated)
349
- this.buildShapes();
350
- if (n >= this.nCells || this.shapeData[n] === null)
351
- return null;
352
- return this.shapeData[n].getShape(rect);
353
- }
354
-
355
- /**
356
- * Gets the nth Shape data object
357
- * @param {number} n
358
- * @returns {object}
359
- */
360
- getShapeData(n) {
361
- return n >= 0 && n < this.shapeData.length ? this.shapeData[n] : null;
362
- }
363
-
364
- /**
365
- * Gets the AWT.Rectangle that contains all shapes of this Shaper.
366
- * @returns {module:AWT.Rectangle}
367
- */
368
- getEnclosingShapeData() {
369
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_(0, 0, 1, 1);
370
- }
371
-
372
- /**
373
- * When `hasRemainder` is true, this method gets the rectangle containing the full surface where
374
- * the Shaper develops.
375
- * @param {module:AWT.Rectangle} rect - The frame where to move and scale all the shapes
376
- * @returns {module:AWT.Rectangle}
377
- */
378
- getRemainderShape(rect) {
379
- if (!this.hasRemainder)
380
- return null;
381
-
382
- if (!this.initiated)
383
- this.buildShapes();
384
-
385
- const sh = this.getEnclosingShapeData();
386
- const r = sh ? sh.getShape(rect) : new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_();
387
- for (let i = 0; i < this.nCells; i++) {
388
- if (this.shapeData[i])
389
- r.add(this.shapeData[i].getShape(rect), false);
390
- }
391
- return r;
392
- }
393
- }
394
-
395
- Object.assign(Shaper.prototype, {
396
- /**
397
- * This shaper class name
398
- * @name module:shapers/Shaper.Shaper#className
399
- * @type {string} */
400
- className: 'Shaper',
401
- /**
402
- * Number of columns (useful in grid-based shapers)
403
- * @name module:shapers/Shaper.Shaper#nCols
404
- * @type {number} */
405
- nCols: 0,
406
- /**
407
- * Number of rows (useful in grid-based shapers)
408
- * @name module:shapers/Shaper.Shaper#nRows
409
- * @type {number} */
410
- nRows: 0,
411
- /**
412
- * Number of cells managed by this shaper
413
- * @name module:shapers/Shaper.Shaper#nCells
414
- * @type {number} */
415
- nCells: 0,
416
- /**
417
- * Contains the specific definition of each shape
418
- * @name module:shapers/Shaper.Shaper#shapeData
419
- * @type {object} */
420
- shapeData: null,
421
- /**
422
- * Flag used to check if the `Shaper` has been initialized against a real surface
423
- * @name module:shapers/Shaper.Shaper#initiated
424
- * @type {boolean} */
425
- initiated: false,
426
- //
427
- // Fields used only in JigSaw shapers
428
- /**
429
- * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the base width of the tooth and the total length of the side.
430
- * @name module:shapers/Shaper.Shaper#baseWidthFactor
431
- * @type {number} */
432
- baseWidthFactor: 1.0 / 3,
433
- /**
434
- * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the tooth height and the total length of the side.
435
- * @name module:shapers/Shaper.Shaper#toothHeightFactor
436
- * @type {number} */
437
- toothHeightFactor: 1.0 / 6,
438
- /**
439
- * In {@link module:shapers/JigSaw.JigSaw JigSaw}, whether the tooths take random directions or not
440
- * @name module:shapers/Shaper.Shaper#randomLines
441
- * @type {boolean} */
442
- randomLines: false,
443
- //
444
- // Fields used only in the `Holes` shaper
445
- /**
446
- * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to horizontal positions and lengths to achieve the real
447
- * value of the shape placed on a real surface.
448
- * @name module:shapers/Shaper.Shaper#scaleX
449
- * @type {number} */
450
- scaleX: 1.0,
451
- /**
452
- * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to vertical positions and lengths to achieve the real
453
- * value of the shape placed on a real surface.
454
- * @name module:shapers/Shaper.Shaper#scaleY
455
- * @type {number} */
456
- scaleY: 1.0,
457
- /**
458
- * In {@link module:shapers/Holes.Holes Holes}, the enclosing area where all shapes are placed.
459
- * @name module:shapers/Shaper.Shaper#enclosing
460
- * @type {module:AWT.Shape} */
461
- enclosing: null,
462
- /**
463
- * In {@link module:shapers/Holes.Holes Holes}, when `true`, the enclosing area will be drawn
464
- * @name module:shapers/Shaper.Shaper#showEnclosure
465
- * @type {boolean} */
466
- showEnclosure: false,
467
- /**
468
- * Flag indicating if this shaper organizes its cells in rows and columns
469
- * @name module:shapers/Shaper.Shaper#rectangularShapes
470
- * @type {boolean} */
471
- rectangularShapes: false,
472
- /**
473
- * Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
474
- * all its shapes
475
- * @name module:shapers/Shaper.Shaper#hasRemainder
476
- * @type {boolean} */
477
- hasRemainder: false,
478
- /**
479
- * Only the `Holes` shaper has this flag activated
480
- * @name module:shapers/Shaper.Shaper#customShapes
481
- * @type {boolean} */
482
- customShapes: false,
483
- });
484
-
485
- /**
486
- * List of known classes derived from Shaper. It should be filled by real shaper classes at
487
- * declaration time.
488
- * @type {object} */
489
- Shaper.CLASSES = {};
490
-
491
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Shaper);
492
-
493
-
494
- /***/ })
495
-
496
- };
497
- ;
498
- //# sourceMappingURL=8322.jclic-node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"8322.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;;AAEiC;;AAEjC;AACA,SAAS,2CAA2C;AACpD;AACA,kCAAkC,2BAA2B,GAAG,0BAA0B,IAAI,sBAAsB;AACpH;AACA;AACA;AACA;AACA;AACO,oBAAoB,kDAAM;AACjC;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,0CAA0C;AAC7E;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA,iEAAe,kDAAM,+BAA+B,EAAC;;;;;;;;;;;;;;;;AC5ErD;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;AACsD;AACL;;AAExE;AACA;AACA,UAAU,kDAAkD;AAC5D;AACA;AACO;AACP;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,UAAU;AACvB,eAAe,8BAA8B;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA,MAAM,wDAAG,6BAA6B,UAAU;AAChD;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC,8BAA8B,oDAAK;AACnC;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA,IAAI,gEAAW;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+DAAU;AACjC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,MAAM,6CAAC;AACP;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,iBAAiB;AAC9B,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA,IAAI,kDAAM;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,wDAAS;AAChC;AACA;AACA,uBAAuB,sDAAO;AAC9B;AACA;AACA;AACA,uBAAuB,yDAAU;AACjC;AACA;AACA,KAAK;;AAEL,2CAA2C,mDAAI;AAC/C;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,WAAW,4DAAO;AAClB;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA,IAAI,4DAAO;AACX;AACA;AACA;AACA;AACA;AACA,QAAQ,sBAAsB,oDAAK,EAAE;AACrC,QAAQ,sBAAsB,oDAAK,kBAAkB;AACrD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,sBAAsB;AACnC,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2CAA2C,wDAAS;AACpD,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;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,SAAS,0CAA0C;AACnD;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,0CAA0C;AACnD;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,0CAA0C;AACnD;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,SAAS,uCAAuC;AAChD;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,uCAAuC;AAChD;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,uCAAuC;AAChD;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA,SAAS,uCAAuC;AAChD;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA,CAAC;;AAED;AACA;AACA;AACA,UAAU,QAAQ;AAClB;;AAEA,iEAAe,MAAM,EAAC","sources":["webpack://jclic/./src/shapers/Holes.js","webpack://jclic/./src/shapers/Shaper.js"],"sourcesContent":["/**\n * File : shapers/Holes.js\n * Created : 20/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 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 Shaper from './Shaper.js';\n\n/**\n * This {@link module:shapers/Shaper.Shaper Shaper} consists of a set of arbitrary shapes placed over a main rectangle that\n * acts as a enclosure.\n * The components can be of type {@link module:AWT.Rectangle}, {@link module:AWT.Ellipse} or {@link module:AWT.Path}.\n * This components have internal dimension values relative to the horizontal and vertical\n * sizes of the enclosure. Its values (always between 0 and 1) must be scaled to real sizes\n * of graphic objects.\n * @extends module:shapers/Shaper.Shaper\n */\nexport class Holes extends Shaper {\n /**\n * Holes constructor\n * @param {number} nx - Not used\n * @param {number} ny - Not used\n */\n constructor(nx, ny) {\n super(1, 1);\n this.customShapes = true;\n this.nCols = nx;\n this.nRows = ny;\n this.showEnclosure = true;\n }\n\n /**\n * Shapes are already loaded by {@link module:shapers/Shaper.Shaper Shaper}, so this function just sets `initiated` to `true`\n * @override\n */\n buildShapes() {\n if (this.nCells > 0)\n this.initiated = true;\n }\n\n /**\n * Gets the rectangle that contains all shapes\n * @override\n * @returns {module:AWT.Rectangle}\n */\n getEnclosingShapeData() {\n return this.showEnclosure ? (this.enclosing || super.getEnclosingShapeData()) : null;\n }\n}\n\n// Register this class in the list of known shapers\nexport default Shaper.registerClass('@Holes', Holes);\n","/**\n * File : shapers/Shaper.js\n * Created : 13/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 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 { log, attrForEach, getBoolean, getAttr, setAttr } from '../Utils.js';\nimport { Shape, Rectangle, Ellipse, PathStroke, Path } from '../AWT.js';\n\n/**\n * The function of this class and its subclasses is to draw a set of \"shapes\" that will be used to\n * place {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects at a specific position, and to determine its dimension and\n * appearance.\n */\nexport class Shaper {\n /**\n * Shaper constructor\n * @param {number} nx - Number of columns (in grid-based shapers)\n * @param {number} ny - Number of rows (in grid-based shapers)\n */\n constructor(nx, ny) {\n this.reset(nx, ny);\n }\n\n /**\n * Registers a new type of shaper\n * @param {string} shaperName - The name used to identify this shaper\n * @param {function} shaperClass - The shaper class, usually extending Shaper\n * @returns {module:shapers/Shaper.Shaper} - The provided shaper class\n */\n static registerClass(shaperName, shaperClass) {\n Shaper.CLASSES[shaperName] = shaperClass;\n return shaperClass;\n }\n\n /**\n * Factory constructor that returns a Shaper of the requested class.\n * @param {string} className - The class name of the requested Shaper.\n * @param {number} nx - Number of columns (in grid-based shapers)\n * @param {number} ny - Number of rows (in grid-based shapers)\n * @returns {module:shapers/Shaper.Shaper}\n */\n static getShaper(className, nx, ny) {\n const cl = Shaper.CLASSES[(className || '').replace(/^edu\\.xtec\\.jclic\\.shapers\\./, '@')];\n if (!cl)\n log('error', `Unknown shaper: ${className}`);\n return cl ? new cl(nx, ny) : null;\n }\n\n /**\n * Initializes this Shaper to default values\n * @param {number} nCols - Number of columns\n * @param {number} nRows - Number of rows\n */\n reset(nCols, nRows) {\n this.nCols = nCols;\n this.nRows = nRows;\n this.nCells = nRows * nCols;\n this.initiated = false;\n this.shapeData = [];\n for (let i = 0; i < this.nCells; i++)\n this.shapeData[i] = new Shape();\n }\n\n /**\n * Loads this shaper settings from a specific JQuery XML element\n * @param {external:jQuery} $xml - The XML element with the shaper data\n */\n setProperties($xml) {\n attrForEach($xml.get(0).attributes, (name, value) => {\n switch (name) {\n case 'class':\n this.className = value;\n break;\n case 'cols':\n this.nCols = Number(value);\n break;\n case 'rows':\n this.nRows = Number(value);\n break;\n case 'baseWidthFactor':\n case 'toothHeightFactor':\n case 'scaleX':\n case 'scaleY':\n this[name] = Number(value);\n break;\n case 'randomLines':\n case 'showEnclosure':\n this[name] = getBoolean(value, true);\n break;\n }\n });\n\n // Reads the 'enclosing'\n // (main shape area where the other shape elements are placed)\n $xml.children('enclosing:first').each((_n, child) => {\n $(child).children('shape:first').each((_n, child2) => {\n let sh = Shaper.readShapeData(child2, this.scaleX, this.scaleY);\n this.enclosing = sh;\n this.showEnclosure = true;\n this.hasRemainder = true;\n });\n });\n\n // Read the shape elements\n $xml.children('shape').each((n, child) => {\n this.shapeData[n] = Shaper.readShapeData(child, this.scaleX, this.scaleY);\n });\n\n // Correction needed for '@Holes' shaper\n if (this.shapeData.length > 0 /* && this.shapeData.length !== this.nRows * this.nCols */) {\n //this.nRows = this.shapeData.length\n //this.nCols = 1\n //this.nCells = this.nCols * this.nRows\n this.nCells = this.shapeData.length;\n }\n return this;\n }\n\n /**\n * Reads an individual shape from an XML element.\n * Shapes are arrays of `stroke` objects.\n * Each `stroke` has an `action` (_move to_, _line to_, _quad to_...) and associated `data`.\n * @param {external:jQuery} $xml - The XML element with the shape data\n * @param {number} scaleX\n * @param {number} scaleY\n * @returns {module:AWT.Shape}\n */\n static readShapeData(xml, scaleX, scaleY) {\n const shd = [];\n let result = null;\n $.each(xml.textContent.split('|'), (_n, txt) => {\n const sd = txt.split(':');\n // Possible strokes are: `rectangle`, `ellipse`, `M`, `L`, `Q`, `B`, `X`\n // Also possible, but not currently used in JClic: `roundRectangle` and `pie`\n let data = sd.length > 1 ? sd[1].split(',') : null;\n //\n // Data should be always divided by the scale (X or Y)\n if (data)\n data = data.map((d, n) => d / (n % 2 ? scaleY : scaleX));\n\n switch (sd[0]) {\n case 'rectangle':\n result = new Rectangle(data[0], data[1], data[2], data[3]);\n break;\n case 'ellipse':\n result = new Ellipse(data[0], data[1], data[2], data[3]);\n break;\n default:\n // It's an `AWT.PathStroke`\n shd.push(new PathStroke(sd[0], data));\n break;\n }\n });\n\n return !result && shd.length > 0 ? new Path(shd) : result;\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 const fields = [\n 'className', 'nCols', 'nRows',\n 'baseWidthFactor', 'toothHeightFactor',\n 'scaleX', 'scaleY',\n 'randomLines',\n ];\n\n if (this.customShapes) {\n ['showEnclosure', 'hasRemainder',\n 'enclosing', 'shapeData', // Array of AWT.Rectangle, AWT.Ellipse or (AWT.Path -> AWT.PathStroke)\n ].forEach(f => fields.push(f));\n }\n\n return getAttr(this, fields);\n }\n\n /**\n * Builds a new shaper, based on the properties specified in a data object\n * @param {object} data - The data object to be parsed\n * @returns {module:shapers/Shaper.Shaper}\n */\n static factory(data) {\n const result = Shaper.getShaper(data.className, data.nCols, data.nRows);\n setAttr(result, data, [\n 'className', 'nCols', 'nRows',\n 'baseWidthFactor', 'toothHeightFactor',\n 'scaleX', 'scaleY',\n 'randomLines',\n 'showEnclosure', 'hasRemainder',\n { key: 'enclosing', fn: Shape },\n { key: 'shapeData', fn: Shape, group: 'array' },\n ]);\n\n result.nCells = result.shapeData.length || result.nCols * result.nRows;\n\n return result;\n }\n\n /**\n * Builds the individual shapes that will form this Shaper\n */\n buildShapes() {\n }\n\n /**\n * Gets a clone of the nth Shape object, scaled and located inside a Rectangle\n * @param {number} n\n * @param {module:AWT.Rectangle} rect\n * @returns {module:AWT.Shape}\n */\n getShape(n, rect) {\n if (!this.initiated)\n this.buildShapes();\n if (n >= this.nCells || this.shapeData[n] === null)\n return null;\n return this.shapeData[n].getShape(rect);\n }\n\n /**\n * Gets the nth Shape data object\n * @param {number} n\n * @returns {object}\n */\n getShapeData(n) {\n return n >= 0 && n < this.shapeData.length ? this.shapeData[n] : null;\n }\n\n /**\n * Gets the AWT.Rectangle that contains all shapes of this Shaper.\n * @returns {module:AWT.Rectangle}\n */\n getEnclosingShapeData() {\n return new Rectangle(0, 0, 1, 1);\n }\n\n /**\n * When `hasRemainder` is true, this method gets the rectangle containing the full surface where\n * the Shaper develops.\n * @param {module:AWT.Rectangle} rect - The frame where to move and scale all the shapes\n * @returns {module:AWT.Rectangle}\n */\n getRemainderShape(rect) {\n if (!this.hasRemainder)\n return null;\n\n if (!this.initiated)\n this.buildShapes();\n\n const sh = this.getEnclosingShapeData();\n const r = sh ? sh.getShape(rect) : new Rectangle();\n for (let i = 0; i < this.nCells; i++) {\n if (this.shapeData[i])\n r.add(this.shapeData[i].getShape(rect), false);\n }\n return r;\n }\n}\n\nObject.assign(Shaper.prototype, {\n /**\n * This shaper class name\n * @name module:shapers/Shaper.Shaper#className\n * @type {string} */\n className: 'Shaper',\n /**\n * Number of columns (useful in grid-based shapers)\n * @name module:shapers/Shaper.Shaper#nCols\n * @type {number} */\n nCols: 0,\n /**\n * Number of rows (useful in grid-based shapers)\n * @name module:shapers/Shaper.Shaper#nRows\n * @type {number} */\n nRows: 0,\n /**\n * Number of cells managed by this shaper\n * @name module:shapers/Shaper.Shaper#nCells\n * @type {number} */\n nCells: 0,\n /**\n * Contains the specific definition of each shape\n * @name module:shapers/Shaper.Shaper#shapeData\n * @type {object} */\n shapeData: null,\n /**\n * Flag used to check if the `Shaper` has been initialized against a real surface\n * @name module:shapers/Shaper.Shaper#initiated\n * @type {boolean} */\n initiated: false,\n //\n // Fields used only in JigSaw shapers\n /**\n * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the base width of the tooth and the total length of the side.\n * @name module:shapers/Shaper.Shaper#baseWidthFactor\n * @type {number} */\n baseWidthFactor: 1.0 / 3,\n /**\n * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the tooth height and the total length of the side.\n * @name module:shapers/Shaper.Shaper#toothHeightFactor\n * @type {number} */\n toothHeightFactor: 1.0 / 6,\n /**\n * In {@link module:shapers/JigSaw.JigSaw JigSaw}, whether the tooths take random directions or not\n * @name module:shapers/Shaper.Shaper#randomLines\n * @type {boolean} */\n randomLines: false,\n //\n // Fields used only in the `Holes` shaper\n /**\n * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to horizontal positions and lengths to achieve the real\n * value of the shape placed on a real surface.\n * @name module:shapers/Shaper.Shaper#scaleX\n * @type {number} */\n scaleX: 1.0,\n /**\n * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to vertical positions and lengths to achieve the real\n * value of the shape placed on a real surface.\n * @name module:shapers/Shaper.Shaper#scaleY\n * @type {number} */\n scaleY: 1.0,\n /**\n * In {@link module:shapers/Holes.Holes Holes}, the enclosing area where all shapes are placed.\n * @name module:shapers/Shaper.Shaper#enclosing\n * @type {module:AWT.Shape} */\n enclosing: null,\n /**\n * In {@link module:shapers/Holes.Holes Holes}, when `true`, the enclosing area will be drawn\n * @name module:shapers/Shaper.Shaper#showEnclosure\n * @type {boolean} */\n showEnclosure: false,\n /**\n * Flag indicating if this shaper organizes its cells in rows and columns\n * @name module:shapers/Shaper.Shaper#rectangularShapes\n * @type {boolean} */\n rectangularShapes: false,\n /**\n * Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing\n * all its shapes\n * @name module:shapers/Shaper.Shaper#hasRemainder\n * @type {boolean} */\n hasRemainder: false,\n /**\n * Only the `Holes` shaper has this flag activated\n * @name module:shapers/Shaper.Shaper#customShapes\n * @type {boolean} */\n customShapes: false,\n});\n\n/**\n * List of known classes derived from Shaper. It should be filled by real shaper classes at\n * declaration time.\n * @type {object} */\nShaper.CLASSES = {};\n\nexport default Shaper;\n"],"names":[],"sourceRoot":""}