jclic 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/README.md +5 -7
  2. package/dist-node/jclic-node.js +14157 -0
  3. package/dist-node/jclic-node.umd.cjs +530 -0
  4. package/package.json +38 -26
  5. package/.vscode/launch.json +0 -33
  6. package/.vscode/settings.json +0 -13
  7. package/CHANGELOG.md +0 -672
  8. package/TRANSLATIONS.md +0 -11
  9. package/build-locales.mjs +0 -82
  10. package/dist/jclic-node.js +0 -31680
  11. package/dist/jclic-node.js.map +0 -1
  12. package/dist/jclic.components.LICENSE +0 -2254
  13. package/dist/jclic.min.js +0 -27
  14. package/dist/jclic.min.js.map +0 -1
  15. package/eslint.config.mjs +0 -31
  16. package/jsdoc.config.js +0 -71
  17. package/locales/ar.po +0 -244
  18. package/locales/ast.po +0 -246
  19. package/locales/bs.po +0 -247
  20. package/locales/ca.po +0 -248
  21. package/locales/ca_ES@valencia.po +0 -248
  22. package/locales/cs.po +0 -244
  23. package/locales/da.po +0 -244
  24. package/locales/de.po +0 -246
  25. package/locales/el.po +0 -244
  26. package/locales/es.po +0 -248
  27. package/locales/eu.po +0 -244
  28. package/locales/fr.po +0 -244
  29. package/locales/gl.po +0 -244
  30. package/locales/he.po +0 -244
  31. package/locales/hr.po +0 -245
  32. package/locales/it.po +0 -246
  33. package/locales/ja.po +0 -242
  34. package/locales/jclic.js.pot +0 -241
  35. package/locales/nb_NO.po +0 -244
  36. package/locales/nl.po +0 -244
  37. package/locales/pl.po +0 -244
  38. package/locales/pt.po +0 -244
  39. package/locales/pt_BR.po +0 -248
  40. package/locales/ro.po +0 -248
  41. package/locales/ru.po +0 -245
  42. package/locales/ta.po +0 -244
  43. package/locales/tr.po +0 -246
  44. package/locales/uk.po +0 -247
  45. package/locales/vec.po +0 -244
  46. package/locales/zh_TW.po +0 -246
  47. package/patches/po2json+1.0.0-beta-3.patch +0 -12
  48. package/src/AWT.js +0 -2067
  49. package/src/Activity.js +0 -1311
  50. package/src/Deps.js +0 -232
  51. package/src/GlobalData.js +0 -5
  52. package/src/JClic.js +0 -196
  53. package/src/JClicPlayer.js +0 -1308
  54. package/src/PlayerHistory.js +0 -305
  55. package/src/Utils.js +0 -1355
  56. package/src/activities/associations/ComplexAssociation.js +0 -321
  57. package/src/activities/associations/SimpleAssociation.js +0 -519
  58. package/src/activities/memory/MemoryGame.js +0 -423
  59. package/src/activities/panels/Explore.js +0 -349
  60. package/src/activities/panels/Identify.js +0 -356
  61. package/src/activities/panels/InformationScreen.js +0 -262
  62. package/src/activities/panels/Menu.js +0 -209
  63. package/src/activities/panels/icons/ico00.png +0 -0
  64. package/src/activities/panels/icons/ico01.png +0 -0
  65. package/src/activities/panels/icons/ico02.png +0 -0
  66. package/src/activities/panels/icons/ico03.png +0 -0
  67. package/src/activities/panels/icons/icofolder.png +0 -0
  68. package/src/activities/puzzles/DoublePuzzle.js +0 -424
  69. package/src/activities/puzzles/ExchangePuzzle.js +0 -374
  70. package/src/activities/puzzles/HolePuzzle.js +0 -360
  71. package/src/activities/text/Complete.js +0 -127
  72. package/src/activities/text/Evaluator.js +0 -534
  73. package/src/activities/text/FillInBlanks.js +0 -426
  74. package/src/activities/text/IdentifyText.js +0 -253
  75. package/src/activities/text/OrderText.js +0 -421
  76. package/src/activities/text/TextActivityBase.js +0 -557
  77. package/src/activities/text/TextActivityDocument.js +0 -660
  78. package/src/activities/text/WrittenAnswer.js +0 -557
  79. package/src/activities/textGrid/CrossWord.js +0 -565
  80. package/src/activities/textGrid/WordSearch.js +0 -458
  81. package/src/activities/textGrid/icons/hIcon.svg +0 -3
  82. package/src/activities/textGrid/icons/vIcon.svg +0 -3
  83. package/src/automation/AutoContentProvider.js +0 -182
  84. package/src/automation/arith/Arith.js +0 -864
  85. package/src/bags/ActivitySequence.js +0 -318
  86. package/src/bags/ActivitySequenceElement.js +0 -161
  87. package/src/bags/ActivitySequenceJump.js +0 -140
  88. package/src/bags/ConditionalJumpInfo.js +0 -113
  89. package/src/bags/JumpInfo.js +0 -136
  90. package/src/bags/MediaBag.js +0 -215
  91. package/src/bags/MediaBagElement.js +0 -516
  92. package/src/boxes/AbstractBox.js +0 -699
  93. package/src/boxes/ActiveBagContent.js +0 -494
  94. package/src/boxes/ActiveBox.js +0 -810
  95. package/src/boxes/ActiveBoxBag.js +0 -357
  96. package/src/boxes/ActiveBoxContent.js +0 -484
  97. package/src/boxes/ActiveBoxGrid.js +0 -179
  98. package/src/boxes/BoxBag.js +0 -500
  99. package/src/boxes/BoxBase.js +0 -398
  100. package/src/boxes/BoxConnector.js +0 -325
  101. package/src/boxes/TextGrid.js +0 -887
  102. package/src/boxes/TextGridContent.js +0 -215
  103. package/src/init-jsdom.js +0 -65
  104. package/src/jclic-node.js +0 -219
  105. package/src/media/ActiveMediaBag.js +0 -145
  106. package/src/media/ActiveMediaPlayer.js +0 -297
  107. package/src/media/AudioBuffer.js +0 -219
  108. package/src/media/EventSounds.js +0 -169
  109. package/src/media/EventSoundsElement.js +0 -155
  110. package/src/media/MediaContent.js +0 -328
  111. package/src/media/MidiAudioPlayer.js +0 -254
  112. package/src/media/icons/audio.svg +0 -3
  113. package/src/media/icons/generic.svg +0 -3
  114. package/src/media/icons/mic.svg +0 -3
  115. package/src/media/icons/movie.svg +0 -3
  116. package/src/media/icons/music.svg +0 -3
  117. package/src/media/icons/url.svg +0 -3
  118. package/src/media/sounds/actionError.mp3 +0 -0
  119. package/src/media/sounds/actionOk.mp3 +0 -0
  120. package/src/media/sounds/click.mp3 +0 -0
  121. package/src/media/sounds/finishedError.mp3 +0 -0
  122. package/src/media/sounds/finishedOk.mp3 +0 -0
  123. package/src/media/sounds/start.mp3 +0 -0
  124. package/src/project/JClicProject.js +0 -282
  125. package/src/project/ProjectSettings.js +0 -273
  126. package/src/report/ActionReg.js +0 -123
  127. package/src/report/ActivityReg.js +0 -271
  128. package/src/report/EncryptMin.js +0 -210
  129. package/src/report/Reporter.js +0 -727
  130. package/src/report/SCORM.js +0 -272
  131. package/src/report/SequenceReg.js +0 -275
  132. package/src/report/SessionReg.js +0 -340
  133. package/src/report/SessionStorageReporter.js +0 -131
  134. package/src/report/TCPReporter.js +0 -628
  135. package/src/shapers/ClassicJigSaw.js +0 -138
  136. package/src/shapers/Holes.js +0 -77
  137. package/src/shapers/JigSaw.js +0 -161
  138. package/src/shapers/Rectangular.js +0 -78
  139. package/src/shapers/Shaper.js +0 -386
  140. package/src/shapers/TriangularJigSaw.js +0 -121
  141. package/src/skins/BlueSkin.js +0 -80
  142. package/src/skins/Counter.js +0 -152
  143. package/src/skins/CustomSkin.js +0 -412
  144. package/src/skins/DefaultSkin.js +0 -376
  145. package/src/skins/EmptySkin.js +0 -82
  146. package/src/skins/GreenSkin.js +0 -94
  147. package/src/skins/MiniSkin.js +0 -130
  148. package/src/skins/OrangeSkin.js +0 -78
  149. package/src/skins/SimpleSkin.js +0 -92
  150. package/src/skins/Skin.js +0 -1021
  151. package/src/skins/assets/actionsIcon.svg +0 -3
  152. package/src/skins/assets/appLogo.svg +0 -8
  153. package/src/skins/assets/basic.css +0 -41
  154. package/src/skins/assets/closeDialogIcon.svg +0 -3
  155. package/src/skins/assets/closeIcon.svg +0 -3
  156. package/src/skins/assets/copyIcon.svg +0 -3
  157. package/src/skins/assets/fullScreenExitIcon.svg +0 -3
  158. package/src/skins/assets/fullScreenIcon.svg +0 -3
  159. package/src/skins/assets/infoIcon.svg +0 -3
  160. package/src/skins/assets/main.css +0 -43
  161. package/src/skins/assets/mainHalf.css +0 -23
  162. package/src/skins/assets/mainTwoThirds.css +0 -23
  163. package/src/skins/assets/mini.css +0 -15
  164. package/src/skins/assets/nextIcon.svg +0 -3
  165. package/src/skins/assets/okDialogIcon.svg +0 -3
  166. package/src/skins/assets/prevIcon.svg +0 -3
  167. package/src/skins/assets/reports.css +0 -156
  168. package/src/skins/assets/reportsIcon.svg +0 -3
  169. package/src/skins/assets/scoreIcon.svg +0 -3
  170. package/src/skins/assets/simple.css +0 -16
  171. package/src/skins/assets/simpleHalf.css +0 -11
  172. package/src/skins/assets/simpleTwoThirds.css +0 -11
  173. package/src/skins/assets/timeIcon.svg +0 -4
  174. package/src/skins/assets/waitAnim.css +0 -54
  175. package/src/skins/assets/waitImgBig.svg +0 -3
  176. package/src/skins/assets/waitImgSmall.svg +0 -3
  177. package/webpack.config.mjs +0 -169
