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,671 +0,0 @@
1
- "use strict";
2
- exports.id = 3502;
3
- exports.ids = [3502,7781];
4
- exports.modules = {
5
-
6
- /***/ 3502:
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 exports HolePuzzle, HolePuzzlePanel */
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 _Activity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1567);
16
- /* harmony import */ var _boxes_ActiveBoxGrid_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7781);
17
- /* harmony import */ var _boxes_BoxBag_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9205);
18
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7912);
19
- /* harmony import */ var _shapers_Rectangular_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4921);
20
- /**
21
- * File : activities/puzzles/HolePuzzle.js
22
- * Created : 01/06/2015
23
- * By : Francesc Busquets <francesc@gmail.com>
24
- *
25
- * JClic.js
26
- * An HTML5 player of JClic activities
27
- * https://projectestac.github.io/jclic.js
28
- *
29
- * @source https://github.com/projectestac/jclic.js
30
- *
31
- * @license EUPL-1.2
32
- * @licstart
33
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
34
- *
35
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
36
- * the European Commission- subsequent versions of the EUPL (the "Licence");
37
- * You may not use this work except in compliance with the Licence.
38
- *
39
- * You may obtain a copy of the Licence at:
40
- * https://joinup.ec.europa.eu/software/page/eupl
41
- *
42
- * Unless required by applicable law or agreed to in writing, software
43
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
44
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
45
- * Licence for the specific language governing permissions and limitations
46
- * under the Licence.
47
- * @licend
48
- * @module
49
- */
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
- /**
59
- * This class of {@link module:Activity.Activity Activity} shows only one panel with shuffled {@link module:boxes/ActiveBox.ActiveBox ActiveBox} cells.
60
- *
61
- * One of the cells is out of the main panel, thus allowing its neighbors occupy their space.
62
- * Only immediate neighbors of the "hole" can move into it.
63
- *
64
- * When all cells are on place, the initially "expulsed" cell comes back home and the activity is done.
65
- * @extends module:Activity.Activity
66
- */
67
- class HolePuzzle extends _Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .Activity */ .I {
68
- /**
69
- * HolePuzzle constructor
70
- * @param {module:project/JClicProject.JClicProject} project - The {@link module:project/JClicProject.JClicProject JClicProject} to which this activity belongs
71
- */
72
- constructor(project) {
73
- super(project);
74
- }
75
-
76
- /**
77
- * Retrieves the minimum number of actions needed to solve this activity.
78
- * @override
79
- * @returns {number}
80
- */
81
- getMinNumActions() {
82
- return this.abc.primary.getNumCells();
83
- }
84
-
85
- /**
86
- * Whether or not the activity uses random to shuffle internal components
87
- * @override
88
- * @returns {boolean}
89
- */
90
- hasRandom() {
91
- return true;
92
- }
93
-
94
- /**
95
- * When `true`, the activity must always be shuffled
96
- * @override
97
- * @returns {boolean}
98
- */
99
- shuffleAlways() {
100
- return true;
101
- }
102
-
103
- /**
104
- * Whether the activity allows the user to request help
105
- * @override
106
- * @returns {boolean}
107
- */
108
- helpSolutionAllowed() {
109
- return true;
110
- }
111
- }
112
-
113
- /**
114
- * The {@link module:Activity.ActivityPanel ActivityPanel} where {@link module:activities/puzzles/HolePuzzle.HolePuzzle HolePuzzle} activities are played
115
- * @extends module:Activity.ActivityPanel
116
- */
117
- class HolePuzzlePanel extends _Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .ActivityPanel */ .S {
118
- /**
119
- * HolePuzzlePanel constructor
120
- * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs
121
- * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the
122
- * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.
123
- * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy
124
- */
125
- constructor(act, ps, $div) {
126
- super(act, ps, $div);
127
- }
128
-
129
- /**
130
- * Miscellaneous cleaning operations
131
- * @override
132
- */
133
- clear() {
134
- if (this.bg) {
135
- this.bg.end();
136
- this.bg = null;
137
- }
138
- if (this.parkBg) {
139
- this.parkBg.end();
140
- this.parkBg = null;
141
- }
142
- }
143
-
144
- /**
145
- * Prepares the visual components of the activity
146
- * @override
147
- */
148
- buildVisualComponents() {
149
- if (this.firstRun)
150
- super.buildVisualComponents();
151
- this.clear();
152
-
153
- const abc = this.act.abc['primary'];
154
- if (abc) {
155
- if (abc.image)
156
- abc.setImgContent(this.act.project.mediaBag, null, false);
157
-
158
- if (this.act.acp !== null)
159
- this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);
160
-
161
- this.bg = _boxes_ActiveBoxGrid_js__WEBPACK_IMPORTED_MODULE_2__["default"].createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
162
- this.bg.setContent(abc);
163
- this.bg.setVisible(true);
164
-
165
- this.hiddenBoxIndex = Math.floor(Math.random() * this.bg.getNumCells());
166
- this.hiddenBox = this.bg.getActiveBox(this.hiddenBoxIndex);
167
- this.hiddenBox.setVisible(false);
168
- this.parkBg = new _boxes_ActiveBoxGrid_js__WEBPACK_IMPORTED_MODULE_2__["default"](null, this, abc.style, this.act.margin, this.act.margin,
169
- this.hiddenBox.dim.width, this.hiddenBox.dim.height, new _shapers_Rectangular_js__WEBPACK_IMPORTED_MODULE_5__["default"](1, 1));
170
- this.parkBg.setContent(abc, null, this.hiddenBoxIndex, 0, 1);
171
- this.parkBg.setBorder(this.bg.hasBorder());
172
- this.parkBg.setVisible(true);
173
- }
174
- }
175
-
176
- /**
177
- * Basic initialization procedure
178
- * @override
179
- */
180
- initActivity() {
181
- super.initActivity();
182
- if (!this.firstRun)
183
- this.buildVisualComponents();
184
- else
185
- this.firstRun = false;
186
-
187
- if (this.bg) {
188
- //
189
- // This activity has an special shuffle method. Cells can move only to places near the 'hole'
190
- if (this.act.shuffles % 2 !== 1)
191
- this.act.shuffles++;
192
- for (var i = 0; i < this.act.shuffles; i++) {
193
- const pth = this.bg.getCoord(this.hiddenBox);
194
- const v = Math.floor(Math.random() * 2) === 0 ? 1 : -1;
195
-
196
- if (Math.floor(Math.random() * 2) === 0) {
197
- pth.x += v;
198
- if (pth.x < 0 || pth.x >= this.bg.nCols)
199
- pth.x -= 2 * v;
200
- } else {
201
- pth.y += v;
202
- if (pth.y < 0 || pth.y >= this.bg.nRows)
203
- pth.y -= 2 * v;
204
- }
205
- var dstBx = this.bg.getActiveBoxWithIdLoc(pth.y * this.bg.nCols + pth.x);
206
- if (dstBx !== null)
207
- this.hiddenBox.exchangeLocation(dstBx);
208
- }
209
- this.setAndPlayMsg('initial', 'start');
210
- this.invalidate().update();
211
- this.playing = true;
212
- }
213
- }
214
-
215
- /**
216
- * Updates the graphic content of this panel.
217
- * This method will be called from {@link module:AWT.Container#update} when needed.
218
- * @override
219
- * @param {module:AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
220
- * it's the whole panel.
221
- */
222
- updateContent(dirtyRegion) {
223
- super.updateContent(dirtyRegion);
224
- if (this.bg && this.parkBg && this.$canvas) {
225
- const
226
- canvas = this.$canvas.get(-1),
227
- ctx = canvas.getContext('2d');
228
- if (!dirtyRegion)
229
- dirtyRegion = new _AWT_js__WEBPACK_IMPORTED_MODULE_4__/* .Rectangle */ .M_(0, 0, canvas.width, canvas.height);
230
- ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
231
- this.bg.update(ctx, dirtyRegion);
232
- this.parkBg.update(ctx, dirtyRegion);
233
- }
234
- return this;
235
- }
236
-
237
- /**
238
- * Sets the real dimension of this panel.
239
- * @override
240
- * @param {module:AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
241
- * @returns {module:AWT.Dimension}
242
- */
243
- setDimension(preferredMaxSize) {
244
- return !this.bg || !this.parkBg || this.getBounds().equals(preferredMaxSize) ?
245
- preferredMaxSize :
246
- _boxes_BoxBag_js__WEBPACK_IMPORTED_MODULE_3__["default"].layoutDouble(preferredMaxSize, this.bg, this.parkBg, this.act.boxGridPos, this.act.margin);
247
- }
248
-
249
- /**
250
- * Sets the size and position of this activity panel
251
- * @override
252
- * @param {module:AWT.Rectangle} rect
253
- */
254
- setBounds(rect) {
255
- if (this.$canvas)
256
- this.$canvas.remove();
257
-
258
- super.setBounds(rect);
259
- if (this.bg && this.parkBg) {
260
- // Create the main canvas
261
- this.$canvas = jquery__WEBPACK_IMPORTED_MODULE_0___default()(`<canvas width="${rect.dim.width}" height="${rect.dim.height}"/>`).css({
262
- position: 'absolute',
263
- top: 0,
264
- left: 0
265
- });
266
- this.$div.append(this.$canvas);
267
-
268
- // Repaint all
269
- this.invalidate().update();
270
- }
271
- }
272
-
273
- /**
274
- * Builds the accessible components needed for this ActivityPanel
275
- * This method is called when all main elements are placed and visible, when the activity is ready
276
- * to start or when resized.
277
- * @override
278
- */
279
- buildAccessibleComponents() {
280
- if (this.$canvas && this.accessibleCanvas && this.bg) {
281
- super.buildAccessibleComponents();
282
- this.bg.buildAccessibleElements(this.$canvas, this.$div);
283
- }
284
- }
285
-
286
- /**
287
- * Main handler used to process mouse, touch, keyboard and edit events
288
- * @override
289
- * @param {external:Event} event - The HTML event to be processed
290
- * @returns {boolean} - When this event handler returns `false`, jQuery will stop its
291
- * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
292
- */
293
- processEvent(event) {
294
- if (this.playing) {
295
- const p = new _AWT_js__WEBPACK_IMPORTED_MODULE_4__/* .Point */ .bR(
296
- event.pageX - this.$div.offset().left,
297
- event.pageY - this.$div.offset().top);
298
- // Array to be filled with actions to be executed at the end of event processing
299
- const delayedActions = [];
300
-
301
- switch (event.type) {
302
- case 'click':
303
- this.ps.stopMedia(1);
304
- // Find the box behind the clicked point
305
- const bx = this.bg.findActiveBox(p);
306
- if (bx) {
307
- if (bx.isVisible()) {
308
- // Check if it's a valid move
309
- const pt = this.bg.getCoordDist(bx, this.hiddenBox);
310
- if (Math.abs(pt.x) + Math.abs(pt.y) === 1) {
311
- // Ok, the cell is adjacent to the hole. Complete the move.
312
- let m = bx.playMedia(this.ps, delayedActions);
313
- const
314
- src = `${bx.getDescription()} (${bx.idOrder})`,
315
- dest = `(${this.hiddenBox.idLoc})`;
316
- bx.exchangeLocation(this.hiddenBox);
317
- const ok = bx.idOrder === bx.idLoc;
318
- // Check results and notify action
319
- const cellsAtPlace = this.bg.countCellsAtEquivalentPlace(true);
320
- this.ps.reportNewAction(this.act, 'SELECT', src, dest, ok, cellsAtPlace);
321
- if (ok && cellsAtPlace === this.bg.getNumCells()) {
322
- // Activity completed!
323
- this.hiddenBox.setVisible(true);
324
- this.parkBg.setVisible(false);
325
- this.finishActivity(true);
326
- } else
327
- if (!m)
328
- this.playEvent('click');
329
- }
330
- this.update();
331
- } else {
332
- this.playEvent('actionError');
333
- }
334
- }
335
- break;
336
- }
337
- delayedActions.forEach(action => action());
338
- event.preventDefault();
339
- }
340
- }
341
- }
342
-
343
- Object.assign(HolePuzzlePanel.prototype, {
344
- /**
345
- * The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} object containing the information to be displayed in the panel.
346
- * @name module:activities/puzzles/HolePuzzle.HolePuzzlePanel#bg
347
- * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */
348
- bg: null,
349
- /**
350
- * An auxiliary box bag with only one box, used to store the "missing piece" of
351
- * the puzzle.
352
- * @name module:activities/puzzles/HolePuzzle.HolePuzzlePanel#parkBg
353
- * @type {module:boxes/ActiveBoxGrid.ActiveBoxGrid} */
354
- parkBg: null,
355
- /**
356
- * The hidden cell
357
- * @name module:activities/puzzles/HolePuzzle.HolePuzzlePanel#hiddenBox
358
- * @type {module:boxes/ActiveBox.ActiveBox} */
359
- hiddenBox: null,
360
- /**
361
- * Index of the hidden cell on the ActiveBagContent
362
- * @name module:activities/puzzles/HolePuzzle.HolePuzzlePanel#hiddenBoxIndex
363
- * @type {number} */
364
- hiddenBoxIndex: -1,
365
- /**
366
- * List of mouse, touch and keyboard events intercepted by this panel
367
- * @override
368
- * @name module:activities/puzzles/HolePuzzle.HolePuzzlePanel#events
369
- * @type {string[]} */
370
- events: ['click'],
371
- });
372
-
373
- /**
374
- * Panel class associated to this type of activity: {@link module:activities/puzzles/HolePuzzle.HolePuzzlePanel HolePuzzlePanel}
375
- * @type {class} */
376
- HolePuzzle.Panel = HolePuzzlePanel;
377
-
378
- // Register activity class
379
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .Activity */ .I.registerClass('@puzzles.HolePuzzle', HolePuzzle));
380
-
381
-
382
- /***/ }),
383
-
384
- /***/ 7781:
385
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
386
-
387
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
388
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
389
- /* harmony export */ });
390
- /* unused harmony export ActiveBoxGrid */
391
- /* harmony import */ var _ActiveBoxBag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(427);
392
- /* harmony import */ var _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1725);
393
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7912);
394
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1253);
395
- /**
396
- * File : boxes/ActiveBoxGrid.js
397
- * Created : 19/05/2015
398
- * By : Francesc Busquets <francesc@gmail.com>
399
- *
400
- * JClic.js
401
- * An HTML5 player of JClic activities
402
- * https://projectestac.github.io/jclic.js
403
- *
404
- * @source https://github.com/projectestac/jclic.js
405
- *
406
- * @license EUPL-1.2
407
- * @licstart
408
- * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
409
- *
410
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
411
- * the European Commission- subsequent versions of the EUPL (the "Licence");
412
- * You may not use this work except in compliance with the Licence.
413
- *
414
- * You may obtain a copy of the Licence at:
415
- * https://joinup.ec.europa.eu/software/page/eupl
416
- *
417
- * Unless required by applicable law or agreed to in writing, software
418
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
419
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
420
- * Licence for the specific language governing permissions and limitations
421
- * under the Licence.
422
- * @licend
423
- * @module
424
- */
425
-
426
-
427
-
428
-
429
-
430
-
431
- /**
432
- * This class extends {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} with constructors that take an argument of type
433
- * {@link module:shapers/Shaper.Shaper Shaper} used to build all its {@link module:boxes/ActiveBox.ActiveBox ActiveBox}components. It also maintains information
434
- * about the number of "rows" and "columns", useful to compute valid (integer) values when
435
- * resizing or moving its components.
436
- * @extends module:boxes/ActiveBoxBag.ActiveBoxBag
437
- */
438
- class ActiveBoxGrid extends _ActiveBoxBag_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
439
- /**
440
- * ActiveBxGrid constructor
441
- * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs
442
- * @param {module:AWT.Container} container - The container where this box grid is placed.
443
- * @param {module:boxes/BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
444
- * @param {number} px - `X` coordinate of the upper left corner of this box grid
445
- * @param {number} py - `Y` coordinate of the upper left corner of this box grid
446
- * @param {number} setWidth - Total width of the box grid
447
- * @param {number} setHeight - Total height of the box grid
448
- * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects
449
- */
450
- constructor(parent, container, boxBase, px, py, setWidth, setHeight, sh) {
451
- // ActiveBoxGrid derives from ActiveBoxBag
452
- super(parent, container, boxBase);
453
-
454
- this.nCols = sh.nCols;
455
- this.nRows = sh.nRows;
456
-
457
- // This will be the enclosing rectangle of this ActiveBox bag
458
- const r = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_(
459
- new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(px, py),
460
- new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
461
- Math.round(setWidth / this.nCols) * this.nCols,
462
- Math.round(setHeight / this.nRows) * this.nRows));
463
-
464
- // Create all the [ActiveBox](ActiveBox.html) objects based on the
465
- // shapes provided by the [Shaper](Shaper.html)
466
- for (let i = 0; i < sh.nCells; i++) {
467
- const
468
- tmpSh = sh.getShape(i, r),
469
- bx = new _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__["default"](this, container, boxBase, i, tmpSh.getBounds());
470
- if (!sh.rectangularShapes)
471
- bx.setShape(tmpSh);
472
- this.addActiveBox(bx);
473
- }
474
-
475
- // If the Shaper has `remainder` (extra space), set the background box of this
476
- // [BoxBag](BoxBag.html)
477
- if (sh.hasRemainder) {
478
- const
479
- tmpSh = sh.getRemainderShape(r),
480
- bx = new _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__["default"](this, container, boxBase, 0, tmpSh.getBounds());
481
- bx.setShape(tmpSh);
482
- this.setBackgroundBox(bx);
483
- }
484
- }
485
-
486
- /**
487
- * This factory constructor creates a new empty grid with the number of cells indicated by the
488
- * {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} `abc`, not filling the cells with any content.
489
- * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs
490
- * @param {module:AWT.Container} container - The container where this box grid is placed.
491
- * @param {number} px - `X` coordinate of the upper left corner of this box grid
492
- * @param {number} py - `Y` coordinate of the upper left corner of this box grid
493
- * @param {module:boxes/ActiveBagContent.ActiveBagContent} abc - Used only to get the number of cells and the shaper (when `sh` is `null`)
494
- * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects
495
- * @param {module:boxes/BoxBase.BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
496
- * of this box grid are defined.
497
- * @returns {module:boxes/ActiveBoxGrid.ActiveBoxGrid}
498
- */
499
- static createEmptyGrid(parent, container, px, py, abc, sh, boxBase) {
500
- const result = abc ? new ActiveBoxGrid(parent, container,
501
- boxBase || abc.style,
502
- px, py,
503
- abc.getTotalWidth(), abc.getTotalHeight(),
504
- sh || abc.getShaper()) : null;
505
-
506
- if (result)
507
- result.setBorder(abc.border);
508
-
509
- return result;
510
- }
511
-
512
- /**
513
- * Gets the minimum size of this grid
514
- * @returns {module:AWT.Dimension}
515
- */
516
- getMinimumSize() {
517
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
518
- _Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .settings */ .W0.MIN_CELL_SIZE * this.nCols,
519
- _Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .settings */ .W0.MIN_CELL_SIZE * this.nRows);
520
- }
521
-
522
- /**
523
- * Gets a scaled size of this grid, rounded to the nearest integer values
524
- * @param {number} scale - The scale factor
525
- * @returns {module:AWT.Dimension}
526
- */
527
- getScaledSize(scale) {
528
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
529
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .roundTo */ .GB)(scale * this.preferredBounds.dim.width, this.nCols),
530
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .roundTo */ .GB)(scale * this.preferredBounds.dim.height, this.nRows));
531
- }
532
-
533
- /**
534
- * Returns the logical coordinates of the provided {@link module:boxes/ActiveBox.ActiveBox ActiveBox}.
535
- * The units of the result are not pixels, but ordinal numbers (relative positions) of columns
536
- * and rows in the grid.
537
- * @param {module:boxes/ActiveBox.ActiveBox} bx - The box to process
538
- * @returns {module:AWT.Point}
539
- */
540
- getCoord(bx) {
541
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(bx.idLoc % this.nCols, Math.floor(bx.idLoc / this.nCols));
542
- }
543
-
544
- /**
545
- * Calculates the logical distance between two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects.
546
- * Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows
547
- * in the grid.
548
- * @param {module:boxes/ActiveBox.ActiveBox} src - First box
549
- * @param {module:boxes/ActiveBox.ActiveBox} dest - Second box
550
- * @returns {module:AWT.Point}
551
- */
552
- getCoordDist(src, dest) {
553
- const
554
- ptSrc = this.getCoord(src),
555
- ptDest = this.getCoord(dest);
556
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(ptDest.x - ptSrc.x, ptDest.y - ptSrc.y);
557
- }
558
- }
559
-
560
- Object.assign(ActiveBoxGrid.prototype, {
561
- /**
562
- * Number of columns of this box grid
563
- * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nCols
564
- * @type {number} */
565
- nCols: 1,
566
- /**
567
- * Number of rows of this box grid
568
- * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nRows
569
- * @type {number} */
570
- nRows: 1,
571
- });
572
-
573
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ActiveBoxGrid);
574
-
575
-
576
- /***/ }),
577
-
578
- /***/ 4921:
579
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
580
-
581
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
582
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
583
- /* harmony export */ });
584
- /* unused harmony export Rectangular */
585
- /* harmony import */ var _Shaper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8276);
586
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7912);
587
- /**
588
- * File : shapers/Rectangular.js
589
- * Created : 19/05/2015
590
- * By : Francesc Busquets <francesc@gmail.com>
591
- *
592
- * JClic.js
593
- * An HTML5 player of JClic activities
594
- * https://projectestac.github.io/jclic.js
595
- *
596
- * @source https://github.com/projectestac/jclic.js
597
- *
598
- * @license EUPL-1.2
599
- * @licstart
600
- * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
601
- *
602
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
603
- * the European Commission- subsequent versions of the EUPL (the "Licence");
604
- * You may not use this work except in compliance with the Licence.
605
- *
606
- * You may obtain a copy of the Licence at:
607
- * https://joinup.ec.europa.eu/software/page/eupl
608
- *
609
- * Unless required by applicable law or agreed to in writing, software
610
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
611
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
612
- * Licence for the specific language governing permissions and limitations
613
- * under the Licence.
614
- * @licend
615
- * @module
616
- */
617
-
618
-
619
-
620
-
621
- /**
622
- *
623
- * This is the simplest {@link module:shapers/Shaper.Shaper Shaper}. It divides the graphic object in a set of rectangular
624
- * shapes distributed in the specified number of rows and columns.
625
- * @extends module:shapers/Shaper.Shaper
626
- */
627
- class Rectangular extends _Shaper_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
628
- /**
629
- * Rectangular constructor
630
- * @param {number} nx - Number of columns
631
- * @param {number} ny - Number of rows
632
- */
633
- constructor(nx, ny) {
634
- super(nx, ny);
635
- }
636
-
637
- /**
638
- * Builds the rectangular shapes based on the number of rows and columns
639
- * @override
640
- */
641
- buildShapes() {
642
- const
643
- w = 1 / this.nCols,
644
- h = 1 / this.nRows;
645
- for (let y = 0; y < this.nRows; y++) {
646
- for (let x = 0; x < this.nCols; x++) {
647
- this.shapeData[y * this.nCols + x] = new _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Rectangle */ .M_(new _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Point */ .bR(x * w, y * h), new _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Dimension */ .fg(w, h));
648
- }
649
- }
650
- this.initiated = true;
651
- }
652
- }
653
-
654
- Object.assign(Rectangular.prototype, {
655
- /**
656
- * Overrides same flag in {@link module:/shapers/Shaper.Shaper#rectangularShapes Shaper#rectangularShapes}
657
- * @name module:shapers/Rectangular.Rectangular#rectangularShapes
658
- * @override
659
- * @type {boolean} */
660
- rectangularShapes: true,
661
- });
662
-
663
- // Register this class in the list of known shapers
664
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Shaper_js__WEBPACK_IMPORTED_MODULE_0__["default"].registerClass('@Rectangular', Rectangular));
665
-
666
-
667
- /***/ })
668
-
669
- };
670
- ;
671
- //# sourceMappingURL=3502.jclic-node.js.map