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.
- package/README.md +5 -7
- package/dist-node/jclic-node.js +14157 -0
- package/dist-node/jclic-node.umd.cjs +530 -0
- package/package.json +38 -26
- package/.vscode/launch.json +0 -33
- package/.vscode/settings.json +0 -13
- package/CHANGELOG.md +0 -672
- package/TRANSLATIONS.md +0 -11
- package/build-locales.mjs +0 -82
- package/dist/jclic-node.js +0 -31680
- package/dist/jclic-node.js.map +0 -1
- package/dist/jclic.components.LICENSE +0 -2254
- package/dist/jclic.min.js +0 -27
- package/dist/jclic.min.js.map +0 -1
- package/eslint.config.mjs +0 -31
- package/jsdoc.config.js +0 -71
- package/locales/ar.po +0 -244
- package/locales/ast.po +0 -246
- package/locales/bs.po +0 -247
- package/locales/ca.po +0 -248
- package/locales/ca_ES@valencia.po +0 -248
- package/locales/cs.po +0 -244
- package/locales/da.po +0 -244
- package/locales/de.po +0 -246
- package/locales/el.po +0 -244
- package/locales/es.po +0 -248
- package/locales/eu.po +0 -244
- package/locales/fr.po +0 -244
- package/locales/gl.po +0 -244
- package/locales/he.po +0 -244
- package/locales/hr.po +0 -245
- package/locales/it.po +0 -246
- package/locales/ja.po +0 -242
- package/locales/jclic.js.pot +0 -241
- package/locales/nb_NO.po +0 -244
- package/locales/nl.po +0 -244
- package/locales/pl.po +0 -244
- package/locales/pt.po +0 -244
- package/locales/pt_BR.po +0 -248
- package/locales/ro.po +0 -248
- package/locales/ru.po +0 -245
- package/locales/ta.po +0 -244
- package/locales/tr.po +0 -246
- package/locales/uk.po +0 -247
- package/locales/vec.po +0 -244
- package/locales/zh_TW.po +0 -246
- package/patches/po2json+1.0.0-beta-3.patch +0 -12
- package/src/AWT.js +0 -2067
- package/src/Activity.js +0 -1311
- package/src/Deps.js +0 -232
- package/src/GlobalData.js +0 -5
- package/src/JClic.js +0 -196
- package/src/JClicPlayer.js +0 -1308
- package/src/PlayerHistory.js +0 -305
- package/src/Utils.js +0 -1355
- package/src/activities/associations/ComplexAssociation.js +0 -321
- package/src/activities/associations/SimpleAssociation.js +0 -519
- package/src/activities/memory/MemoryGame.js +0 -423
- package/src/activities/panels/Explore.js +0 -349
- package/src/activities/panels/Identify.js +0 -356
- package/src/activities/panels/InformationScreen.js +0 -262
- package/src/activities/panels/Menu.js +0 -209
- package/src/activities/panels/icons/ico00.png +0 -0
- package/src/activities/panels/icons/ico01.png +0 -0
- package/src/activities/panels/icons/ico02.png +0 -0
- package/src/activities/panels/icons/ico03.png +0 -0
- package/src/activities/panels/icons/icofolder.png +0 -0
- package/src/activities/puzzles/DoublePuzzle.js +0 -424
- package/src/activities/puzzles/ExchangePuzzle.js +0 -374
- package/src/activities/puzzles/HolePuzzle.js +0 -360
- package/src/activities/text/Complete.js +0 -127
- package/src/activities/text/Evaluator.js +0 -534
- package/src/activities/text/FillInBlanks.js +0 -426
- package/src/activities/text/IdentifyText.js +0 -253
- package/src/activities/text/OrderText.js +0 -421
- package/src/activities/text/TextActivityBase.js +0 -557
- package/src/activities/text/TextActivityDocument.js +0 -660
- package/src/activities/text/WrittenAnswer.js +0 -557
- package/src/activities/textGrid/CrossWord.js +0 -565
- package/src/activities/textGrid/WordSearch.js +0 -458
- package/src/activities/textGrid/icons/hIcon.svg +0 -3
- package/src/activities/textGrid/icons/vIcon.svg +0 -3
- package/src/automation/AutoContentProvider.js +0 -182
- package/src/automation/arith/Arith.js +0 -864
- package/src/bags/ActivitySequence.js +0 -318
- package/src/bags/ActivitySequenceElement.js +0 -161
- package/src/bags/ActivitySequenceJump.js +0 -140
- package/src/bags/ConditionalJumpInfo.js +0 -113
- package/src/bags/JumpInfo.js +0 -136
- package/src/bags/MediaBag.js +0 -215
- package/src/bags/MediaBagElement.js +0 -516
- package/src/boxes/AbstractBox.js +0 -699
- package/src/boxes/ActiveBagContent.js +0 -494
- package/src/boxes/ActiveBox.js +0 -810
- package/src/boxes/ActiveBoxBag.js +0 -357
- package/src/boxes/ActiveBoxContent.js +0 -484
- package/src/boxes/ActiveBoxGrid.js +0 -179
- package/src/boxes/BoxBag.js +0 -500
- package/src/boxes/BoxBase.js +0 -398
- package/src/boxes/BoxConnector.js +0 -325
- package/src/boxes/TextGrid.js +0 -887
- package/src/boxes/TextGridContent.js +0 -215
- package/src/init-jsdom.js +0 -65
- package/src/jclic-node.js +0 -219
- package/src/media/ActiveMediaBag.js +0 -145
- package/src/media/ActiveMediaPlayer.js +0 -297
- package/src/media/AudioBuffer.js +0 -219
- package/src/media/EventSounds.js +0 -169
- package/src/media/EventSoundsElement.js +0 -155
- package/src/media/MediaContent.js +0 -328
- package/src/media/MidiAudioPlayer.js +0 -254
- package/src/media/icons/audio.svg +0 -3
- package/src/media/icons/generic.svg +0 -3
- package/src/media/icons/mic.svg +0 -3
- package/src/media/icons/movie.svg +0 -3
- package/src/media/icons/music.svg +0 -3
- package/src/media/icons/url.svg +0 -3
- package/src/media/sounds/actionError.mp3 +0 -0
- package/src/media/sounds/actionOk.mp3 +0 -0
- package/src/media/sounds/click.mp3 +0 -0
- package/src/media/sounds/finishedError.mp3 +0 -0
- package/src/media/sounds/finishedOk.mp3 +0 -0
- package/src/media/sounds/start.mp3 +0 -0
- package/src/project/JClicProject.js +0 -282
- package/src/project/ProjectSettings.js +0 -273
- package/src/report/ActionReg.js +0 -123
- package/src/report/ActivityReg.js +0 -271
- package/src/report/EncryptMin.js +0 -210
- package/src/report/Reporter.js +0 -727
- package/src/report/SCORM.js +0 -272
- package/src/report/SequenceReg.js +0 -275
- package/src/report/SessionReg.js +0 -340
- package/src/report/SessionStorageReporter.js +0 -131
- package/src/report/TCPReporter.js +0 -628
- package/src/shapers/ClassicJigSaw.js +0 -138
- package/src/shapers/Holes.js +0 -77
- package/src/shapers/JigSaw.js +0 -161
- package/src/shapers/Rectangular.js +0 -78
- package/src/shapers/Shaper.js +0 -386
- package/src/shapers/TriangularJigSaw.js +0 -121
- package/src/skins/BlueSkin.js +0 -80
- package/src/skins/Counter.js +0 -152
- package/src/skins/CustomSkin.js +0 -412
- package/src/skins/DefaultSkin.js +0 -376
- package/src/skins/EmptySkin.js +0 -82
- package/src/skins/GreenSkin.js +0 -94
- package/src/skins/MiniSkin.js +0 -130
- package/src/skins/OrangeSkin.js +0 -78
- package/src/skins/SimpleSkin.js +0 -92
- package/src/skins/Skin.js +0 -1021
- package/src/skins/assets/actionsIcon.svg +0 -3
- package/src/skins/assets/appLogo.svg +0 -8
- package/src/skins/assets/basic.css +0 -41
- package/src/skins/assets/closeDialogIcon.svg +0 -3
- package/src/skins/assets/closeIcon.svg +0 -3
- package/src/skins/assets/copyIcon.svg +0 -3
- package/src/skins/assets/fullScreenExitIcon.svg +0 -3
- package/src/skins/assets/fullScreenIcon.svg +0 -3
- package/src/skins/assets/infoIcon.svg +0 -3
- package/src/skins/assets/main.css +0 -43
- package/src/skins/assets/mainHalf.css +0 -23
- package/src/skins/assets/mainTwoThirds.css +0 -23
- package/src/skins/assets/mini.css +0 -15
- package/src/skins/assets/nextIcon.svg +0 -3
- package/src/skins/assets/okDialogIcon.svg +0 -3
- package/src/skins/assets/prevIcon.svg +0 -3
- package/src/skins/assets/reports.css +0 -156
- package/src/skins/assets/reportsIcon.svg +0 -3
- package/src/skins/assets/scoreIcon.svg +0 -3
- package/src/skins/assets/simple.css +0 -16
- package/src/skins/assets/simpleHalf.css +0 -11
- package/src/skins/assets/simpleTwoThirds.css +0 -11
- package/src/skins/assets/timeIcon.svg +0 -4
- package/src/skins/assets/waitAnim.css +0 -54
- package/src/skins/assets/waitImgBig.svg +0 -3
- package/src/skins/assets/waitImgSmall.svg +0 -3
- package/webpack.config.mjs +0 -169
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File : activities/associations/ComplexAssociation.js
|
|
3
|
-
* Created : 03/06/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
|
-
|
|
33
|
-
import Activity from '../../Activity.js';
|
|
34
|
-
import { Point } from '../../AWT.js';
|
|
35
|
-
import { SimpleAssociation, SimpleAssociationPanel } from './SimpleAssociation.js';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* This is a special case of {@link module:activities/associations/SimpleAssociation.SimpleAssociation SimpleAssociation} where the elements of the 'secondary' panel
|
|
39
|
-
* can have zero, one or more associated elements in the 'primary' panel.
|
|
40
|
-
* @extends module:activities/associations/SimpleAssociation.SimpleAssociation
|
|
41
|
-
*/
|
|
42
|
-
export class ComplexAssociation extends SimpleAssociation {
|
|
43
|
-
/**
|
|
44
|
-
* ComplexAssociation constructor
|
|
45
|
-
* @param {module:project/JClicProject.JClicProject} project - The JClic project to which this activity belongs
|
|
46
|
-
*/
|
|
47
|
-
constructor(project) {
|
|
48
|
-
super(project);
|
|
49
|
-
this.useIdAss = true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Loads this object settings from an XML element
|
|
54
|
-
* @override
|
|
55
|
-
* @param {external:jQuery} $xml - The jQuery XML element to parse
|
|
56
|
-
*/
|
|
57
|
-
setProperties($xml) {
|
|
58
|
-
super.setProperties($xml);
|
|
59
|
-
this.abc['primary'].avoidAllIdsNull(this.abc['secondary'].getNumCells());
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Retrieves the minimum number of actions needed to solve this activity.
|
|
64
|
-
* @override
|
|
65
|
-
* @returns {number}
|
|
66
|
-
*/
|
|
67
|
-
getMinNumActions() {
|
|
68
|
-
if (this.invAss)
|
|
69
|
-
return this.abc['secondary'].getNumCells();
|
|
70
|
-
else
|
|
71
|
-
return this.abc['primary'].getNumCells() - this.nonAssignedCells;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Object.assign(ComplexAssociation.prototype, {
|
|
76
|
-
/**
|
|
77
|
-
* Number of unassigned cells
|
|
78
|
-
* @name module:activities/associations/ComplexAssociation.ComplexAssociation#nonAssignedCells
|
|
79
|
-
* @type {number} */
|
|
80
|
-
nonAssignedCells: 0,
|
|
81
|
-
/**
|
|
82
|
-
* Uses cell's `idAss` field to check if pairings match
|
|
83
|
-
* @name module:activities/associations/ComplexAssociation.ComplexAssociation#useIdAss
|
|
84
|
-
* @type {boolean} */
|
|
85
|
-
useIdAss: false,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The {@link module:Activity.ActivityPanel ActivityPanel} where {@link module:activities/associations/ComplexAssociation.ComplexAssociation ComplexAssociation} activities are played.
|
|
90
|
-
* @extends module:activities/associations/SimpleAssociation.SimpleAssociationPanel
|
|
91
|
-
*/
|
|
92
|
-
export class ComplexAssociationPanel extends SimpleAssociationPanel {
|
|
93
|
-
/**
|
|
94
|
-
* ComplexAssociationPanel prototype
|
|
95
|
-
* @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs
|
|
96
|
-
* @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the
|
|
97
|
-
* [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.
|
|
98
|
-
* @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy
|
|
99
|
-
*/
|
|
100
|
-
constructor(act, ps, $div) {
|
|
101
|
-
super(act, ps, $div);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Prepares the visual components of the activity
|
|
106
|
-
* @override
|
|
107
|
-
*/
|
|
108
|
-
buildVisualComponents() {
|
|
109
|
-
super.buildVisualComponents();
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
abcA = this.act.abc['primary'],
|
|
113
|
-
abcB = this.act.abc['secondary'];
|
|
114
|
-
|
|
115
|
-
if (abcA && abcB) {
|
|
116
|
-
if (this.act.invAss)
|
|
117
|
-
this.invAssCheck = Array(abcB.getNumCells()).fill(false);
|
|
118
|
-
this.bgA.setDefaultIdAss();
|
|
119
|
-
this.act.nonAssignedCells = 0;
|
|
120
|
-
this.bgA.cells.forEach(bx => {
|
|
121
|
-
if (bx.idAss === -1) {
|
|
122
|
-
this.act.nonAssignedCells++;
|
|
123
|
-
bx.switchToAlt(this.ps);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Checks if all inverse associations are done
|
|
131
|
-
* @returns {boolean}
|
|
132
|
-
*/
|
|
133
|
-
checkInvAss() {
|
|
134
|
-
if (!this.act.invAss || !this.invAssCheck)
|
|
135
|
-
return false;
|
|
136
|
-
return this.invAssCheck.every(chk => chk);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Main handler used to process mouse, touch, keyboard and edit events
|
|
141
|
-
* @override
|
|
142
|
-
* @param {external:Event} event - The HTML event to be processed
|
|
143
|
-
* @returns {boolean} - When this event handler returns `false`, jQuery will stop its
|
|
144
|
-
* propagation through the DOM tree. See: {@link http://api.jquery.com/on}
|
|
145
|
-
*/
|
|
146
|
-
processEvent(event) {
|
|
147
|
-
if (this.bc && this.playing) {
|
|
148
|
-
//
|
|
149
|
-
// The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
|
|
150
|
-
// and two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
|
|
151
|
-
// `origin` and `dest` points.
|
|
152
|
-
let p = null, bx1, bx2;
|
|
153
|
-
|
|
154
|
-
//
|
|
155
|
-
// _touchend_ event don't provide pageX nor pageY information
|
|
156
|
-
if (event.type === 'touchend') {
|
|
157
|
-
p = this.bc.active ? this.bc.dest.clone() : new Point();
|
|
158
|
-
} else {
|
|
159
|
-
// Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
|
|
160
|
-
let
|
|
161
|
-
x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
|
|
162
|
-
y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
|
|
163
|
-
p = new Point(x - this.$div.offset().left, y - this.$div.offset().top);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
let
|
|
167
|
-
// Flag for tracking `mouseup` events
|
|
168
|
-
up = false,
|
|
169
|
-
// Flag for assuring that only one media plays per event (avoid event sounds overlapping
|
|
170
|
-
// cell's media sounds)
|
|
171
|
-
m = false,
|
|
172
|
-
// Flag for tracking clicks on the background of grid A
|
|
173
|
-
clickOnBg0 = false,
|
|
174
|
-
// Array to be filled with actions to be executed at the end of event processing
|
|
175
|
-
delayedActions = [];
|
|
176
|
-
|
|
177
|
-
switch (event.type) {
|
|
178
|
-
case 'touchcancel':
|
|
179
|
-
// Canvel movement
|
|
180
|
-
if (this.bc.active)
|
|
181
|
-
this.bc.end();
|
|
182
|
-
break;
|
|
183
|
-
|
|
184
|
-
case 'mouseup':
|
|
185
|
-
// Don't consider drag moves below 3 pixels. Can be a "trembling click"
|
|
186
|
-
if (this.bc.active && p.distanceTo(this.bc.origin) <= 3) {
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
up = true;
|
|
190
|
-
/* falls through */
|
|
191
|
-
case 'touchend':
|
|
192
|
-
case 'touchstart':
|
|
193
|
-
case 'mousedown':
|
|
194
|
-
if (!this.bc.active) {
|
|
195
|
-
// New pairing starts
|
|
196
|
-
//
|
|
197
|
-
// Pairings can never start with a `mouseup` event
|
|
198
|
-
if (up)
|
|
199
|
-
break;
|
|
200
|
-
|
|
201
|
-
this.ps.stopMedia(1);
|
|
202
|
-
// Determine if click was done on panel A or panel B
|
|
203
|
-
bx1 = this.bgA ? this.bgA.findActiveBox(p) : null;
|
|
204
|
-
bx2 = this.bgB ? this.bgB.findActiveBox(p) : null;
|
|
205
|
-
if (bx1 && bx1.idAss !== -1 && (!this.act.useOrder || bx1.idOrder === this.currentItem) ||
|
|
206
|
-
!this.act.useOrder && bx2) {
|
|
207
|
-
// Start the [BoxConnector](BoxConnector.html)
|
|
208
|
-
if (this.act.dragCells)
|
|
209
|
-
this.bc.begin(p, bx1 || bx2);
|
|
210
|
-
else
|
|
211
|
-
this.bc.begin(p);
|
|
212
|
-
// Play cell media or event sound
|
|
213
|
-
m = m || (bx1 || bx2).playMedia(this.ps, delayedActions);
|
|
214
|
-
if (!m)
|
|
215
|
-
this.playEvent('click');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Move the focus to the opposite accessible group
|
|
219
|
-
let bg = bx1 ? this.bgA : this.bgB;
|
|
220
|
-
if (bg && bg.$accessibleDiv) {
|
|
221
|
-
bg = bx1 ? this.bgB : this.bgA;
|
|
222
|
-
if (bg && bg.$accessibleDiv)
|
|
223
|
-
bg.$accessibleDiv.trigger('focus');
|
|
224
|
-
}
|
|
225
|
-
} else {
|
|
226
|
-
this.ps.stopMedia(1);
|
|
227
|
-
// Pairing completed
|
|
228
|
-
//
|
|
229
|
-
// Find the active boxes behind `bc.origin` and `p`
|
|
230
|
-
const origin = this.bc.origin;
|
|
231
|
-
this.bc.end();
|
|
232
|
-
bx1 = this.bgA ? this.bgA.findActiveBox(origin) : null;
|
|
233
|
-
if (bx1) {
|
|
234
|
-
bx2 = this.bgB ? this.bgB.findActiveBox(p) : null;
|
|
235
|
-
} else {
|
|
236
|
-
bx2 = this.bgB ? this.bgB.findActiveBox(origin) : null;
|
|
237
|
-
if (bx2) {
|
|
238
|
-
bx1 = this.bgA ? this.bgA.findActiveBox(p) : null;
|
|
239
|
-
clickOnBg0 = true;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
// Check if the pairing was correct
|
|
243
|
-
if (bx1 && bx2 && bx1.idAss !== -1 && !bx2.isInactive() && this.act.abc['secondary']) {
|
|
244
|
-
const
|
|
245
|
-
src = bx1.getDescription(),
|
|
246
|
-
dest = bx2.getDescription(),
|
|
247
|
-
matchingDest = this.act.abc['secondary'].getActiveBoxContent(bx1.idAss);
|
|
248
|
-
let ok = false;
|
|
249
|
-
|
|
250
|
-
if (bx1.idAss === bx2.idOrder || bx2.getContent().isEquivalent(matchingDest, true)) {
|
|
251
|
-
// Pairing was OK. Play media and disable involved cells
|
|
252
|
-
ok = true;
|
|
253
|
-
bx1.idAss = -1;
|
|
254
|
-
if (this.act.abc['solvedPrimary']) {
|
|
255
|
-
bx1.switchToAlt(this.ps);
|
|
256
|
-
m = m || bx1.playMedia(this.ps, delayedActions);
|
|
257
|
-
} else {
|
|
258
|
-
if (clickOnBg0)
|
|
259
|
-
m = m || bx1.playMedia(this.ps, delayedActions);
|
|
260
|
-
else
|
|
261
|
-
m = m || bx2.playMedia(this.ps, delayedActions);
|
|
262
|
-
bx1.clear();
|
|
263
|
-
}
|
|
264
|
-
if (this.act.invAss) {
|
|
265
|
-
this.invAssCheck[bx2.idOrder] = true;
|
|
266
|
-
bx2.clear();
|
|
267
|
-
}
|
|
268
|
-
if (this.act.useOrder && this.bgA)
|
|
269
|
-
// Load next item
|
|
270
|
-
this.currentItem = this.bgA.getNextItem(this.currentItem);
|
|
271
|
-
}
|
|
272
|
-
// Check results and notify action
|
|
273
|
-
if (this.bgA) {
|
|
274
|
-
const cellsPlaced = this.bgA.countCellsWithIdAss(-1);
|
|
275
|
-
this.ps.reportNewAction(this.act, 'MATCH', src, dest, ok, cellsPlaced - this.act.nonAssignedCells);
|
|
276
|
-
// End activity or play event sound
|
|
277
|
-
if (ok && (this.checkInvAss() || cellsPlaced === this.bgA.getNumCells()))
|
|
278
|
-
this.finishActivity(true);
|
|
279
|
-
else if (!m)
|
|
280
|
-
this.playEvent(ok ? 'actionOk' : 'actionError');
|
|
281
|
-
}
|
|
282
|
-
} else if (this.bgB && (clickOnBg0 && this.bgA && this.bgA.contains(p) || !clickOnBg0 && this.bgB.contains(p))) {
|
|
283
|
-
// click on grid, out of cell
|
|
284
|
-
const srcOut = bx1 ? bx1.getDescription() : bx2 ? bx2.getDescription() : 'null';
|
|
285
|
-
this.ps.reportNewAction(this.act, 'MATCH', srcOut, 'null', false, this.bgB.countCellsWithIdAss(-1));
|
|
286
|
-
this.playEvent('actionError');
|
|
287
|
-
}
|
|
288
|
-
this.update();
|
|
289
|
-
|
|
290
|
-
// Move the focus to the `source` accessible group
|
|
291
|
-
if (this.bgA && this.bgA.$accessibleDiv)
|
|
292
|
-
this.bgA.$accessibleDiv.trigger('focus');
|
|
293
|
-
}
|
|
294
|
-
break;
|
|
295
|
-
|
|
296
|
-
case 'mousemove':
|
|
297
|
-
case 'touchmove':
|
|
298
|
-
this.bc.moveTo(p);
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
delayedActions.forEach(action => action());
|
|
302
|
-
event.preventDefault();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
Object.assign(ComplexAssociationPanel.prototype, {
|
|
308
|
-
/**
|
|
309
|
-
* Array for storing checked associations
|
|
310
|
-
* @name module:activities/associations/ComplexAssociation.ComplexAssociationPanel#invAssCheck
|
|
311
|
-
* @type {boolean[]} */
|
|
312
|
-
invAssCheck: null,
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Panel class associated to this type of activity: {@link module:activities/associations/ComplexAssociation.ComplexAssociationPanel ComplexAssociationPanel}
|
|
317
|
-
* @type {class} */
|
|
318
|
-
ComplexAssociation.Panel = ComplexAssociationPanel;
|
|
319
|
-
|
|
320
|
-
// Register activity class
|
|
321
|
-
export default Activity.registerClass('@associations.ComplexAssociation', ComplexAssociation);
|