@@ -1,424 +0,0 @@
1
- /**
2
- * File : activities/puzzles/DoublePuzzle.js
3
- * Created : 22/05/2015
4
- * By : Francesc Busquets <francesc@gmail.com>
5
- *
6
- * JClic.js
7
- * An HTML5 player of JClic activities
8
- * https://projectestac.github.io/jclic.js
9
- *
10
- * @source https://github.com/projectestac/jclic.js
11
- *
12
- * @license EUPL-1.2
13
- * @licstart
14
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
15
- *
16
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
17
- * the European Commission- subsequent versions of the EUPL (the "Licence");
18
- * You may not use this work except in compliance with the Licence.
19
- *
20
- * You may obtain a copy of the Licence at:
21
- * https://joinup.ec.europa.eu/software/page/eupl
22
- *
23
- * Unless required by applicable law or agreed to in writing, software
24
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
25
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
26
- * Licence for the specific language governing permissions and limitations
27
- * under the Licence.
28
- * @licend
29
- * @module
30
- */
31
-
32
- import $ from 'jquery';
33
- import { Activity, ActivityPanel } from '../../Activity.js';
34
- import ActiveBoxGrid from '../../boxes/ActiveBoxGrid.js';
35
- import BoxBag from '../../boxes/BoxBag.js';
36
- import BoxConnector from '../../boxes/BoxConnector.js';
37
- import { Rectangle, Point } from '../../AWT.js';
38
- import { getMsg } from '../../Utils.js';
39
-
40
- /**
41
- * The aim of this class of {@link module:Activity.Activity Activity} is to put in order the shuffled elements of an
42
- * {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} that contains an image, sounds, text... or any other media content.
43
- *
44
- * The activity uses two panels: one with the shuffled cells, and other initially empty where
45
- * this cells must be placed in order.
46
- * @extends module:Activity.Activity
47
- */
48
- export class DoublePuzzle extends Activity {
49
- /**
50
- * DoublePuzzle constructor
51
- * @param {module:project/JClicProject.JClicProject} project - The {@link module:project/JClicProject.JClicProject JClicProject} to which this activity belongs
52
- */
53
- constructor(project) {
54
- super(project);
55
- }
56
-
57
- /**
58
- * Retrieves the minimum number of actions needed to solve this activity.
59
- * @override
60
- * @returns {number}
61
- */
62
- getMinNumActions() {
63
- return this.abc.primary.getNumCells();
64
- }
65
-
66
- /**
67
- * Whether or not the activity uses random to shuffle internal components
68
- * @override
69
- * @returns {boolean}
70
- */
71
- hasRandom() {
72
- return true;
73
- }
74
-
75
- /**
76
- * When `true`, the activity must always be shuffled
77
- * @override
78
- * @returns {boolean}
79
- */
80
- shuffleAlways() {
81
- return true;
82
- }
83
-
84
- /**
85
- * Whether the activity allows the user to request help.
86
- * @override
87
- * @returns {boolean}
88
- */
89
- helpSolutionAllowed() {
90
- return true;
91
- }
92
- }
93
-
94
- /**
95
- * The {@link module:Activity.ActivityPanel ActivityPanel} where {@link module:activities/puzzles/DoublePuzzle.DoublePuzzle DoublePuzzle} activities are played.
96
- * @extends module:Activity.ActivityPanel
97
- */
98
- export class DoublePuzzlePanel extends ActivityPanel {
99
- /**
100
- * DoublePuzzlePanel constructor
101
- * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs
102
- * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the
103
- * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
104
- * Java interface.
105
- * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy
106
- */
107
- constructor(act, ps, $div) {
108
- super(act, ps, $div);
109
- }
110
-
111
- /**
112
- * Miscellaneous cleaning operations
113
- * @override
114
- */
115
- clear() {
116
- if (this.bgA) {
117
- this.bgA.end();
118
- this.bgA = null;
119
- }
120
- if (this.bgB) {
121
- this.bgB.end();
122
- this.bgB = null;
123
- }
124
- }
125
-
126
- /**
127
- * Prepares the visual components of the activity
128
- * @override
129
- */
130
- buildVisualComponents() {
131
- if (this.firstRun)
132
- super.buildVisualComponents();
133
- this.clear();
134
-
135
- const abc = this.act.abc['primary'];
136
- if (abc) {
137
- if (abc.image)
138
- abc.setImgContent(this.act.project.mediaBag, null, false);
139
-
140
- if (this.act.acp !== null)
141
- this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);
142
-
143
- this.bgA = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
144
- this.bgB = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
145
-
146
- this.bgA.setContent(abc);
147
-
148
- this.bgA.accessibleText = getMsg('source');
149
- this.bgB.accessibleText = getMsg('target');
150
-
151
- this.bgA.setVisible(true);
152
- this.bgB.setVisible(true);
153
-
154
- const bgbA = this.bgA.getBackgroundActiveBox();
155
- const bgbB = this.bgB.getBackgroundActiveBox();
156
- if (bgbA && bgbB)
157
- bgbB.exchangeContent(bgbA);
158
- }
159
- }
160
-
161
- /**
162
- * Basic initialization procedure
163
- * @override
164
- */
165
- initActivity() {
166
- super.initActivity();
167
- if (!this.firstRun)
168
- this.buildVisualComponents();
169
- else
170
- this.firstRun = false;
171
-
172
- if (this.bgA && this.bgB) {
173
- this.shuffle([this.bgA], true, true);
174
- if (this.useOrder)
175
- this.currentItem = this.bgA.getNextItem(-1);
176
- this.setAndPlayMsg('initial', 'start');
177
- this.invalidate().update();
178
- this.playing = true;
179
- }
180
- }
181
-
182
- /**
183
- * Updates the graphic content of this panel.
184
- * This method will be called from {@link module:AWT.Container#update} when needed.
185
- * @override
186
- * @param {module:AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
187
- * it's the whole panel.
188
- */
189
- updateContent(dirtyRegion) {
190
- super.updateContent();
191
- if (this.bgA && this.bgB && this.$canvas) {
192
- const
193
- canvas = this.$canvas.get(-1),
194
- ctx = canvas.getContext('2d');
195
- if (!dirtyRegion)
196
- dirtyRegion = new Rectangle(0, 0, canvas.width, canvas.height);
197
- ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
198
- this.bgA.update(ctx, dirtyRegion);
199
- this.bgB.update(ctx, dirtyRegion);
200
- }
201
- return this;
202
- }
203
-
204
- /**
205
- * Sets the real dimension of this panel.
206
- * @override
207
- * @param {module:AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
208
- * @returns {module:AWT.Dimension}
209
- */
210
- setDimension(preferredMaxSize) {
211
- return !this.bgA || !this.bgB || this.getBounds().equals(preferredMaxSize) ?
212
- preferredMaxSize :
213
- BoxBag.layoutDouble(preferredMaxSize, this.bgA, this.bgB, this.act.boxGridPos, this.act.margin);
214
- }
215
-
216
- /**
217
- * Sets the size and position of this activity panel
218
- * @override
219
- * @param {module:AWT.Rectangle} rect
220
- */
221
- setBounds(rect) {
222
- if (this.$canvas)
223
- this.$canvas.remove();
224
-
225
- super.setBounds(rect);
226
- if (this.bgA || this.bgB) {
227
- // Create the main canvas
228
- this.$canvas = $(`<canvas width="${rect.dim.width}" height="${rect.dim.height}"/>`).css({
229
- position: 'absolute',
230
- top: 0,
231
- left: 0
232
- });
233
- this.$div.append(this.$canvas);
234
-
235
- // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
236
- this.bc = new BoxConnector(this, this.$canvas);
237
-
238
- // Repaint all
239
- this.invalidate().update();
240
- }
241
- }
242
-
243
- /**
244
- * Builds the accessible components needed for this ActivityPanel
245
- * This method is called when all main elements are placed and visible, when the activity is ready
246
- * to start or when resized.
247
- * @override
248
- */
249
- buildAccessibleComponents() {
250
- if (this.$canvas && this.accessibleCanvas) {
251
- super.buildAccessibleComponents();
252
- if (this.bgA)
253
- this.bgA.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
254
- if (this.bgB) {
255
- this.bgB.setCellAttr('accessibleAlwaysActive', true);
256
- this.bgB.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
257
- }
258
- }
259
- }
260
-
261
- /**
262
- * Main handler used to process mouse, touch, keyboard and edit events
263
- * @override
264
- * @param {external:Event} event - The HTML event to be processed
265
- * @returns {boolean} - When this event handler returns `false`, jQuery will stop its
266
- * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
267
- */
268
- processEvent(event) {
269
- if (this.bc && this.playing) {
270
- //
271
- // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
272
- let p = null;
273
- //
274
- // Two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
275
- // `origin` and `dest` points.
276
- let bx1, bx2;
277
- // Array to be filled with actions to be executed at the end of event processing
278
- const delayedActions = [];
279
- //
280
- // _touchend_ event don't provide pageX nor pageY information
281
- if (event.type === 'touchend')
282
- p = this.bc.active ? this.bc.dest.clone() : new Point();
283
- else {
284
- // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
285
- const
286
- x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
287
- y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
288
- p = new Point(x - this.$div.offset().left, y - this.$div.offset().top);
289
- }
290
-
291
- // Flag for tracking `mouseup` events
292
- let up = false;
293
- switch (event.type) {
294
- case 'touchcancel':
295
- // Canvel movement
296
- if (this.bc.active)
297
- this.bc.end();
298
- break;
299
-
300
- case 'mouseup':
301
- // Don't consider drag moves below 3 pixels. Can be a "trembling click"
302
- if (this.bc.active && p.distanceTo(this.bc.origin) <= 3)
303
- break;
304
-
305
- up = true;
306
- /* falls through */
307
- case 'touchend':
308
- case 'touchstart':
309
- case 'mousedown':
310
- if (!this.bc.active) {
311
- //
312
- // A new pairing starts
313
- //
314
- // Pairings can never start with a `mouseup` event
315
- if (up)
316
- break;
317
-
318
- this.ps.stopMedia(1);
319
- //
320
- // Find the ActiveBox behind the clicked point
321
- bx1 = this.bgA.findActiveBox(p);
322
- if (bx1 && !bx1.isInactive() && (!this.act.useOrder || bx1.idOrder === this.currentItem)) {
323
- // Start the [BoxConnector](BoxConnector.html)
324
- if (this.act.dragCells)
325
- this.bc.begin(p, bx1);
326
- else
327
- this.bc.begin(p);
328
- // Play cell media or event sound
329
- if (!bx1.playMedia(this.ps, delayedActions))
330
- this.playEvent('click');
331
-
332
- // Move the focus to the opposite accessible group
333
- if (this.bgB.$accessibleDiv)
334
- this.bgB.$accessibleDiv.trigger('focus');
335
- }
336
- } else {
337
- this.ps.stopMedia(1);
338
- // Pairing completed
339
- //
340
- // Find the active boxes behind `bc.origin` and `p`
341
- if (this.act.dragCells)
342
- bx1 = this.bc.bx;
343
- else
344
- bx1 = this.bgA.findActiveBox(this.bc.origin);
345
- bx2 = this.bgB.findActiveBox(p);
346
-
347
- // BoxConnector ends here
348
- this.bc.end();
349
-
350
- // Check if the pairing was OK
351
- if (bx1 && bx2 && bx2.isInactive()) {
352
- let ok = false;
353
- const
354
- src = `${bx1.getDescription()} (${bx1.idOrder})`,
355
- dest = `(${bx2.idOrder})`,
356
- target = this.act.abc['primary'].getActiveBoxContent(bx2.idOrder);
357
- if (bx1.getContent().isEquivalent(target, true)) {
358
- // Pairing OK
359
- ok = true;
360
- bx1.exchangeContent(bx2);
361
- bx1.setVisible(false);
362
- if (this.act.useOrder)
363
- this.currentItem = this.bgA.getNextItem(this.currentItem);
364
- }
365
- // Check results and notify action
366
- const cellsAtPlace = this.bgA.countInactiveCells();
367
- this.ps.reportNewAction(this.act, 'PLACE', src, dest, ok, cellsAtPlace);
368
- // Finish activity or play event sound
369
- if (ok && cellsAtPlace === this.bgA.getNumCells())
370
- this.finishActivity(true);
371
- else
372
- this.playEvent(ok ? 'actionOk' : 'actionError');
373
- }
374
- this.update();
375
-
376
- // Move the focus to the `source` accessible group
377
- if (this.bgA.$accessibleDiv)
378
- this.bgA.$accessibleDiv.trigger('focus');
379
- }
380
- break;
381
-
382
- case 'mousemove':
383
- case 'touchmove':
384
- this.bc.moveTo(p);
385
- break;
386
- }
387
- delayedActions.forEach(action => action());
388
- event.preventDefault();
389
- }
390
- }
391
- }
392
-
393
- Object.assign(DoublePuzzlePanel.prototype, {
394
- /**
395
- * The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} object containing the information to be displayed in the `primary` panel
396
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#bgA
397
- * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */
398
- bgA: null,
399
- /**
400
- * The secondary {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag}, initially empty.
401
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#bgB
402
- * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */
403
- bgB: null,
404
- /**
405
- * The box connector
406
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#bc
407
- * @type {module:boxes/BoxConnector.BoxConnector} */
408
- bc: null,
409
- /**
410
- * List of mouse, touch and keyboard events intercepted by this panel
411
- * @override
412
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#events
413
- * @type {string[]} */
414
- events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel'],
415
- });
416
-
417
- /**
418
- * Panel class associated to this type of activity: {@link module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel DoublePuzzlePanel}
419
- * @type {class} */
420
- DoublePuzzle.Panel = DoublePuzzlePanel;
421
-
422
- // Register activity class
423
- export default Activity.registerClass('@puzzles.DoublePuzzle', DoublePuzzle);
424
-