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.
- package/CHANGELOG.md +13 -0
- package/dist/jclic-node.js +9 -8
- package/dist/jclic-node.js.map +1 -1
- package/dist/jclic.min.js +2 -2
- package/dist/jclic.min.js.map +1 -1
- package/package.json +4 -4
- package/src/GlobalData.js +1 -1
- package/src/JClicPlayer.js +2 -2
- package/src/bags/MediaBag.js +6 -5
- package/dist/1078.jclic-node.js +0 -282
- package/dist/1078.jclic-node.js.map +0 -1
- package/dist/1196.jclic-node.js +0 -808
- package/dist/1196.jclic-node.js.map +0 -1
- package/dist/1253.jclic-node.js +0 -1432
- package/dist/1253.jclic-node.js.map +0 -1
- package/dist/13.jclic-node.js +0 -103
- package/dist/13.jclic-node.js.map +0 -1
- package/dist/1567.jclic-node.js +0 -2313
- package/dist/1567.jclic-node.js.map +0 -1
- package/dist/1588.jclic-node.js +0 -602
- package/dist/1588.jclic-node.js.map +0 -1
- package/dist/1725.jclic-node.js +0 -836
- package/dist/1725.jclic-node.js.map +0 -1
- package/dist/1731.jclic-node.js +0 -438
- package/dist/1731.jclic-node.js.map +0 -1
- package/dist/1842.jclic-node.js +0 -651
- package/dist/1842.jclic-node.js.map +0 -1
- package/dist/2160.jclic-node.js +0 -1016
- package/dist/2160.jclic-node.js.map +0 -1
- package/dist/222.jclic-node.js +0 -129
- package/dist/222.jclic-node.js.map +0 -1
- package/dist/2316.jclic-node.js +0 -949
- package/dist/2316.jclic-node.js.map +0 -1
- package/dist/2355.jclic-node.js +0 -371
- package/dist/2355.jclic-node.js.map +0 -1
- package/dist/2366.jclic-node.js +0 -431
- package/dist/2366.jclic-node.js.map +0 -1
- package/dist/2379.jclic-node.js +0 -202
- package/dist/2379.jclic-node.js.map +0 -1
- package/dist/2437.jclic-node.js +0 -450
- package/dist/2437.jclic-node.js.map +0 -1
- package/dist/2531.jclic-node.js +0 -869
- package/dist/2531.jclic-node.js.map +0 -1
- package/dist/2608.jclic-node.js +0 -160
- package/dist/2608.jclic-node.js.map +0 -1
- package/dist/2715.jclic-node.js +0 -554
- package/dist/2715.jclic-node.js.map +0 -1
- package/dist/277.jclic-node.js +0 -22
- package/dist/277.jclic-node.js.map +0 -1
- package/dist/2921.jclic-node.js +0 -660
- package/dist/2921.jclic-node.js.map +0 -1
- package/dist/2952.jclic-node.js +0 -101
- package/dist/2952.jclic-node.js.map +0 -1
- package/dist/3018.jclic-node.js +0 -421
- package/dist/3018.jclic-node.js.map +0 -1
- package/dist/3019.jclic-node.js +0 -682
- package/dist/3019.jclic-node.js.map +0 -1
- package/dist/3231.jclic-node.js +0 -274
- package/dist/3231.jclic-node.js.map +0 -1
- package/dist/331.jclic-node.js +0 -115
- package/dist/331.jclic-node.js.map +0 -1
- package/dist/3391.jclic-node.js +0 -276
- package/dist/3391.jclic-node.js.map +0 -1
- package/dist/3502.jclic-node.js +0 -671
- package/dist/3502.jclic-node.js.map +0 -1
- package/dist/3653.jclic-node.js +0 -982
- package/dist/3653.jclic-node.js.map +0 -1
- package/dist/371.jclic.min.js +0 -2
- package/dist/371.jclic.min.js.map +0 -1
- package/dist/3856.jclic-node.js +0 -575
- package/dist/3856.jclic-node.js.map +0 -1
- package/dist/4112.jclic-node.js +0 -659
- package/dist/4112.jclic-node.js.map +0 -1
- package/dist/4123.jclic-node.js +0 -910
- package/dist/4123.jclic-node.js.map +0 -1
- package/dist/427.jclic-node.js +0 -894
- package/dist/427.jclic-node.js.map +0 -1
- package/dist/4483.jclic-node.js +0 -327
- package/dist/4483.jclic-node.js.map +0 -1
- package/dist/4548.jclic-node.js +0 -1078
- package/dist/4548.jclic-node.js.map +0 -1
- package/dist/466.jclic-node.js +0 -99
- package/dist/466.jclic-node.js.map +0 -1
- package/dist/485.jclic-node.js +0 -783
- package/dist/485.jclic-node.js.map +0 -1
- package/dist/4921.jclic-node.js +0 -500
- package/dist/4921.jclic-node.js.map +0 -1
- package/dist/5091.jclic-node.js +0 -239
- package/dist/5091.jclic-node.js.map +0 -1
- package/dist/520.jclic-node.js +0 -550
- package/dist/520.jclic-node.js.map +0 -1
- package/dist/5312.jclic-node.js +0 -1126
- package/dist/5312.jclic-node.js.map +0 -1
- package/dist/5338.jclic-node.js +0 -212
- package/dist/5338.jclic-node.js.map +0 -1
- package/dist/5344.jclic-node.js +0 -229
- package/dist/5344.jclic-node.js.map +0 -1
- package/dist/5550.jclic-node.js +0 -238
- package/dist/5550.jclic-node.js.map +0 -1
- package/dist/5626.jclic-node.js +0 -614
- package/dist/5626.jclic-node.js.map +0 -1
- package/dist/5977.jclic-node.js +0 -1081
- package/dist/5977.jclic-node.js.map +0 -1
- package/dist/6148.jclic-node.js +0 -345
- package/dist/6148.jclic-node.js.map +0 -1
- package/dist/6176.jclic-node.js +0 -481
- package/dist/6176.jclic-node.js.map +0 -1
- package/dist/6221.jclic-node.js +0 -1072
- package/dist/6221.jclic-node.js.map +0 -1
- package/dist/6238.jclic-node.js +0 -718
- package/dist/6238.jclic-node.js.map +0 -1
- package/dist/6454.jclic-node.js +0 -1413
- package/dist/6454.jclic-node.js.map +0 -1
- package/dist/6565.jclic-node.js +0 -294
- package/dist/6565.jclic-node.js.map +0 -1
- package/dist/6579.jclic-node.js +0 -719
- package/dist/6579.jclic-node.js.map +0 -1
- package/dist/6715.jclic-node.js +0 -148
- package/dist/6715.jclic-node.js.map +0 -1
- package/dist/6777.jclic-node.js +0 -171
- package/dist/6777.jclic-node.js.map +0 -1
- package/dist/6782.jclic-node.js +0 -1611
- package/dist/6782.jclic-node.js.map +0 -1
- package/dist/6847.jclic-node.js +0 -601
- package/dist/6847.jclic-node.js.map +0 -1
- package/dist/6856.jclic-node.js +0 -252
- package/dist/6856.jclic-node.js.map +0 -1
- package/dist/696.jclic-node.js +0 -1821
- package/dist/696.jclic-node.js.map +0 -1
- package/dist/698.jclic-node.js +0 -583
- package/dist/698.jclic-node.js.map +0 -1
- package/dist/704.jclic-node.js +0 -80
- package/dist/704.jclic-node.js.map +0 -1
- package/dist/7046.jclic-node.js +0 -735
- package/dist/7046.jclic-node.js.map +0 -1
- package/dist/7220.jclic-node.js +0 -156
- package/dist/7220.jclic-node.js.map +0 -1
- package/dist/7257.jclic-node.js +0 -931
- package/dist/7257.jclic-node.js.map +0 -1
- package/dist/743.jclic-node.js +0 -583
- package/dist/743.jclic-node.js.map +0 -1
- package/dist/757.jclic-node.js +0 -1072
- package/dist/757.jclic-node.js.map +0 -1
- package/dist/7781.jclic-node.js +0 -202
- package/dist/7781.jclic-node.js.map +0 -1
- package/dist/7912.jclic-node.js +0 -2103
- package/dist/7912.jclic-node.js.map +0 -1
- package/dist/827.jclic-node.js +0 -708
- package/dist/827.jclic-node.js.map +0 -1
- package/dist/8276.jclic-node.js +0 -409
- package/dist/8276.jclic-node.js.map +0 -1
- package/dist/8322.jclic-node.js +0 -498
- package/dist/8322.jclic-node.js.map +0 -1
- package/dist/8641.jclic-node.js +0 -360
- package/dist/8641.jclic-node.js.map +0 -1
- package/dist/8837.jclic-node.js +0 -651
- package/dist/8837.jclic-node.js.map +0 -1
- package/dist/8895.jclic-node.js +0 -151
- package/dist/8895.jclic-node.js.map +0 -1
- package/dist/9072.jclic-node.js +0 -1285
- package/dist/9072.jclic-node.js.map +0 -1
- package/dist/9078.jclic-node.js +0 -935
- package/dist/9078.jclic-node.js.map +0 -1
- package/dist/9103.jclic-node.js +0 -718
- package/dist/9103.jclic-node.js.map +0 -1
- package/dist/9359.jclic-node.js +0 -145
- package/dist/9359.jclic-node.js.map +0 -1
- package/dist/9409.jclic-node.js +0 -921
- package/dist/9409.jclic-node.js.map +0 -1
- package/dist/9513.jclic-node.js +0 -720
- package/dist/9513.jclic-node.js.map +0 -1
- package/dist/9704.jclic-node.js +0 -81
- package/dist/9704.jclic-node.js.map +0 -1
- package/dist/9950.jclic-node.js +0 -827
- package/dist/9950.jclic-node.js.map +0 -1
package/dist/3856.jclic-node.js
DELETED
|
@@ -1,575 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 3856;
|
|
3
|
-
exports.ids = [3856,7781];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 3856:
|
|
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 Identify, IdentifyPanel */
|
|
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
|
-
/**
|
|
20
|
-
* File : activities/panels/Identify.js
|
|
21
|
-
* Created : 03/06/2015
|
|
22
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
23
|
-
*
|
|
24
|
-
* JClic.js
|
|
25
|
-
* An HTML5 player of JClic activities
|
|
26
|
-
* https://projectestac.github.io/jclic.js
|
|
27
|
-
*
|
|
28
|
-
* @source https://github.com/projectestac/jclic.js
|
|
29
|
-
*
|
|
30
|
-
* @license EUPL-1.2
|
|
31
|
-
* @licstart
|
|
32
|
-
* (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
|
|
33
|
-
*
|
|
34
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
35
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
36
|
-
* You may not use this work except in compliance with the Licence.
|
|
37
|
-
*
|
|
38
|
-
* You may obtain a copy of the Licence at:
|
|
39
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
40
|
-
*
|
|
41
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
43
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
44
|
-
* Licence for the specific language governing permissions and limitations
|
|
45
|
-
* under the Licence.
|
|
46
|
-
* @licend
|
|
47
|
-
* @module
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
/* global window */
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The aim of this type of {@link module:Activity.Activity Activity} is to identify {@link module:boxes/ActiveBox.ActiveBox ActiveBox} elements in a panel
|
|
60
|
-
* that satisfy a specific condition, usually exposed in the main message.
|
|
61
|
-
* @extends module:Activity.Activity
|
|
62
|
-
*/
|
|
63
|
-
class Identify extends _Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .Activity */ .I {
|
|
64
|
-
/**
|
|
65
|
-
* Identify constructor
|
|
66
|
-
* @param {module:project/JClicProject.JClicProject} project - The {@link module:project/JClicProject.JClicProject JClicProject} to which this activity belongs
|
|
67
|
-
*/
|
|
68
|
-
constructor(project) {
|
|
69
|
-
super(project);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Retrieves the minimum number of actions needed to solve this activity
|
|
74
|
-
* @override
|
|
75
|
-
* @returns {number}
|
|
76
|
-
*/
|
|
77
|
-
getMinNumActions() {
|
|
78
|
-
return this.cellsToMatch;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Whether or not the activity uses random to shuffle internal components
|
|
83
|
-
* @override
|
|
84
|
-
* @returns {boolean}
|
|
85
|
-
*/
|
|
86
|
-
hasRandom() {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
Object.assign(Identify.prototype, {
|
|
92
|
-
/**
|
|
93
|
-
* Number of not assigned cells (calculated in {@link module:activities/panels/Identify.IdentifyPanel#buildVisualComponents buildVisualComponents})
|
|
94
|
-
* @name module:activities/panels/Identify.Identify#nonAssignedCells
|
|
95
|
-
* @type {number} */
|
|
96
|
-
nonAssignedCells: 0,
|
|
97
|
-
/**
|
|
98
|
-
* Number of cells the user must identify to complete the activity (calculated in
|
|
99
|
-
* {@link module:activities/panels/Identify.IdentifyPanel#buildVisualComponents buildVisualComponents})
|
|
100
|
-
* @name module:activities/panels/Identify.Identify#cellsToMatch
|
|
101
|
-
* @type {number} */
|
|
102
|
-
cellsToMatch: 1,
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The {@link module:Activity.ActivityPanel ActivityPanel} where {@link module:activities/panels/Identify.Identify Identify} activities are played.
|
|
107
|
-
* @extends module:Activity.ActivityPanel
|
|
108
|
-
*/
|
|
109
|
-
class IdentifyPanel extends _Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .ActivityPanel */ .S {
|
|
110
|
-
/**
|
|
111
|
-
* IdentifyPanel constructor
|
|
112
|
-
* @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs
|
|
113
|
-
* @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the
|
|
114
|
-
* [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.
|
|
115
|
-
* @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy
|
|
116
|
-
*/
|
|
117
|
-
constructor(act, ps, $div) {
|
|
118
|
-
super(act, ps, $div);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Miscellaneous cleaning operations
|
|
123
|
-
* @override
|
|
124
|
-
*/
|
|
125
|
-
clear() {
|
|
126
|
-
if (this.bg) {
|
|
127
|
-
this.bg.end();
|
|
128
|
-
this.bg = null;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Prepares the visual components of the activity
|
|
134
|
-
* @override
|
|
135
|
-
*/
|
|
136
|
-
buildVisualComponents() {
|
|
137
|
-
if (this.firstRun)
|
|
138
|
-
super.buildVisualComponents();
|
|
139
|
-
this.clear();
|
|
140
|
-
const
|
|
141
|
-
abc = this.act.abc['primary'],
|
|
142
|
-
solved = this.act.abc['solvedPrimary'];
|
|
143
|
-
if (abc) {
|
|
144
|
-
if (abc.image) {
|
|
145
|
-
abc.setImgContent(this.act.project.mediaBag, null, false);
|
|
146
|
-
if (abc.animatedGifFile && !abc.shaper.rectangularShapes && !this.act.shuffleA)
|
|
147
|
-
this.$animatedBg = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span/>').css({
|
|
148
|
-
'background-image': `url(${abc.animatedGifFile})`,
|
|
149
|
-
'background-position': 'center',
|
|
150
|
-
'background-repeat': 'no-repeat',
|
|
151
|
-
position: 'absolute'
|
|
152
|
-
}).appendTo(this.$div);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (solved && solved.image)
|
|
156
|
-
solved.setImgContent(this.act.project.mediaBag, null, false);
|
|
157
|
-
|
|
158
|
-
if (this.act.acp !== null) {
|
|
159
|
-
const contentKit = [abc];
|
|
160
|
-
if (solved) {
|
|
161
|
-
contentKit.push(null);
|
|
162
|
-
contentKit.push(solved);
|
|
163
|
-
}
|
|
164
|
-
this.act.acp.generateContent(abc.nch, abc.ncw, contentKit, false);
|
|
165
|
-
}
|
|
166
|
-
this.bg = _boxes_ActiveBoxGrid_js__WEBPACK_IMPORTED_MODULE_2__["default"].createEmptyGrid(null, this,
|
|
167
|
-
this.act.margin, this.act.margin,
|
|
168
|
-
abc);
|
|
169
|
-
this.bg.setContent(abc, solved || null);
|
|
170
|
-
this.bg.setAlternative(false);
|
|
171
|
-
if (this.$animatedBg)
|
|
172
|
-
this.bg.setCellAttr('tmpTrans', true);
|
|
173
|
-
this.bg.setDefaultIdAss();
|
|
174
|
-
this.act.nonAssignedCells = 0;
|
|
175
|
-
this.act.cellsToMatch = 0;
|
|
176
|
-
const n = this.bg.getNumCells();
|
|
177
|
-
for (let i = 0; i < n; i++) {
|
|
178
|
-
const
|
|
179
|
-
bx = this.bg.getActiveBox(i),
|
|
180
|
-
id = bx.idAss;
|
|
181
|
-
if (id === 1)
|
|
182
|
-
this.act.cellsToMatch++;
|
|
183
|
-
else if (id === -1) {
|
|
184
|
-
this.act.nonAssignedCells++;
|
|
185
|
-
bx.switchToAlt(this.ps);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
this.bg.setVisible(true);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Basic initialization procedure
|
|
194
|
-
* @override
|
|
195
|
-
*/
|
|
196
|
-
initActivity() {
|
|
197
|
-
super.initActivity();
|
|
198
|
-
if (!this.firstRun)
|
|
199
|
-
this.buildVisualComponents();
|
|
200
|
-
else
|
|
201
|
-
this.firstRun = false;
|
|
202
|
-
|
|
203
|
-
if (this.bg) {
|
|
204
|
-
if (this.act.shuffleA)
|
|
205
|
-
this.shuffle([this.bg], true, true);
|
|
206
|
-
|
|
207
|
-
if (this.useOrder)
|
|
208
|
-
this.currentItem = this.bg.getNextItem(-1);
|
|
209
|
-
|
|
210
|
-
this.setAndPlayMsg('initial', 'start');
|
|
211
|
-
this.invalidate().update();
|
|
212
|
-
this.playing = true;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Updates the graphic content of this panel.
|
|
218
|
-
* This method will be called from {@link module:AWT.Container#update} when needed.
|
|
219
|
-
* @override
|
|
220
|
-
* @param {module:AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
|
|
221
|
-
* it's the whole panel.
|
|
222
|
-
*/
|
|
223
|
-
updateContent(dirtyRegion) {
|
|
224
|
-
super.updateContent(dirtyRegion);
|
|
225
|
-
|
|
226
|
-
if (this.bg && this.$canvas) {
|
|
227
|
-
const
|
|
228
|
-
canvas = this.$canvas.get(-1),
|
|
229
|
-
ctx = canvas.getContext('2d');
|
|
230
|
-
if (!dirtyRegion)
|
|
231
|
-
dirtyRegion = new _AWT_js__WEBPACK_IMPORTED_MODULE_4__/* .Rectangle */ .M_(0, 0, canvas.width, canvas.height);
|
|
232
|
-
ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
|
|
233
|
-
this.bg.update(ctx, dirtyRegion);
|
|
234
|
-
}
|
|
235
|
-
return super.updateContent(dirtyRegion);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Sets the real dimension of this panel.
|
|
240
|
-
* @override
|
|
241
|
-
* @param {module:AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
|
|
242
|
-
* @returns {module:AWT.Dimension}
|
|
243
|
-
*/
|
|
244
|
-
setDimension(preferredMaxSize) {
|
|
245
|
-
return this.getBounds().equals(preferredMaxSize) ?
|
|
246
|
-
preferredMaxSize :
|
|
247
|
-
_boxes_BoxBag_js__WEBPACK_IMPORTED_MODULE_3__["default"].layoutSingle(preferredMaxSize, this.bg, this.act.margin);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Sets the size and position of this activity panel
|
|
252
|
-
* @override
|
|
253
|
-
* @param {module:AWT.Rectangle} rect
|
|
254
|
-
*/
|
|
255
|
-
setBounds(rect) {
|
|
256
|
-
if (this.$canvas)
|
|
257
|
-
this.$canvas.remove();
|
|
258
|
-
|
|
259
|
-
super.setBounds(rect);
|
|
260
|
-
if (this.bg) {
|
|
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
|
-
// Resize animated gif background
|
|
267
|
-
if (this.$animatedBg) {
|
|
268
|
-
const bgRect = this.bg.getBounds();
|
|
269
|
-
this.$animatedBg.css({
|
|
270
|
-
left: bgRect.pos.x,
|
|
271
|
-
top: bgRect.pos.y,
|
|
272
|
-
width: `${bgRect.dim.width}px`,
|
|
273
|
-
height: `${bgRect.dim.height}px`,
|
|
274
|
-
'background-size': `${bgRect.dim.width}px ${bgRect.dim.height}px`
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
this.$div.append(this.$canvas);
|
|
278
|
-
this.invalidate().update();
|
|
279
|
-
window.setTimeout(() => this.bg ? this.bg.buildAccessibleElements(this.$canvas, this.$div) : null, 0);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Builds the accessible components needed for this ActivityPanel
|
|
285
|
-
* This method is called when all main elements are placed and visible, when the activity is ready
|
|
286
|
-
* to start or when resized.
|
|
287
|
-
* @override
|
|
288
|
-
*/
|
|
289
|
-
buildAccessibleComponents() {
|
|
290
|
-
if (this.bg && this.$canvas && this.accessibleCanvas) {
|
|
291
|
-
super.buildAccessibleComponents();
|
|
292
|
-
this.bg.buildAccessibleElements(this.$canvas, this.$div);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Main handler used to process mouse, touch, keyboard and edit events
|
|
298
|
-
* @override
|
|
299
|
-
* @param {external:Event} event - The HTML event to be processed
|
|
300
|
-
* @returns {boolean} - When this event handler returns `false`, jQuery will stop its
|
|
301
|
-
* propagation through the DOM tree. See: {@link http://api.jquery.com/on}
|
|
302
|
-
*/
|
|
303
|
-
processEvent(event) {
|
|
304
|
-
if (this.playing) {
|
|
305
|
-
const p = new _AWT_js__WEBPACK_IMPORTED_MODULE_4__/* .Point */ .bR(
|
|
306
|
-
event.pageX - this.$div.offset().left,
|
|
307
|
-
event.pageY - this.$div.offset().top);
|
|
308
|
-
// Flag for assuring that only one media plays per event (avoid event sounds overlapping
|
|
309
|
-
// cell's media sounds)
|
|
310
|
-
let m = false;
|
|
311
|
-
// Array to be filled with actions to be executed at the end of event processing
|
|
312
|
-
const delayedActions = [];
|
|
313
|
-
|
|
314
|
-
switch (event.type) {
|
|
315
|
-
case 'click':
|
|
316
|
-
this.ps.stopMedia(1);
|
|
317
|
-
// Find the box behind the clicked point
|
|
318
|
-
const bx = this.bg ? this.bg.findActiveBox(p) : null;
|
|
319
|
-
if (bx) {
|
|
320
|
-
if (bx.idAss !== -1) {
|
|
321
|
-
// Check if it's a valid move
|
|
322
|
-
let ok = false;
|
|
323
|
-
const src = bx.getDescription();
|
|
324
|
-
m = m || bx.playMedia(this.ps, delayedActions);
|
|
325
|
-
if (bx.idAss === 1 && (!this.act.useOrder || bx.idOrder === this.currentItem)) {
|
|
326
|
-
ok = true;
|
|
327
|
-
bx.idAss = -1;
|
|
328
|
-
if (bx.switchToAlt(this.ps))
|
|
329
|
-
m = m || bx.playMedia(this.ps, delayedActions);
|
|
330
|
-
else
|
|
331
|
-
bx.clear();
|
|
332
|
-
if (this.act.useOrder)
|
|
333
|
-
this.currentItem = this.bg.getNextItem(this.currentItem, 1);
|
|
334
|
-
}
|
|
335
|
-
const cellsOk = this.bg.countCellsWithIdAss(-1);
|
|
336
|
-
this.ps.reportNewAction(this.act, 'SELECT', src, null, ok, cellsOk - this.act.nonAssignedCells);
|
|
337
|
-
if (ok && cellsOk === this.act.cellsToMatch + this.act.nonAssignedCells)
|
|
338
|
-
this.finishActivity(true);
|
|
339
|
-
else if (!m)
|
|
340
|
-
this.playEvent(ok ? 'actionOk' : 'actionError');
|
|
341
|
-
this.update();
|
|
342
|
-
} else {
|
|
343
|
-
this.playEvent('actionError');
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
348
|
-
delayedActions.forEach(action => action());
|
|
349
|
-
event.preventDefault();
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
Object.assign(IdentifyPanel.prototype, {
|
|
355
|
-
/**
|
|
356
|
-
* The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} containing the information to be displayed on the panel.
|
|
357
|
-
* @name module:activities/panels/Identify.IdentifyPanel#bg
|
|
358
|
-
* @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */
|
|
359
|
-
bg: null,
|
|
360
|
-
/**
|
|
361
|
-
* List of mouse, touch and keyboard events intercepted by this panel
|
|
362
|
-
* @override
|
|
363
|
-
* @name module:activities/panels/Identify.IdentifyPanel#events
|
|
364
|
-
* @type {string[]} */
|
|
365
|
-
events: ['click'],
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Panel class associated to this type of activity: {@link module:activities/panels/Identify.IdentifyPanel IdentifyPanel}
|
|
370
|
-
* @type {class} */
|
|
371
|
-
Identify.Panel = IdentifyPanel;
|
|
372
|
-
|
|
373
|
-
// Register activity class
|
|
374
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .Activity */ .I.registerClass('@panels.Identify', Identify));
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
/***/ }),
|
|
378
|
-
|
|
379
|
-
/***/ 7781:
|
|
380
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
381
|
-
|
|
382
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
383
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
384
|
-
/* harmony export */ });
|
|
385
|
-
/* unused harmony export ActiveBoxGrid */
|
|
386
|
-
/* harmony import */ var _ActiveBoxBag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(427);
|
|
387
|
-
/* harmony import */ var _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1725);
|
|
388
|
-
/* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7912);
|
|
389
|
-
/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1253);
|
|
390
|
-
/**
|
|
391
|
-
* File : boxes/ActiveBoxGrid.js
|
|
392
|
-
* Created : 19/05/2015
|
|
393
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
394
|
-
*
|
|
395
|
-
* JClic.js
|
|
396
|
-
* An HTML5 player of JClic activities
|
|
397
|
-
* https://projectestac.github.io/jclic.js
|
|
398
|
-
*
|
|
399
|
-
* @source https://github.com/projectestac/jclic.js
|
|
400
|
-
*
|
|
401
|
-
* @license EUPL-1.2
|
|
402
|
-
* @licstart
|
|
403
|
-
* (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
|
|
404
|
-
*
|
|
405
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
406
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
407
|
-
* You may not use this work except in compliance with the Licence.
|
|
408
|
-
*
|
|
409
|
-
* You may obtain a copy of the Licence at:
|
|
410
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
411
|
-
*
|
|
412
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
413
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
414
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
415
|
-
* Licence for the specific language governing permissions and limitations
|
|
416
|
-
* under the Licence.
|
|
417
|
-
* @licend
|
|
418
|
-
* @module
|
|
419
|
-
*/
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* This class extends {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} with constructors that take an argument of type
|
|
428
|
-
* {@link module:shapers/Shaper.Shaper Shaper} used to build all its {@link module:boxes/ActiveBox.ActiveBox ActiveBox}components. It also maintains information
|
|
429
|
-
* about the number of "rows" and "columns", useful to compute valid (integer) values when
|
|
430
|
-
* resizing or moving its components.
|
|
431
|
-
* @extends module:boxes/ActiveBoxBag.ActiveBoxBag
|
|
432
|
-
*/
|
|
433
|
-
class ActiveBoxGrid extends _ActiveBoxBag_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
434
|
-
/**
|
|
435
|
-
* ActiveBxGrid constructor
|
|
436
|
-
* @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs
|
|
437
|
-
* @param {module:AWT.Container} container - The container where this box grid is placed.
|
|
438
|
-
* @param {module:boxes/BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
|
|
439
|
-
* @param {number} px - `X` coordinate of the upper left corner of this box grid
|
|
440
|
-
* @param {number} py - `Y` coordinate of the upper left corner of this box grid
|
|
441
|
-
* @param {number} setWidth - Total width of the box grid
|
|
442
|
-
* @param {number} setHeight - Total height of the box grid
|
|
443
|
-
* @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects
|
|
444
|
-
*/
|
|
445
|
-
constructor(parent, container, boxBase, px, py, setWidth, setHeight, sh) {
|
|
446
|
-
// ActiveBoxGrid derives from ActiveBoxBag
|
|
447
|
-
super(parent, container, boxBase);
|
|
448
|
-
|
|
449
|
-
this.nCols = sh.nCols;
|
|
450
|
-
this.nRows = sh.nRows;
|
|
451
|
-
|
|
452
|
-
// This will be the enclosing rectangle of this ActiveBox bag
|
|
453
|
-
const r = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_(
|
|
454
|
-
new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(px, py),
|
|
455
|
-
new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
|
|
456
|
-
Math.round(setWidth / this.nCols) * this.nCols,
|
|
457
|
-
Math.round(setHeight / this.nRows) * this.nRows));
|
|
458
|
-
|
|
459
|
-
// Create all the [ActiveBox](ActiveBox.html) objects based on the
|
|
460
|
-
// shapes provided by the [Shaper](Shaper.html)
|
|
461
|
-
for (let i = 0; i < sh.nCells; i++) {
|
|
462
|
-
const
|
|
463
|
-
tmpSh = sh.getShape(i, r),
|
|
464
|
-
bx = new _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__["default"](this, container, boxBase, i, tmpSh.getBounds());
|
|
465
|
-
if (!sh.rectangularShapes)
|
|
466
|
-
bx.setShape(tmpSh);
|
|
467
|
-
this.addActiveBox(bx);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// If the Shaper has `remainder` (extra space), set the background box of this
|
|
471
|
-
// [BoxBag](BoxBag.html)
|
|
472
|
-
if (sh.hasRemainder) {
|
|
473
|
-
const
|
|
474
|
-
tmpSh = sh.getRemainderShape(r),
|
|
475
|
-
bx = new _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__["default"](this, container, boxBase, 0, tmpSh.getBounds());
|
|
476
|
-
bx.setShape(tmpSh);
|
|
477
|
-
this.setBackgroundBox(bx);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* This factory constructor creates a new empty grid with the number of cells indicated by the
|
|
483
|
-
* {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} `abc`, not filling the cells with any content.
|
|
484
|
-
* @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs
|
|
485
|
-
* @param {module:AWT.Container} container - The container where this box grid is placed.
|
|
486
|
-
* @param {number} px - `X` coordinate of the upper left corner of this box grid
|
|
487
|
-
* @param {number} py - `Y` coordinate of the upper left corner of this box grid
|
|
488
|
-
* @param {module:boxes/ActiveBagContent.ActiveBagContent} abc - Used only to get the number of cells and the shaper (when `sh` is `null`)
|
|
489
|
-
* @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects
|
|
490
|
-
* @param {module:boxes/BoxBase.BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
|
|
491
|
-
* of this box grid are defined.
|
|
492
|
-
* @returns {module:boxes/ActiveBoxGrid.ActiveBoxGrid}
|
|
493
|
-
*/
|
|
494
|
-
static createEmptyGrid(parent, container, px, py, abc, sh, boxBase) {
|
|
495
|
-
const result = abc ? new ActiveBoxGrid(parent, container,
|
|
496
|
-
boxBase || abc.style,
|
|
497
|
-
px, py,
|
|
498
|
-
abc.getTotalWidth(), abc.getTotalHeight(),
|
|
499
|
-
sh || abc.getShaper()) : null;
|
|
500
|
-
|
|
501
|
-
if (result)
|
|
502
|
-
result.setBorder(abc.border);
|
|
503
|
-
|
|
504
|
-
return result;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Gets the minimum size of this grid
|
|
509
|
-
* @returns {module:AWT.Dimension}
|
|
510
|
-
*/
|
|
511
|
-
getMinimumSize() {
|
|
512
|
-
return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
|
|
513
|
-
_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .settings */ .W0.MIN_CELL_SIZE * this.nCols,
|
|
514
|
-
_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .settings */ .W0.MIN_CELL_SIZE * this.nRows);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* Gets a scaled size of this grid, rounded to the nearest integer values
|
|
519
|
-
* @param {number} scale - The scale factor
|
|
520
|
-
* @returns {module:AWT.Dimension}
|
|
521
|
-
*/
|
|
522
|
-
getScaledSize(scale) {
|
|
523
|
-
return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
|
|
524
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .roundTo */ .GB)(scale * this.preferredBounds.dim.width, this.nCols),
|
|
525
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .roundTo */ .GB)(scale * this.preferredBounds.dim.height, this.nRows));
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Returns the logical coordinates of the provided {@link module:boxes/ActiveBox.ActiveBox ActiveBox}.
|
|
530
|
-
* The units of the result are not pixels, but ordinal numbers (relative positions) of columns
|
|
531
|
-
* and rows in the grid.
|
|
532
|
-
* @param {module:boxes/ActiveBox.ActiveBox} bx - The box to process
|
|
533
|
-
* @returns {module:AWT.Point}
|
|
534
|
-
*/
|
|
535
|
-
getCoord(bx) {
|
|
536
|
-
return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(bx.idLoc % this.nCols, Math.floor(bx.idLoc / this.nCols));
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Calculates the logical distance between two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects.
|
|
541
|
-
* Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows
|
|
542
|
-
* in the grid.
|
|
543
|
-
* @param {module:boxes/ActiveBox.ActiveBox} src - First box
|
|
544
|
-
* @param {module:boxes/ActiveBox.ActiveBox} dest - Second box
|
|
545
|
-
* @returns {module:AWT.Point}
|
|
546
|
-
*/
|
|
547
|
-
getCoordDist(src, dest) {
|
|
548
|
-
const
|
|
549
|
-
ptSrc = this.getCoord(src),
|
|
550
|
-
ptDest = this.getCoord(dest);
|
|
551
|
-
return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(ptDest.x - ptSrc.x, ptDest.y - ptSrc.y);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
Object.assign(ActiveBoxGrid.prototype, {
|
|
556
|
-
/**
|
|
557
|
-
* Number of columns of this box grid
|
|
558
|
-
* @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nCols
|
|
559
|
-
* @type {number} */
|
|
560
|
-
nCols: 1,
|
|
561
|
-
/**
|
|
562
|
-
* Number of rows of this box grid
|
|
563
|
-
* @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nRows
|
|
564
|
-
* @type {number} */
|
|
565
|
-
nRows: 1,
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ActiveBoxGrid);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
/***/ })
|
|
572
|
-
|
|
573
|
-
};
|
|
574
|
-
;
|
|
575
|
-
//# sourceMappingURL=3856.jclic-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3856.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;;AAEA;;AAEuB;AACqC;AACH;AACd;AACK;;AAEhD;AACA,4BAA4B,yCAAyC,gBAAgB,kDAAkD;AACvI;AACA;AACA;AACO,uBAAuB,2DAAQ;AACtC;AACA;AACA,aAAa,0CAA0C,eAAe,6DAA6D;AACnI;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kDAAkD,kGAAkG;AACpJ;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA,MAAM,kGAAkG;AACxG;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED;AACA,QAAQ,mDAAmD,OAAO,2DAA2D;AAC7H;AACA;AACO,4BAA4B,gEAAa;AAChD;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F,aAAa,gCAAgC;AAC7C;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,6CAAC;AAC9B,uCAAuC,oBAAoB;AAC3D;AACA;AACA;AACA,WAAW;AACX;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,+DAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,mCAAmC;AACzE;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,wDAAS;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC,eAAe;AACf;AACA;AACA;AACA;AACA,MAAM,wDAAM;AACZ;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,6CAAC,mBAAmB,eAAe,YAAY,gBAAgB;AACpF;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC,qBAAqB,kBAAkB;AACvC,gCAAgC,iBAAiB,KAAK,kBAAkB;AACxE,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B,eAAe,SAAS;AACxB,6CAA6C;AAC7C;AACA;AACA;AACA,oBAAoB,oDAAK;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,2DAA2D;AACrE;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA,CAAC;;AAED;AACA,qDAAqD;AACrD,UAAU,OAAO;AACjB;;AAEA;AACA,iEAAe,2DAAQ,4CAA4C,EAAC;;;;;;;;;;;;;;;;ACnWpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE6C;AACN;AACiB;AACR;;AAEhD;AACA,uBAAuB,2DAA2D;AAClF,IAAI,2CAA2C,uBAAuB,iDAAiD;AACvH;AACA;AACA;AACA;AACO,4BAA4B,wDAAY;AAC/C;AACA;AACA,aAAa,sCAAsC;AACnD,aAAa,sBAAsB;AACnC,aAAa,sBAAsB;AACnC,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,wDAAS;AAC3B,UAAU,oDAAK;AACf,UAAU,wDAAS;AACnB;AACA;;AAEA;AACA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA,iBAAiB,qDAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,qDAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,uEAAuE;AAC7E,aAAa,sCAAsC;AACnD,aAAa,sBAAsB;AACnC,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,gDAAgD;AAC7D,aAAa,8BAA8B;AAC3C,aAAa,8BAA8B;AAC3C;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB,MAAM,yDAAQ;AACd,MAAM,yDAAQ;AACd;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB,MAAM,4DAAO;AACb,MAAM,4DAAO;AACb;;AAEA;AACA,sDAAsD,iDAAiD;AACvG;AACA;AACA,aAAa,kCAAkC;AAC/C,eAAe;AACf;AACA;AACA,eAAe,oDAAK;AACpB;;AAEA;AACA,kDAAkD,kDAAkD;AACpG;AACA;AACA,aAAa,kCAAkC;AAC/C,aAAa,kCAAkC;AAC/C,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,eAAe,oDAAK;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED,iEAAe,aAAa,EAAC","sources":["webpack://jclic/./src/activities/panels/Identify.js","webpack://jclic/./src/boxes/ActiveBoxGrid.js"],"sourcesContent":["/**\n * File : activities/panels/Identify.js\n * Created : 03/06/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\n/* global window */\n\nimport $ from 'jquery';\nimport { Activity, ActivityPanel } from '../../Activity.js';\nimport ActiveBoxGrid from '../../boxes/ActiveBoxGrid.js';\nimport BoxBag from '../../boxes/BoxBag.js';\nimport { Rectangle, Point } from '../../AWT.js';\n\n/**\n * The aim of this type of {@link module:Activity.Activity Activity} is to identify {@link module:boxes/ActiveBox.ActiveBox ActiveBox} elements in a panel\n * that satisfy a specific condition, usually exposed in the main message.\n * @extends module:Activity.Activity\n */\nexport class Identify extends Activity {\n /**\n * Identify constructor\n * @param {module:project/JClicProject.JClicProject} project - The {@link module:project/JClicProject.JClicProject JClicProject} to which this activity belongs\n */\n constructor(project) {\n super(project);\n }\n\n /**\n * Retrieves the minimum number of actions needed to solve this activity\n * @override\n * @returns {number}\n */\n getMinNumActions() {\n return this.cellsToMatch;\n }\n\n /**\n * Whether or not the activity uses random to shuffle internal components\n * @override\n * @returns {boolean}\n */\n hasRandom() {\n return true;\n }\n}\n\nObject.assign(Identify.prototype, {\n /**\n * Number of not assigned cells (calculated in {@link module:activities/panels/Identify.IdentifyPanel#buildVisualComponents buildVisualComponents})\n * @name module:activities/panels/Identify.Identify#nonAssignedCells\n * @type {number} */\n nonAssignedCells: 0,\n /**\n * Number of cells the user must identify to complete the activity (calculated in\n * {@link module:activities/panels/Identify.IdentifyPanel#buildVisualComponents buildVisualComponents})\n * @name module:activities/panels/Identify.Identify#cellsToMatch\n * @type {number} */\n cellsToMatch: 1,\n});\n\n/**\n * The {@link module:Activity.ActivityPanel ActivityPanel} where {@link module:activities/panels/Identify.Identify Identify} activities are played.\n * @extends module:Activity.ActivityPanel\n */\nexport class IdentifyPanel extends ActivityPanel {\n /**\n * IdentifyPanel constructor\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs\n * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the\n * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.\n * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy\n */\n constructor(act, ps, $div) {\n super(act, ps, $div);\n }\n\n /**\n * Miscellaneous cleaning operations\n * @override\n */\n clear() {\n if (this.bg) {\n this.bg.end();\n this.bg = null;\n }\n }\n\n /**\n * Prepares the visual components of the activity\n * @override\n */\n buildVisualComponents() {\n if (this.firstRun)\n super.buildVisualComponents();\n this.clear();\n const\n abc = this.act.abc['primary'],\n solved = this.act.abc['solvedPrimary'];\n if (abc) {\n if (abc.image) {\n abc.setImgContent(this.act.project.mediaBag, null, false);\n if (abc.animatedGifFile && !abc.shaper.rectangularShapes && !this.act.shuffleA)\n this.$animatedBg = $('<span/>').css({\n 'background-image': `url(${abc.animatedGifFile})`,\n 'background-position': 'center',\n 'background-repeat': 'no-repeat',\n position: 'absolute'\n }).appendTo(this.$div);\n }\n\n if (solved && solved.image)\n solved.setImgContent(this.act.project.mediaBag, null, false);\n\n if (this.act.acp !== null) {\n const contentKit = [abc];\n if (solved) {\n contentKit.push(null);\n contentKit.push(solved);\n }\n this.act.acp.generateContent(abc.nch, abc.ncw, contentKit, false);\n }\n this.bg = ActiveBoxGrid.createEmptyGrid(null, this,\n this.act.margin, this.act.margin,\n abc);\n this.bg.setContent(abc, solved || null);\n this.bg.setAlternative(false);\n if (this.$animatedBg)\n this.bg.setCellAttr('tmpTrans', true);\n this.bg.setDefaultIdAss();\n this.act.nonAssignedCells = 0;\n this.act.cellsToMatch = 0;\n const n = this.bg.getNumCells();\n for (let i = 0; i < n; i++) {\n const\n bx = this.bg.getActiveBox(i),\n id = bx.idAss;\n if (id === 1)\n this.act.cellsToMatch++;\n else if (id === -1) {\n this.act.nonAssignedCells++;\n bx.switchToAlt(this.ps);\n }\n }\n this.bg.setVisible(true);\n }\n }\n\n /**\n * Basic initialization procedure\n * @override\n */\n initActivity() {\n super.initActivity();\n if (!this.firstRun)\n this.buildVisualComponents();\n else\n this.firstRun = false;\n\n if (this.bg) {\n if (this.act.shuffleA)\n this.shuffle([this.bg], true, true);\n\n if (this.useOrder)\n this.currentItem = this.bg.getNextItem(-1);\n\n this.setAndPlayMsg('initial', 'start');\n this.invalidate().update();\n this.playing = true;\n }\n }\n\n /**\n * Updates the graphic content of this panel.\n * This method will be called from {@link module:AWT.Container#update} when needed.\n * @override\n * @param {module:AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,\n * it's the whole panel.\n */\n updateContent(dirtyRegion) {\n super.updateContent(dirtyRegion);\n\n if (this.bg && this.$canvas) {\n const\n canvas = this.$canvas.get(-1),\n ctx = canvas.getContext('2d');\n if (!dirtyRegion)\n dirtyRegion = new Rectangle(0, 0, canvas.width, canvas.height);\n ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);\n this.bg.update(ctx, dirtyRegion);\n }\n return super.updateContent(dirtyRegion);\n }\n\n /**\n * Sets the real dimension of this panel.\n * @override\n * @param {module:AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel\n * @returns {module:AWT.Dimension}\n */\n setDimension(preferredMaxSize) {\n return this.getBounds().equals(preferredMaxSize) ?\n preferredMaxSize :\n BoxBag.layoutSingle(preferredMaxSize, this.bg, this.act.margin);\n }\n\n /**\n * Sets the size and position of this activity panel\n * @override\n * @param {module:AWT.Rectangle} rect\n */\n setBounds(rect) {\n if (this.$canvas)\n this.$canvas.remove();\n\n super.setBounds(rect);\n if (this.bg) {\n this.$canvas = $(`<canvas width=\"${rect.dim.width}\" height=\"${rect.dim.height}\"/>`).css({\n position: 'absolute',\n top: 0,\n left: 0\n });\n // Resize animated gif background\n if (this.$animatedBg) {\n const bgRect = this.bg.getBounds();\n this.$animatedBg.css({\n left: bgRect.pos.x,\n top: bgRect.pos.y,\n width: `${bgRect.dim.width}px`,\n height: `${bgRect.dim.height}px`,\n 'background-size': `${bgRect.dim.width}px ${bgRect.dim.height}px`\n });\n }\n this.$div.append(this.$canvas);\n this.invalidate().update();\n window.setTimeout(() => this.bg ? this.bg.buildAccessibleElements(this.$canvas, this.$div) : null, 0);\n }\n }\n\n /**\n * Builds the accessible components needed for this ActivityPanel\n * This method is called when all main elements are placed and visible, when the activity is ready\n * to start or when resized.\n * @override\n */\n buildAccessibleComponents() {\n if (this.bg && this.$canvas && this.accessibleCanvas) {\n super.buildAccessibleComponents();\n this.bg.buildAccessibleElements(this.$canvas, this.$div);\n }\n }\n\n /**\n * Main handler used to process mouse, touch, keyboard and edit events\n * @override\n * @param {external:Event} event - The HTML event to be processed\n * @returns {boolean} - When this event handler returns `false`, jQuery will stop its\n * propagation through the DOM tree. See: {@link http://api.jquery.com/on}\n */\n processEvent(event) {\n if (this.playing) {\n const p = new Point(\n event.pageX - this.$div.offset().left,\n event.pageY - this.$div.offset().top);\n // Flag for assuring that only one media plays per event (avoid event sounds overlapping\n // cell's media sounds)\n let m = false;\n // Array to be filled with actions to be executed at the end of event processing\n const delayedActions = [];\n\n switch (event.type) {\n case 'click':\n this.ps.stopMedia(1);\n // Find the box behind the clicked point\n const bx = this.bg ? this.bg.findActiveBox(p) : null;\n if (bx) {\n if (bx.idAss !== -1) {\n // Check if it's a valid move\n let ok = false;\n const src = bx.getDescription();\n m = m || bx.playMedia(this.ps, delayedActions);\n if (bx.idAss === 1 && (!this.act.useOrder || bx.idOrder === this.currentItem)) {\n ok = true;\n bx.idAss = -1;\n if (bx.switchToAlt(this.ps))\n m = m || bx.playMedia(this.ps, delayedActions);\n else\n bx.clear();\n if (this.act.useOrder)\n this.currentItem = this.bg.getNextItem(this.currentItem, 1);\n }\n const cellsOk = this.bg.countCellsWithIdAss(-1);\n this.ps.reportNewAction(this.act, 'SELECT', src, null, ok, cellsOk - this.act.nonAssignedCells);\n if (ok && cellsOk === this.act.cellsToMatch + this.act.nonAssignedCells)\n this.finishActivity(true);\n else if (!m)\n this.playEvent(ok ? 'actionOk' : 'actionError');\n this.update();\n } else {\n this.playEvent('actionError');\n }\n }\n break;\n }\n delayedActions.forEach(action => action());\n event.preventDefault();\n }\n }\n}\n\nObject.assign(IdentifyPanel.prototype, {\n /**\n * The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} containing the information to be displayed on the panel.\n * @name module:activities/panels/Identify.IdentifyPanel#bg\n * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */\n bg: null,\n /**\n * List of mouse, touch and keyboard events intercepted by this panel\n * @override\n * @name module:activities/panels/Identify.IdentifyPanel#events\n * @type {string[]} */\n events: ['click'],\n});\n\n/**\n * Panel class associated to this type of activity: {@link module:activities/panels/Identify.IdentifyPanel IdentifyPanel}\n * @type {class} */\nIdentify.Panel = IdentifyPanel;\n\n// Register activity class\nexport default Activity.registerClass('@panels.Identify', Identify);\n","/**\n * File : boxes/ActiveBoxGrid.js\n * Created : 19/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport ActiveBoxBag from './ActiveBoxBag.js';\nimport ActiveBox from './ActiveBox.js';\nimport { Rectangle, Dimension, Point } from '../AWT.js';\nimport { settings, roundTo } from '../Utils.js';\n\n/**\n * This class extends {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} with constructors that take an argument of type\n * {@link module:shapers/Shaper.Shaper Shaper} used to build all its {@link module:boxes/ActiveBox.ActiveBox ActiveBox}components. It also maintains information\n * about the number of \"rows\" and \"columns\", useful to compute valid (integer) values when\n * resizing or moving its components.\n * @extends module:boxes/ActiveBoxBag.ActiveBoxBag\n */\nexport class ActiveBoxGrid extends ActiveBoxBag {\n /**\n * ActiveBxGrid constructor\n * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs\n * @param {module:AWT.Container} container - The container where this box grid is placed.\n * @param {module:boxes/BoxBase} boxBase - The object where colors, fonts, border and other graphic properties\n * @param {number} px - `X` coordinate of the upper left corner of this box grid\n * @param {number} py - `Y` coordinate of the upper left corner of this box grid\n * @param {number} setWidth - Total width of the box grid\n * @param {number} setHeight - Total height of the box grid\n * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects\n */\n constructor(parent, container, boxBase, px, py, setWidth, setHeight, sh) {\n // ActiveBoxGrid derives from ActiveBoxBag\n super(parent, container, boxBase);\n\n this.nCols = sh.nCols;\n this.nRows = sh.nRows;\n\n // This will be the enclosing rectangle of this ActiveBox bag\n const r = new Rectangle(\n new Point(px, py),\n new Dimension(\n Math.round(setWidth / this.nCols) * this.nCols,\n Math.round(setHeight / this.nRows) * this.nRows));\n\n // Create all the [ActiveBox](ActiveBox.html) objects based on the\n // shapes provided by the [Shaper](Shaper.html)\n for (let i = 0; i < sh.nCells; i++) {\n const\n tmpSh = sh.getShape(i, r),\n bx = new ActiveBox(this, container, boxBase, i, tmpSh.getBounds());\n if (!sh.rectangularShapes)\n bx.setShape(tmpSh);\n this.addActiveBox(bx);\n }\n\n // If the Shaper has `remainder` (extra space), set the background box of this\n // [BoxBag](BoxBag.html)\n if (sh.hasRemainder) {\n const\n tmpSh = sh.getRemainderShape(r),\n bx = new ActiveBox(this, container, boxBase, 0, tmpSh.getBounds());\n bx.setShape(tmpSh);\n this.setBackgroundBox(bx);\n }\n }\n\n /**\n * This factory constructor creates a new empty grid with the number of cells indicated by the\n * {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} `abc`, not filling the cells with any content.\n * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs\n * @param {module:AWT.Container} container - The container where this box grid is placed.\n * @param {number} px - `X` coordinate of the upper left corner of this box grid\n * @param {number} py - `Y` coordinate of the upper left corner of this box grid\n * @param {module:boxes/ActiveBagContent.ActiveBagContent} abc - Used only to get the number of cells and the shaper (when `sh` is `null`)\n * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects\n * @param {module:boxes/BoxBase.BoxBase} boxBase - The object where colors, fonts, border and other graphic properties\n * of this box grid are defined.\n * @returns {module:boxes/ActiveBoxGrid.ActiveBoxGrid}\n */\n static createEmptyGrid(parent, container, px, py, abc, sh, boxBase) {\n const result = abc ? new ActiveBoxGrid(parent, container,\n boxBase || abc.style,\n px, py,\n abc.getTotalWidth(), abc.getTotalHeight(),\n sh || abc.getShaper()) : null;\n\n if (result)\n result.setBorder(abc.border);\n\n return result;\n }\n\n /**\n * Gets the minimum size of this grid\n * @returns {module:AWT.Dimension}\n */\n getMinimumSize() {\n return new Dimension(\n settings.MIN_CELL_SIZE * this.nCols,\n settings.MIN_CELL_SIZE * this.nRows);\n }\n\n /**\n * Gets a scaled size of this grid, rounded to the nearest integer values\n * @param {number} scale - The scale factor\n * @returns {module:AWT.Dimension}\n */\n getScaledSize(scale) {\n return new Dimension(\n roundTo(scale * this.preferredBounds.dim.width, this.nCols),\n roundTo(scale * this.preferredBounds.dim.height, this.nRows));\n }\n\n /**\n * Returns the logical coordinates of the provided {@link module:boxes/ActiveBox.ActiveBox ActiveBox}.\n * The units of the result are not pixels, but ordinal numbers (relative positions) of columns\n * and rows in the grid.\n * @param {module:boxes/ActiveBox.ActiveBox} bx - The box to process\n * @returns {module:AWT.Point}\n */\n getCoord(bx) {\n return new Point(bx.idLoc % this.nCols, Math.floor(bx.idLoc / this.nCols));\n }\n\n /**\n * Calculates the logical distance between two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects.\n * Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows\n * in the grid.\n * @param {module:boxes/ActiveBox.ActiveBox} src - First box\n * @param {module:boxes/ActiveBox.ActiveBox} dest - Second box\n * @returns {module:AWT.Point}\n */\n getCoordDist(src, dest) {\n const\n ptSrc = this.getCoord(src),\n ptDest = this.getCoord(dest);\n return new Point(ptDest.x - ptSrc.x, ptDest.y - ptSrc.y);\n }\n}\n\nObject.assign(ActiveBoxGrid.prototype, {\n /**\n * Number of columns of this box grid\n * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nCols\n * @type {number} */\n nCols: 1,\n /**\n * Number of rows of this box grid\n * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nRows\n * @type {number} */\n nRows: 1,\n});\n\nexport default ActiveBoxGrid;\n"],"names":[],"sourceRoot":""}
|