jclic 2.2.0 → 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 -664
  8. package/TRANSLATIONS.md +0 -11
  9. package/build-locales.mjs +0 -82
  10. package/dist/jclic-node.js +0 -31678
  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 -658
  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,386 +0,0 @@
1
- /**
2
- * File : shapers/Shaper.js
3
- * Created : 13/04/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 { log, attrForEach, getBoolean, getAttr, setAttr } from '../Utils.js';
34
- import { Shape, Rectangle, Ellipse, PathStroke, Path } from '../AWT.js';
35
-
36
- /**
37
- * The function of this class and its subclasses is to draw a set of "shapes" that will be used to
38
- * place {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects at a specific position, and to determine its dimension and
39
- * appearance.
40
- */
41
- export class Shaper {
42
- /**
43
- * Shaper constructor
44
- * @param {number} nx - Number of columns (in grid-based shapers)
45
- * @param {number} ny - Number of rows (in grid-based shapers)
46
- */
47
- constructor(nx, ny) {
48
- this.reset(nx, ny);
49
- }
50
-
51
- /**
52
- * Registers a new type of shaper
53
- * @param {string} shaperName - The name used to identify this shaper
54
- * @param {function} shaperClass - The shaper class, usually extending Shaper
55
- * @returns {module:shapers/Shaper.Shaper} - The provided shaper class
56
- */
57
- static registerClass(shaperName, shaperClass) {
58
- Shaper.CLASSES[shaperName] = shaperClass;
59
- return shaperClass;
60
- }
61
-
62
- /**
63
- * Factory constructor that returns a Shaper of the requested class.
64
- * @param {string} className - The class name of the requested Shaper.
65
- * @param {number} nx - Number of columns (in grid-based shapers)
66
- * @param {number} ny - Number of rows (in grid-based shapers)
67
- * @returns {module:shapers/Shaper.Shaper}
68
- */
69
- static getShaper(className, nx, ny) {
70
- const cl = Shaper.CLASSES[(className || '').replace(/^edu\.xtec\.jclic\.shapers\./, '@')];
71
- if (!cl)
72
- log('error', `Unknown shaper: ${className}`);
73
- return cl ? new cl(nx, ny) : null;
74
- }
75
-
76
- /**
77
- * Initializes this Shaper to default values
78
- * @param {number} nCols - Number of columns
79
- * @param {number} nRows - Number of rows
80
- */
81
- reset(nCols, nRows) {
82
- this.nCols = nCols;
83
- this.nRows = nRows;
84
- this.nCells = nRows * nCols;
85
- this.initiated = false;
86
- this.shapeData = [];
87
- for (let i = 0; i < this.nCells; i++)
88
- this.shapeData[i] = new Shape();
89
- }
90
-
91
- /**
92
- * Loads this shaper settings from a specific JQuery XML element
93
- * @param {external:jQuery} $xml - The XML element with the shaper data
94
- */
95
- setProperties($xml) {
96
- attrForEach($xml.get(0).attributes, (name, value) => {
97
- switch (name) {
98
- case 'class':
99
- this.className = value;
100
- break;
101
- case 'cols':
102
- this.nCols = Number(value);
103
- break;
104
- case 'rows':
105
- this.nRows = Number(value);
106
- break;
107
- case 'baseWidthFactor':
108
- case 'toothHeightFactor':
109
- case 'scaleX':
110
- case 'scaleY':
111
- this[name] = Number(value);
112
- break;
113
- case 'randomLines':
114
- case 'showEnclosure':
115
- this[name] = getBoolean(value, true);
116
- break;
117
- }
118
- });
119
-
120
- // Reads the 'enclosing'
121
- // (main shape area where the other shape elements are placed)
122
- $xml.children('enclosing:first').each((_n, child) => {
123
- $(child).children('shape:first').each((_n, child2) => {
124
- let sh = Shaper.readShapeData(child2, this.scaleX, this.scaleY);
125
- this.enclosing = sh;
126
- this.showEnclosure = true;
127
- this.hasRemainder = true;
128
- });
129
- });
130
-
131
- // Read the shape elements
132
- $xml.children('shape').each((n, child) => {
133
- this.shapeData[n] = Shaper.readShapeData(child, this.scaleX, this.scaleY);
134
- });
135
-
136
- // Correction needed for '@Holes' shaper
137
- if (this.shapeData.length > 0 /* && this.shapeData.length !== this.nRows * this.nCols */) {
138
- //this.nRows = this.shapeData.length
139
- //this.nCols = 1
140
- //this.nCells = this.nCols * this.nRows
141
- this.nCells = this.shapeData.length;
142
- }
143
- return this;
144
- }
145
-
146
- /**
147
- * Reads an individual shape from an XML element.
148
- * Shapes are arrays of `stroke` objects.
149
- * Each `stroke` has an `action` (_move to_, _line to_, _quad to_...) and associated `data`.
150
- * @param {external:jQuery} $xml - The XML element with the shape data
151
- * @param {number} scaleX
152
- * @param {number} scaleY
153
- * @returns {module:AWT.Shape}
154
- */
155
- static readShapeData(xml, scaleX, scaleY) {
156
- const shd = [];
157
- let result = null;
158
- $.each(xml.textContent.split('|'), (_n, txt) => {
159
- const sd = txt.split(':');
160
- // Possible strokes are: `rectangle`, `ellipse`, `M`, `L`, `Q`, `B`, `X`
161
- // Also possible, but not currently used in JClic: `roundRectangle` and `pie`
162
- let data = sd.length > 1 ? sd[1].split(',') : null;
163
- //
164
- // Data should be always divided by the scale (X or Y)
165
- if (data)
166
- data = data.map((d, n) => d / (n % 2 ? scaleY : scaleX));
167
-
168
- switch (sd[0]) {
169
- case 'rectangle':
170
- result = new Rectangle(data[0], data[1], data[2], data[3]);
171
- break;
172
- case 'ellipse':
173
- result = new Ellipse(data[0], data[1], data[2], data[3]);
174
- break;
175
- default:
176
- // It's an `AWT.PathStroke`
177
- shd.push(new PathStroke(sd[0], data));
178
- break;
179
- }
180
- });
181
-
182
- return !result && shd.length > 0 ? new Path(shd) : result;
183
- }
184
-
185
- /**
186
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
187
- * parent references, constants and also attributes retaining the default value.
188
- * The resulting object is commonly usued to serialize elements in JSON format.
189
- * @returns {object} - The resulting object, with minimal attrributes
190
- */
191
- getAttributes() {
192
- const fields = [
193
- 'className', 'nCols', 'nRows',
194
- 'baseWidthFactor', 'toothHeightFactor',
195
- 'scaleX', 'scaleY',
196
- 'randomLines',
197
- ];
198
-
199
- if (this.customShapes) {
200
- ['showEnclosure', 'hasRemainder',
201
- 'enclosing', 'shapeData', // Array of AWT.Rectangle, AWT.Ellipse or (AWT.Path -> AWT.PathStroke)
202
- ].forEach(f => fields.push(f));
203
- }
204
-
205
- return getAttr(this, fields);
206
- }
207
-
208
- /**
209
- * Builds a new shaper, based on the properties specified in a data object
210
- * @param {object} data - The data object to be parsed
211
- * @returns {module:shapers/Shaper.Shaper}
212
- */
213
- static factory(data) {
214
- const result = Shaper.getShaper(data.className, data.nCols, data.nRows);
215
- setAttr(result, data, [
216
- 'className', 'nCols', 'nRows',
217
- 'baseWidthFactor', 'toothHeightFactor',
218
- 'scaleX', 'scaleY',
219
- 'randomLines',
220
- 'showEnclosure', 'hasRemainder',
221
- { key: 'enclosing', fn: Shape },
222
- { key: 'shapeData', fn: Shape, group: 'array' },
223
- ]);
224
-
225
- result.nCells = result.shapeData.length || result.nCols * result.nRows;
226
-
227
- return result;
228
- }
229
-
230
- /**
231
- * Builds the individual shapes that will form this Shaper
232
- */
233
- buildShapes() {
234
- }
235
-
236
- /**
237
- * Gets a clone of the nth Shape object, scaled and located inside a Rectangle
238
- * @param {number} n
239
- * @param {module:AWT.Rectangle} rect
240
- * @returns {module:AWT.Shape}
241
- */
242
- getShape(n, rect) {
243
- if (!this.initiated)
244
- this.buildShapes();
245
- if (n >= this.nCells || this.shapeData[n] === null)
246
- return null;
247
- return this.shapeData[n].getShape(rect);
248
- }
249
-
250
- /**
251
- * Gets the nth Shape data object
252
- * @param {number} n
253
- * @returns {object}
254
- */
255
- getShapeData(n) {
256
- return n >= 0 && n < this.shapeData.length ? this.shapeData[n] : null;
257
- }
258
-
259
- /**
260
- * Gets the AWT.Rectangle that contains all shapes of this Shaper.
261
- * @returns {module:AWT.Rectangle}
262
- */
263
- getEnclosingShapeData() {
264
- return new Rectangle(0, 0, 1, 1);
265
- }
266
-
267
- /**
268
- * When `hasRemainder` is true, this method gets the rectangle containing the full surface where
269
- * the Shaper develops.
270
- * @param {module:AWT.Rectangle} rect - The frame where to move and scale all the shapes
271
- * @returns {module:AWT.Rectangle}
272
- */
273
- getRemainderShape(rect) {
274
- if (!this.hasRemainder)
275
- return null;
276
-
277
- if (!this.initiated)
278
- this.buildShapes();
279
-
280
- const sh = this.getEnclosingShapeData();
281
- const r = sh ? sh.getShape(rect) : new Rectangle();
282
- for (let i = 0; i < this.nCells; i++) {
283
- if (this.shapeData[i])
284
- r.add(this.shapeData[i].getShape(rect), false);
285
- }
286
- return r;
287
- }
288
- }
289
-
290
- Object.assign(Shaper.prototype, {
291
- /**
292
- * This shaper class name
293
- * @name module:shapers/Shaper.Shaper#className
294
- * @type {string} */
295
- className: 'Shaper',
296
- /**
297
- * Number of columns (useful in grid-based shapers)
298
- * @name module:shapers/Shaper.Shaper#nCols
299
- * @type {number} */
300
- nCols: 0,
301
- /**
302
- * Number of rows (useful in grid-based shapers)
303
- * @name module:shapers/Shaper.Shaper#nRows
304
- * @type {number} */
305
- nRows: 0,
306
- /**
307
- * Number of cells managed by this shaper
308
- * @name module:shapers/Shaper.Shaper#nCells
309
- * @type {number} */
310
- nCells: 0,
311
- /**
312
- * Contains the specific definition of each shape
313
- * @name module:shapers/Shaper.Shaper#shapeData
314
- * @type {object} */
315
- shapeData: null,
316
- /**
317
- * Flag used to check if the `Shaper` has been initialized against a real surface
318
- * @name module:shapers/Shaper.Shaper#initiated
319
- * @type {boolean} */
320
- initiated: false,
321
- //
322
- // Fields used only in JigSaw shapers
323
- /**
324
- * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the base width of the tooth and the total length of the side.
325
- * @name module:shapers/Shaper.Shaper#baseWidthFactor
326
- * @type {number} */
327
- baseWidthFactor: 1.0 / 3,
328
- /**
329
- * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the tooth height and the total length of the side.
330
- * @name module:shapers/Shaper.Shaper#toothHeightFactor
331
- * @type {number} */
332
- toothHeightFactor: 1.0 / 6,
333
- /**
334
- * In {@link module:shapers/JigSaw.JigSaw JigSaw}, whether the tooths take random directions or not
335
- * @name module:shapers/Shaper.Shaper#randomLines
336
- * @type {boolean} */
337
- randomLines: false,
338
- //
339
- // Fields used only in the `Holes` shaper
340
- /**
341
- * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to horizontal positions and lengths to achieve the real
342
- * value of the shape placed on a real surface.
343
- * @name module:shapers/Shaper.Shaper#scaleX
344
- * @type {number} */
345
- scaleX: 1.0,
346
- /**
347
- * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to vertical positions and lengths to achieve the real
348
- * value of the shape placed on a real surface.
349
- * @name module:shapers/Shaper.Shaper#scaleY
350
- * @type {number} */
351
- scaleY: 1.0,
352
- /**
353
- * In {@link module:shapers/Holes.Holes Holes}, the enclosing area where all shapes are placed.
354
- * @name module:shapers/Shaper.Shaper#enclosing
355
- * @type {module:AWT.Shape} */
356
- enclosing: null,
357
- /**
358
- * In {@link module:shapers/Holes.Holes Holes}, when `true`, the enclosing area will be drawn
359
- * @name module:shapers/Shaper.Shaper#showEnclosure
360
- * @type {boolean} */
361
- showEnclosure: false,
362
- /**
363
- * Flag indicating if this shaper organizes its cells in rows and columns
364
- * @name module:shapers/Shaper.Shaper#rectangularShapes
365
- * @type {boolean} */
366
- rectangularShapes: false,
367
- /**
368
- * Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
369
- * all its shapes
370
- * @name module:shapers/Shaper.Shaper#hasRemainder
371
- * @type {boolean} */
372
- hasRemainder: false,
373
- /**
374
- * Only the `Holes` shaper has this flag activated
375
- * @name module:shapers/Shaper.Shaper#customShapes
376
- * @type {boolean} */
377
- customShapes: false,
378
- });
379
-
380
- /**
381
- * List of known classes derived from Shaper. It should be filled by real shaper classes at
382
- * declaration time.
383
- * @type {object} */
384
- Shaper.CLASSES = {};
385
-
386
- export default Shaper;
@@ -1,121 +0,0 @@
1
- /**
2
- * File : shapers/TriangularJigSaw.js
3
- * Created : 25/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 Shaper from './Shaper.js';
33
- import JigSaw from './JigSaw.js';
34
- import { PathStroke } from '../AWT.js';
35
-
36
- /**
37
- * This {@link module:shapers/Shaper.Shaper Shaper} returns a set of rectangular shapes with triangular teeth and slots that
38
- * fit between them.
39
- * @extends module:shapers/JigSaw.JigSaw
40
- */
41
- export class TriangularJigSaw extends JigSaw {
42
- /**
43
- * TriangularJigSaw constructor
44
- * @param {number} nx - Number of columns
45
- * @param {number} ny - Number of rows
46
- */
47
- constructor(nx, ny) {
48
- super(nx, ny);
49
- }
50
-
51
- /**
52
- * Overrides {@link module:shapers/JigSaw.JigSaw#hLine}
53
- * @override
54
- * @param {module:AWT.Path} sd - The Path to which the line will be added
55
- * @param {number} type - Type of tooth: 0 is flat (no tooth), 1 means tooth up, and 2 means tooth down
56
- * @param {number} x - X coordinate of the starting point
57
- * @param {number} y - Y coordinate of the starting point
58
- * @param {number} w - Width of the piece
59
- * @param {number} h - Height of the piece
60
- * @param {boolean} inv - The line must be drawn right to left
61
- */
62
- hLine(sd, type, x, y, w, h, inv) {
63
- const
64
- kx = inv ? -1 : 1,
65
- ky = type === 1 ? 1 : -1;
66
-
67
- if (type === 0)
68
- // Flat line
69
- sd.addStroke(new PathStroke('L', [x + w * kx, y]));
70
- else {
71
- const x0 = x + (w - w * this.baseWidthFactor) / 2 * kx;
72
- const wb = w * this.baseWidthFactor * kx;
73
- // Approximation to the tooth:
74
- sd.addStroke(new PathStroke('L', [x0, y]));
75
- // This is the tooth:
76
- const hb = h * this.toothHeightFactor * ky;
77
- sd.addStroke(new PathStroke('L', [x0 + wb / 2, y + hb]));
78
- sd.addStroke(new PathStroke('L', [x0 + wb, y]));
79
- // Draw the remaining line
80
- sd.addStroke(new PathStroke('L', [x + w * kx, y]));
81
- }
82
- }
83
-
84
- /**
85
- * Overrides {@link module:shapers/JigSaw.JigSaw#vLine}
86
- * @override
87
- * @param {module:AWT.Path} sd - The Path to which the line will be added
88
- * @param {number} type - Type of tooth: 0 is flat (no tooth), 1 means tooth right, and 2 means tooth left
89
- * @param {number} x - X coordinate of the starting point
90
- * @param {number} y - Y coordinate of the starting point
91
- * @param {number} w - Width of the piece
92
- * @param {number} h - Height of the piece
93
- * @param {boolean} inv - The line must be drawn bottom to top
94
- */
95
- vLine(sd, type, x, y, w, h, inv) {
96
- const
97
- ky = inv ? -1 : 1,
98
- kx = type === 1 ? 1 : -1;
99
-
100
- if (type === 0)
101
- // Flat line
102
- sd.addStroke(new PathStroke('L', [x, y + h * ky]));
103
- else {
104
- const
105
- y0 = y + (h - h * this.baseWidthFactor) / 2 * ky,
106
- hb = h * this.baseWidthFactor * ky;
107
-
108
- // Approximation to the tooth:
109
- sd.addStroke(new PathStroke('L', [x, y0]));
110
- // This is the tooth:
111
- const wb = w * this.toothHeightFactor * kx;
112
- sd.addStroke(new PathStroke('L', [x + wb, y0 + hb / 2]));
113
- sd.addStroke(new PathStroke('L', [x, y0 + hb]));
114
- // Draw the remaining line
115
- sd.addStroke(new PathStroke('L', [x, y + h * ky]));
116
- }
117
- }
118
- }
119
-
120
- // Register this class in the list of known shapers
121
- export default Shaper.registerClass('@TriangularJigSaw', TriangularJigSaw);
@@ -1,80 +0,0 @@
1
- /**
2
- * File : skins/BlueSkin.js
3
- * Created : 04/07/2016
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 Skin from './Skin.js';
33
- import DefaultSkin from './DefaultSkin.js';
34
-
35
-
36
- /**
37
- * This is a variant of the default {@link module:skins/Skin.Skin Skin} used by JClic.js
38
- * It differs from {@link module:skins/DefaultSkin.DefaultSkin DefaultSkin} only in some colors
39
- * @extends module:skins/DefaultSkin.DefaultSkin
40
- */
41
- export class BlueSkin extends DefaultSkin {
42
- /**
43
- * BlueSkin constructor
44
- * @param {module:JClicPlayer.JClicPlayer} ps - The PlayStation (currently a {@link module:JClicPlayer.JClicPlayer JClicPlayer}) used to load and
45
- * realize the media objects needed to build the Skin.
46
- * @param {string} [name] - The skin class name
47
- * @param {object} [options] - Optional parameter with additional options
48
- */
49
- constructor(ps, name = null, options = {}) {
50
- // BlueSkin extends [DefaultSkin](DefaultSkin.html)
51
- super(ps, name, options);
52
- }
53
-
54
- /**
55
- * Returns the CSS styles used by this skin. This method should be called only from
56
- * the `Skin` constructor, and overridded by subclasses if needed.
57
- * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
58
- * @returns {string}
59
- */
60
- _getStyleSheets(media = 'default') {
61
- return super._getStyleSheets(media) + (media === 'default' ? this.skinCSS : '');
62
- }
63
- }
64
-
65
- Object.assign(BlueSkin.prototype, {
66
- /**
67
- * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
68
- * @name module:skins/BlueSkin.BlueSkin#skinId
69
- * @override
70
- * @type {string} */
71
- skinId: 'JClicBlueSkin',
72
- /**
73
- * Styles used in this skin
74
- * @name module:skins/BlueSkin.BlueSkin#skinCSS
75
- * @type {string} */
76
- skinCSS: '.ID {background-color:#1990FF;}',
77
- });
78
-
79
- // Register this class in the list of available skins
80
- export default Skin.registerClass('blue', BlueSkin);