jclic 2.1.21 → 2.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/jclic-node.js +9 -8
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +4 -4
  7. package/src/GlobalData.js +1 -1
  8. package/src/JClicPlayer.js +2 -2
  9. package/src/bags/MediaBag.js +6 -5
  10. package/dist/1078.jclic-node.js +0 -282
  11. package/dist/1078.jclic-node.js.map +0 -1
  12. package/dist/1196.jclic-node.js +0 -808
  13. package/dist/1196.jclic-node.js.map +0 -1
  14. package/dist/1253.jclic-node.js +0 -1432
  15. package/dist/1253.jclic-node.js.map +0 -1
  16. package/dist/13.jclic-node.js +0 -103
  17. package/dist/13.jclic-node.js.map +0 -1
  18. package/dist/1567.jclic-node.js +0 -2313
  19. package/dist/1567.jclic-node.js.map +0 -1
  20. package/dist/1588.jclic-node.js +0 -602
  21. package/dist/1588.jclic-node.js.map +0 -1
  22. package/dist/1725.jclic-node.js +0 -836
  23. package/dist/1725.jclic-node.js.map +0 -1
  24. package/dist/1731.jclic-node.js +0 -438
  25. package/dist/1731.jclic-node.js.map +0 -1
  26. package/dist/1842.jclic-node.js +0 -651
  27. package/dist/1842.jclic-node.js.map +0 -1
  28. package/dist/2160.jclic-node.js +0 -1016
  29. package/dist/2160.jclic-node.js.map +0 -1
  30. package/dist/222.jclic-node.js +0 -129
  31. package/dist/222.jclic-node.js.map +0 -1
  32. package/dist/2316.jclic-node.js +0 -949
  33. package/dist/2316.jclic-node.js.map +0 -1
  34. package/dist/2355.jclic-node.js +0 -371
  35. package/dist/2355.jclic-node.js.map +0 -1
  36. package/dist/2366.jclic-node.js +0 -431
  37. package/dist/2366.jclic-node.js.map +0 -1
  38. package/dist/2379.jclic-node.js +0 -202
  39. package/dist/2379.jclic-node.js.map +0 -1
  40. package/dist/2437.jclic-node.js +0 -450
  41. package/dist/2437.jclic-node.js.map +0 -1
  42. package/dist/2531.jclic-node.js +0 -869
  43. package/dist/2531.jclic-node.js.map +0 -1
  44. package/dist/2608.jclic-node.js +0 -160
  45. package/dist/2608.jclic-node.js.map +0 -1
  46. package/dist/2715.jclic-node.js +0 -554
  47. package/dist/2715.jclic-node.js.map +0 -1
  48. package/dist/277.jclic-node.js +0 -22
  49. package/dist/277.jclic-node.js.map +0 -1
  50. package/dist/2921.jclic-node.js +0 -660
  51. package/dist/2921.jclic-node.js.map +0 -1
  52. package/dist/2952.jclic-node.js +0 -101
  53. package/dist/2952.jclic-node.js.map +0 -1
  54. package/dist/3018.jclic-node.js +0 -421
  55. package/dist/3018.jclic-node.js.map +0 -1
  56. package/dist/3019.jclic-node.js +0 -682
  57. package/dist/3019.jclic-node.js.map +0 -1
  58. package/dist/3231.jclic-node.js +0 -274
  59. package/dist/3231.jclic-node.js.map +0 -1
  60. package/dist/331.jclic-node.js +0 -115
  61. package/dist/331.jclic-node.js.map +0 -1
  62. package/dist/3391.jclic-node.js +0 -276
  63. package/dist/3391.jclic-node.js.map +0 -1
  64. package/dist/3502.jclic-node.js +0 -671
  65. package/dist/3502.jclic-node.js.map +0 -1
  66. package/dist/3653.jclic-node.js +0 -982
  67. package/dist/3653.jclic-node.js.map +0 -1
  68. package/dist/371.jclic.min.js +0 -2
  69. package/dist/371.jclic.min.js.map +0 -1
  70. package/dist/3856.jclic-node.js +0 -575
  71. package/dist/3856.jclic-node.js.map +0 -1
  72. package/dist/4112.jclic-node.js +0 -659
  73. package/dist/4112.jclic-node.js.map +0 -1
  74. package/dist/4123.jclic-node.js +0 -910
  75. package/dist/4123.jclic-node.js.map +0 -1
  76. package/dist/427.jclic-node.js +0 -894
  77. package/dist/427.jclic-node.js.map +0 -1
  78. package/dist/4483.jclic-node.js +0 -327
  79. package/dist/4483.jclic-node.js.map +0 -1
  80. package/dist/4548.jclic-node.js +0 -1078
  81. package/dist/4548.jclic-node.js.map +0 -1
  82. package/dist/466.jclic-node.js +0 -99
  83. package/dist/466.jclic-node.js.map +0 -1
  84. package/dist/485.jclic-node.js +0 -783
  85. package/dist/485.jclic-node.js.map +0 -1
  86. package/dist/4921.jclic-node.js +0 -500
  87. package/dist/4921.jclic-node.js.map +0 -1
  88. package/dist/5091.jclic-node.js +0 -239
  89. package/dist/5091.jclic-node.js.map +0 -1
  90. package/dist/520.jclic-node.js +0 -550
  91. package/dist/520.jclic-node.js.map +0 -1
  92. package/dist/5312.jclic-node.js +0 -1126
  93. package/dist/5312.jclic-node.js.map +0 -1
  94. package/dist/5338.jclic-node.js +0 -212
  95. package/dist/5338.jclic-node.js.map +0 -1
  96. package/dist/5344.jclic-node.js +0 -229
  97. package/dist/5344.jclic-node.js.map +0 -1
  98. package/dist/5550.jclic-node.js +0 -238
  99. package/dist/5550.jclic-node.js.map +0 -1
  100. package/dist/5626.jclic-node.js +0 -614
  101. package/dist/5626.jclic-node.js.map +0 -1
  102. package/dist/5977.jclic-node.js +0 -1081
  103. package/dist/5977.jclic-node.js.map +0 -1
  104. package/dist/6148.jclic-node.js +0 -345
  105. package/dist/6148.jclic-node.js.map +0 -1
  106. package/dist/6176.jclic-node.js +0 -481
  107. package/dist/6176.jclic-node.js.map +0 -1
  108. package/dist/6221.jclic-node.js +0 -1072
  109. package/dist/6221.jclic-node.js.map +0 -1
  110. package/dist/6238.jclic-node.js +0 -718
  111. package/dist/6238.jclic-node.js.map +0 -1
  112. package/dist/6454.jclic-node.js +0 -1413
  113. package/dist/6454.jclic-node.js.map +0 -1
  114. package/dist/6565.jclic-node.js +0 -294
  115. package/dist/6565.jclic-node.js.map +0 -1
  116. package/dist/6579.jclic-node.js +0 -719
  117. package/dist/6579.jclic-node.js.map +0 -1
  118. package/dist/6715.jclic-node.js +0 -148
  119. package/dist/6715.jclic-node.js.map +0 -1
  120. package/dist/6777.jclic-node.js +0 -171
  121. package/dist/6777.jclic-node.js.map +0 -1
  122. package/dist/6782.jclic-node.js +0 -1611
  123. package/dist/6782.jclic-node.js.map +0 -1
  124. package/dist/6847.jclic-node.js +0 -601
  125. package/dist/6847.jclic-node.js.map +0 -1
  126. package/dist/6856.jclic-node.js +0 -252
  127. package/dist/6856.jclic-node.js.map +0 -1
  128. package/dist/696.jclic-node.js +0 -1821
  129. package/dist/696.jclic-node.js.map +0 -1
  130. package/dist/698.jclic-node.js +0 -583
  131. package/dist/698.jclic-node.js.map +0 -1
  132. package/dist/704.jclic-node.js +0 -80
  133. package/dist/704.jclic-node.js.map +0 -1
  134. package/dist/7046.jclic-node.js +0 -735
  135. package/dist/7046.jclic-node.js.map +0 -1
  136. package/dist/7220.jclic-node.js +0 -156
  137. package/dist/7220.jclic-node.js.map +0 -1
  138. package/dist/7257.jclic-node.js +0 -931
  139. package/dist/7257.jclic-node.js.map +0 -1
  140. package/dist/743.jclic-node.js +0 -583
  141. package/dist/743.jclic-node.js.map +0 -1
  142. package/dist/757.jclic-node.js +0 -1072
  143. package/dist/757.jclic-node.js.map +0 -1
  144. package/dist/7781.jclic-node.js +0 -202
  145. package/dist/7781.jclic-node.js.map +0 -1
  146. package/dist/7912.jclic-node.js +0 -2103
  147. package/dist/7912.jclic-node.js.map +0 -1
  148. package/dist/827.jclic-node.js +0 -708
  149. package/dist/827.jclic-node.js.map +0 -1
  150. package/dist/8276.jclic-node.js +0 -409
  151. package/dist/8276.jclic-node.js.map +0 -1
  152. package/dist/8322.jclic-node.js +0 -498
  153. package/dist/8322.jclic-node.js.map +0 -1
  154. package/dist/8641.jclic-node.js +0 -360
  155. package/dist/8641.jclic-node.js.map +0 -1
  156. package/dist/8837.jclic-node.js +0 -651
  157. package/dist/8837.jclic-node.js.map +0 -1
  158. package/dist/8895.jclic-node.js +0 -151
  159. package/dist/8895.jclic-node.js.map +0 -1
  160. package/dist/9072.jclic-node.js +0 -1285
  161. package/dist/9072.jclic-node.js.map +0 -1
  162. package/dist/9078.jclic-node.js +0 -935
  163. package/dist/9078.jclic-node.js.map +0 -1
  164. package/dist/9103.jclic-node.js +0 -718
  165. package/dist/9103.jclic-node.js.map +0 -1
  166. package/dist/9359.jclic-node.js +0 -145
  167. package/dist/9359.jclic-node.js.map +0 -1
  168. package/dist/9409.jclic-node.js +0 -921
  169. package/dist/9409.jclic-node.js.map +0 -1
  170. package/dist/9513.jclic-node.js +0 -720
  171. package/dist/9513.jclic-node.js.map +0 -1
  172. package/dist/9704.jclic-node.js +0 -81
  173. package/dist/9704.jclic-node.js.map +0 -1
  174. package/dist/9950.jclic-node.js +0 -827
  175. package/dist/9950.jclic-node.js.map +0 -1
@@ -1,720 +0,0 @@
1
- "use strict";
2
- exports.id = 9513;
3
- exports.ids = [9513];
4
- exports.modules = {
5
-
6
- /***/ 9513:
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 export AbstractBox */
13
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7912);
14
- /* harmony import */ var _BoxBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3018);
15
- /**
16
- * File : boxes/AbstractBox.js
17
- * Created : 18/04/2015
18
- * By : Francesc Busquets <francesc@gmail.com>
19
- *
20
- * JClic.js
21
- * An HTML5 player of JClic activities
22
- * https://projectestac.github.io/jclic.js
23
- *
24
- * @source https://github.com/projectestac/jclic.js
25
- *
26
- * @license EUPL-1.2
27
- * @licstart
28
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
29
- *
30
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
31
- * the European Commission- subsequent versions of the EUPL (the "Licence");
32
- * You may not use this work except in compliance with the Licence.
33
- *
34
- * You may obtain a copy of the Licence at:
35
- * https://joinup.ec.europa.eu/software/page/eupl
36
- *
37
- * Unless required by applicable law or agreed to in writing, software
38
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
39
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
40
- * Licence for the specific language governing permissions and limitations
41
- * under the Licence.
42
- * @licend
43
- * @module
44
- */
45
-
46
-
47
-
48
-
49
- /**
50
- * This abstract class is the base for most graphic components of JClic. It describes an area
51
- * (by default an {@link module:AWT.Rectangle}) with some special properties that determine how it must
52
- * be drawn on screen.
53
- *
54
- * Some types of boxes can act as containers for other boxes, establishing a hierarchy of dependences.
55
- * @abstract
56
- * @extends module:AWT.Rectangle
57
- */
58
- class AbstractBox extends _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_ {
59
- /**
60
- * AbstractBox constructor
61
- * @param {module:AbstractBox} parent - The AbstractBox to which this one belongs
62
- * @param {module:AWT.Container} container - The container where this box is placed.
63
- * @param {module:BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
64
- * of this box are defined.
65
- */
66
- constructor(parent, container, boxBase) {
67
- // AbstractBox extends AWT.Rectangle
68
- super();
69
- this.container = container;
70
- this.parent = parent;
71
- this.boxBase = boxBase;
72
- this.shape = this;
73
- this.specialShape = false;
74
- this.visible = true;
75
- }
76
-
77
- /**
78
- * Setter method for `parent`
79
- * @param {module:boxes/AbstractBox.AbstractBox} parent - The new parent of this box
80
- */
81
- setParent(parent) {
82
- this.parent = parent;
83
- }
84
-
85
- /**
86
- * Gets the current parent of this box
87
- * @returns {module:boxes/AbstractBox.AbstractBox}
88
- */
89
- getParent() {
90
- return this.parent;
91
- }
92
-
93
- /**
94
- * Finisher method
95
- */
96
- end() {
97
- }
98
-
99
- /**
100
- * Setter method for `container`
101
- * @param {module:AWT.Container} newContainer - The new Container assigned to this box
102
- */
103
- setContainer(newContainer) {
104
- this.container = newContainer;
105
- if (this.$hostedComponent && this.container && this.container.$div) {
106
- this.$hostedComponent.detach();
107
- this.container.$div.append(this.$hostedComponent);
108
- }
109
- }
110
-
111
- /**
112
- * Gets the `container` attribute of this box, without checking its parent
113
- * @returns {module:AWT.Container}
114
- */
115
- getContainerX() {
116
- return this.container;
117
- }
118
-
119
- /**
120
- * Gets the container associated to this box, asking its parents when `null`.
121
- * @returns {module:AWT.Container}
122
- */
123
- getContainerResolve() {
124
- let ab = this;
125
- while (ab.container === null && ab.parent !== null)
126
- ab = ab.parent;
127
- return ab.container;
128
- }
129
-
130
- /**
131
- * Invalidates the zone corresponding to this box in the associated {@link module:AWT.Container}, if any.
132
- * @param {module:AWT.Rectangle} rect - The rectangle to be invalidated. When `null`, it's the full
133
- * container area.
134
- */
135
- invalidate(rect) {
136
- const cnt = this.getContainerResolve();
137
- if (cnt)
138
- cnt.invalidate(rect);
139
- }
140
-
141
- /**
142
- * Sets the {@link module:boxes/BoxBase.BoxBase BoxBase} of this box
143
- * @param {module:boxes/BoxBase.BoxBase} boxBase - The new BoxBase
144
- */
145
- setBoxBase(boxBase) {
146
- this.boxBase = boxBase;
147
- this.invalidate();
148
- }
149
-
150
- /**
151
- * Gets the real {@link module:boxes/BoxBase.BoxBase BoxBase} associated to this box, scanning down parent relationships.
152
- * @returns {module:boxes/BoxBase.BoxBase}
153
- */
154
- getBoxBaseResolve() {
155
- let ab = this;
156
- while (!ab.boxBase && ab.parent)
157
- ab = ab.parent;
158
- return ab.boxBase || _BoxBase_js__WEBPACK_IMPORTED_MODULE_1__["default"].DEFAULT_BOX_BASE;
159
- }
160
-
161
- /**
162
- * Sets the shape used to draw the content of this box
163
- * @param {module:AWT.Shape} sh - The shape to be set
164
- */
165
- setShape(sh) {
166
- this.shape = sh;
167
- this.specialShape = true;
168
- this.invalidate();
169
- super.setBounds(sh.getBounds());
170
- this.invalidate();
171
- }
172
-
173
- /**
174
- * Gets the current shape used in this box
175
- * @returns {module:AWT.Shape}
176
- */
177
- getShape() {
178
- return this.shape;
179
- }
180
-
181
- /**
182
- * Check if this box contains the specified point
183
- * @override
184
- * @param {module:AWT.Point} p - The point to be checked
185
- * @returns {boolean}
186
- */
187
- contains(p) {
188
- return this.shape === this ? super.contains(p) : this.shape.contains(p);
189
- }
190
-
191
- /**
192
- * Sets a new size and/or dimension to this box
193
- * @override
194
- * @param {AWT.Rectangle|number} rect - An AWT.Rectangle object, or the `x` coordinate of the
195
- * upper-left corner of a new rectangle.
196
- * @param {number} [y] - `y` coordinate of the upper-left corner of the new rectangle.
197
- * @param {number} [w] - Width of the new rectangle.
198
- * @param {number} [h] - Height of the new rectangle.
199
- */
200
- setBounds(rect, y, w, h) {
201
- if (typeof rect === 'number')
202
- // arguments are co-ordinates and size
203
- rect = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(rect, y, w, h);
204
- // Rectangle comparision
205
- if (this.equals(rect))
206
- return;
207
-
208
- const sizeChanged = !this.dim.equals(rect.dim);
209
- if (this.specialShape) {
210
- if (sizeChanged) {
211
- this.shape.scaleBy(new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg(rect.dim.width / this.dim.width, rect.dim.height / this.dim.height));
212
- this.setShape(this.shape);
213
- }
214
- if (!this.pos.equals(rect.pos)) {
215
- this.shape.moveTo(rect.pos);
216
- }
217
- this.setShape(this.shape);
218
- } else
219
- super.setBounds(rect);
220
-
221
- if (this.$hostedComponent)
222
- this.setHostedComponentBounds(sizeChanged);
223
-
224
- return this;
225
- }
226
-
227
- /**
228
- * Sets a new location for this box. In JClic this method was named `setLocation`
229
- * @param {AWT.Point|number} newPos - A point or the `x` coordinate of a new point.
230
- * @param {number} [y] - The `y` coordinate of a new point.
231
- */
232
- moveTo(newPos, y) {
233
- if (typeof newPos === 'number')
234
- newPos = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(newPos, y);
235
- this.setBounds((new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(this)).moveTo(newPos));
236
- }
237
-
238
- /**
239
- * Sets a new location to this box. In JClic this method was named `translate`.
240
- * @param {number} dx - The displacement on the X axis
241
- * @param {number} dy - The displacement on the Y axis
242
- */
243
- moveBy(dx, dy) {
244
- this.setBounds((new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(this)).moveBy(dx, dy));
245
- }
246
-
247
- /**
248
- * Changes the size of this box
249
- * @param {number} width
250
- * @param {number} height
251
- */
252
- setSize(width, height) {
253
- this.setBounds(new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(this.pos, new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg(width, height)));
254
- }
255
-
256
- /**
257
- * Checks if this box has border
258
- * @returns {boolean}
259
- */
260
- hasBorder() {
261
- return this.border;
262
- }
263
-
264
- /**
265
- * Sets/unsets a border to this box
266
- * @param {boolean} newVal - `true` to set a border.
267
- */
268
- setBorder(newVal) {
269
- if (!newVal)
270
- this.invalidate();
271
- this.border = newVal;
272
- if (newVal)
273
- this.invalidate();
274
- }
275
-
276
- /**
277
- * Checks if this box is fully visible
278
- * @returns {boolean}
279
- */
280
- isVisible() {
281
- return this.visible;
282
- }
283
-
284
- /**
285
- * Sets this box visible or invisible
286
- * @param {boolean} newVal - `true` for visible
287
- */
288
- setVisible(newVal) {
289
- this.visible = newVal;
290
- this.setHostedComponentVisible();
291
- this.invalidate();
292
- }
293
-
294
- /**
295
- * Makes {@link module:boxes/AbstractBox.AbstractBox#$hostedComponent} visible or invisible, based on the value of
296
- * the AbstractBox `visible` flag.
297
- */
298
- setHostedComponentVisible() {
299
- if (this.$hostedComponent)
300
- this.$hostedComponent.css('visibility', this.visible ? 'visible' : 'hidden');
301
- }
302
-
303
- /**
304
- * Checks if this box is temporary hidden
305
- * @returns {boolean}
306
- */
307
- isTemporaryHidden() {
308
- return this.temporaryHidden;
309
- }
310
-
311
- /**
312
- * Makes this box temporary hidden (newVal `true`) or resets its original state (newVal `false`)
313
- * @param {boolean} newVal
314
- */
315
- setTemporaryHidden(newVal) {
316
- this.temporaryHidden = newVal;
317
- }
318
-
319
- /**
320
- * Checks if this box is currently inactive.
321
- * @returns {boolean}
322
- */
323
- isInactive() {
324
- return this.inactive;
325
- }
326
-
327
- /**
328
- * Makes this box active (`false`) or inactive (`true`)
329
- * @param {boolean} newVal
330
- */
331
- setInactive(newVal) {
332
- this.inactive = newVal;
333
- if (this.$hostedComponent) {
334
- this.setHostedComponentColors();
335
- this.setHostedComponentVisible();
336
- } else {
337
- if (this.$accessibleElement) {
338
- const disabled = this.isInactive() && !this.accessibleAlwaysActive;
339
- this.$accessibleElement.prop({
340
- disabled: disabled,
341
- tabindex: disabled ? -1 : 0
342
- });
343
- }
344
- this.invalidate();
345
- }
346
- }
347
-
348
- /**
349
- * Checks if this box is in `inverted` state.
350
- * @returns {boolean}
351
- */
352
- isInverted() {
353
- return this.inverted;
354
- }
355
-
356
-
357
- /**
358
- * Puts this box in `inverted` mode or restores its original state.
359
- * @param {boolean} newVal
360
- */
361
- setInverted(newVal) {
362
- this.inverted = newVal;
363
- if (this.$hostedComponent)
364
- this.setHostedComponentColors();
365
- else
366
- this.invalidate();
367
- }
368
-
369
- /**
370
- * Checks if this box is `marked`
371
- * @returns {boolean}
372
- */
373
- isMarked() {
374
- return this.marked;
375
- }
376
-
377
- /**
378
- * Sets this box in `marked` mode, or restores its original state.
379
- * @param {boolean} newVal
380
- */
381
- setMarked(newVal) {
382
- if (!newVal)
383
- this.invalidate();
384
- this.marked = newVal;
385
- if (this.$hostedComponent) {
386
- this.setHostedComponentColors();
387
- this.setHostedComponentBorder();
388
- } else if (newVal)
389
- this.invalidate();
390
- }
391
-
392
- /**
393
- * Checks if this box has the input focus
394
- * @returns {boolean}
395
- */
396
- isFocused() {
397
- return this.focused;
398
- }
399
-
400
- /**
401
- *
402
- * Sets or unsets the input focus to this box.
403
- * @param {boolean} newVal
404
- */
405
- setFocused(newVal) {
406
- if (!newVal)
407
- this.invalidate();
408
- this.focused = newVal;
409
- if (newVal)
410
- this.invalidate();
411
- // Put hosted component on top
412
- if (this.$hostedComponent)
413
- this.$hostedComponent.css('z-index', this.focused ? 20 : 2);
414
- }
415
-
416
- /**
417
- * Checks if this box is in `alternative` state.
418
- * @returns {boolean}
419
- */
420
- isAlternative() {
421
- return this.alternative;
422
- }
423
-
424
- /**
425
- * Sets this box in `alternative` mode, or restores its original state.
426
- * @param {boolean} newVal
427
- */
428
- setAlternative(newVal) {
429
- this.alternative = newVal;
430
- this.invalidate();
431
- }
432
-
433
- /**
434
- * Draws the content of this box on an HTML `canvas` element. At this level, only background
435
- * and border are painted/stroked. Derived classes should implement specific drawing tasks in
436
- * {@link module:boxes/AbstractBox.AbstractBox#updateContent}.
437
- * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the
438
- * box content.
439
- * @param {module:AWT.Rectangle} [dirtyRegion=null] - The area that must be repainted. `null` refers to the whole box.
440
- */
441
- update(ctx, dirtyRegion = null) {
442
- if (this.isEmpty() || !this.isVisible() || this.isTemporaryHidden())
443
- return false;
444
-
445
- if (dirtyRegion && !this.shape.intersects(dirtyRegion))
446
- return false;
447
-
448
- /**
449
- * TODO: Implement clipping
450
- Shape saveClip=new Area(g2.getClip())
451
- Area clip=new Area(saveClip)
452
- clip.intersect(new Area(shape))
453
- g2.setClip(clip)
454
- */
455
-
456
- const style = this.getBoxBaseResolve();
457
- if (!style.transparent && !style.dontFill && !this.tmpTrans) {
458
- if (!style.bgGradient || style.bgGradient.hasTransparency()) {
459
- // Prepare the rendering context
460
- ctx.fillStyle = this.inactive ?
461
- style.inactiveColor :
462
- this.inverted ? style.textColor : style.backColor;
463
- // Fill the shape
464
- this.shape.fill(ctx, dirtyRegion);
465
- }
466
- if (style.bgGradient) {
467
- ctx.fillStyle = style.bgGradient.getGradient(ctx, this.shape.getBounds());
468
- this.shape.fill(ctx, dirtyRegion);
469
- }
470
- // Reset the canvas context
471
- ctx.fillStyle = 'black';
472
- }
473
-
474
- if (!this.$hostedComponent)
475
- this.updateContent(ctx, dirtyRegion);
476
-
477
- this.drawBorder(ctx);
478
- return true;
479
- }
480
-
481
- /**
482
- * Here is where classes derived from {@link module:boxes/AbstractBox.AbstractBox AbstractBox} should implement the drawing of its
483
- * content. Background and border are already painted in {@link module:boxes/AbstractBox.AbstractBox#update}.
484
- * @param {external:CanvasRenderingContext2D} _ctx - The canvas rendering context used to draw the
485
- * box content.
486
- * @param {module:AWT.Rectangle} [_dirtyRegion] - The area that must be repainted. `null` refers to the whole box.
487
- */
488
- //
489
- // Abstract method, to be implemented in subclasses
490
- updateContent(_ctx, _dirtyRegion) {
491
- }
492
-
493
- /**
494
- * Draws the box border
495
- * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context where the border
496
- * will be drawn.
497
- */
498
- drawBorder(ctx) {
499
- if (this.border || this.marked) {
500
- const style = this.getBoxBaseResolve();
501
-
502
- // Prepare stroke settings
503
- ctx.strokeStyle = style.borderColor;
504
- style[this.marked ? 'markerStroke' : 'borderStroke'].setStroke(ctx);
505
- if (this.marked)
506
- ctx.globalCompositeOperation = 'xor';
507
-
508
- // Draw border
509
- this.shape.stroke(ctx);
510
-
511
- // Reset ctx default values
512
- if (this.marked)
513
- ctx.globalCompositeOperation = 'source-over';
514
- ctx.strokeStyle = 'black';
515
- _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Stroke */ .tc.prototype.setStroke(ctx);
516
- }
517
- }
518
-
519
- /**
520
- * Returns the enclosing Rectangle of this box including its border (if any)
521
- * @returns {module:AWT.Rectangle}
522
- */
523
- getBorderBounds() {
524
- const result = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(this.getBounds());
525
- if (this.border || this.marked) {
526
- const style = this.getBoxBaseResolve();
527
- const w = style[this.marked ? 'markerStroke' : 'borderStroke'].lineWidth;
528
- result.moveBy(-w / 2, -w / 2);
529
- result.dim.width += w;
530
- result.dim.height += w;
531
- }
532
- return result;
533
- }
534
-
535
- /**
536
- * Sets the {@link module:boxes/AbstractBox.AbstractBox#$hostedComponent $hostedComponent} member.
537
- * @param {external:jQuery} $hc - The jQuery DOM component hosted by this box.
538
- */
539
- setHostedComponent($hc) {
540
- if (this.$hostedComponent)
541
- this.$hostedComponent.detach();
542
-
543
- this.$hostedComponent = $hc;
544
-
545
- if (this.$hostedComponent) {
546
- this.setContainer(this.container);
547
- this.setHostedComponentColors();
548
- this.setHostedComponentBorder();
549
- this.setHostedComponentBounds(true);
550
- this.setHostedComponentVisible();
551
- this.setFocused(this.focused);
552
- }
553
- }
554
-
555
- /**
556
- * Gets the current {@link module:boxes/AbstractBox.AbstractBox#$hostedComponent|$hostedComponent} member
557
- * @returns {external:jQuery}
558
- */
559
- getHostedComponent() {
560
- return this.$hostedComponent;
561
- }
562
-
563
- /**
564
- * Sets {@link module:boxes/AbstractBox.AbstractBox#$hostedComponent|$hostedComponent} colors and other css properties
565
- * based on the current {@link module:boxes/BoxBase.BoxBase BoxBase} of this box.
566
- */
567
- setHostedComponentColors() {
568
- if (this.$hostedComponent) {
569
- const style = this.getBoxBaseResolve();
570
- const css = style.getCSS(null, this.inactive, this.inverted, this.alternative);
571
- // Check if cell has background gradient and animated gif
572
- if (this.$hostedComponent.data('background-image') && css['background-image'])
573
- css['background-image'] = `${this.$hostedComponent.data('background-image')},${css['background-image']}`;
574
- this.$hostedComponent.css(css);
575
- }
576
- }
577
-
578
- /**
579
- * Sets the {@link module:boxes/AbstractBox.AbstractBox#$hostedComponent|$hostedComponent} border, based on the current
580
- * {@link module:boxes/BoxBase.BoxBase BoxBase} of this box.
581
- */
582
- setHostedComponentBorder() {
583
- if (this.$hostedComponent && (this.border || this.marked)) {
584
- const style = this.getBoxBaseResolve();
585
- this.$hostedComponent.css({
586
- 'border-width': `${style.get(this.marked ? 'markerStroke' : 'borderStroke').lineWidth}px`,
587
- 'border-style': 'solid',
588
- 'border-color': style.get('borderColor')
589
- });
590
- }
591
- }
592
-
593
- /**
594
- * Places and resizes {@link module:boxes/AbstractBox.AbstractBox#$hostedComponent|$hostedComponent}, based on the size
595
- * and position of this box.
596
- * @param {boolean} _sizeChanged - `true` when this {@link module:boxes/ActiveBox.ActiveBox ActiveBox} has changed its size
597
- */
598
- setHostedComponentBounds(_sizeChanged) {
599
- if (this.$hostedComponent) {
600
- const
601
- r = this.getBounds(),
602
- b = this.border || this.marked ? this.getBoxBaseResolve().get(this.marked ? 'markerStroke' : 'borderStroke').lineWidth : 0;
603
- this.$hostedComponent.css({
604
- position: 'absolute',
605
- width: r.dim.width - 2 * b + 'px',
606
- height: r.dim.height - 2 * b + 'px',
607
- top: r.pos.y + 'px',
608
- left: r.pos.x + 'px'
609
- });
610
- }
611
- }
612
- }
613
-
614
- Object.assign(AbstractBox.prototype, {
615
- /**
616
- * The parent AbstractBox (can be `null`)
617
- * @name module:boxes/AbstractBox.AbstractBox#parent
618
- * @type {module:boxes/AbstractBox.AbstractBox} */
619
- parent: null,
620
- /**
621
- * The Container to which this AbstractBox belongs
622
- * @name module:boxes/AbstractBox.AbstractBox#container
623
- * @type {module:AWT.Container} */
624
- container: null,
625
- /**
626
- * The {@link module:boxes/BoxBase.BoxBase BoxBase} related to this AbstractBox. When `null`, the parent can provide an
627
- * alternative one.
628
- * @name module:boxes/AbstractBox.AbstractBox#boxBase
629
- * @type {module:boxes/BoxBase.BoxBase} */
630
- boxBase: null,
631
- /**
632
- * Whether this box has a border or not
633
- * @name module:boxes/AbstractBox.AbstractBox#border
634
- * @type {boolean} */
635
- border: false,
636
- /**
637
- * The shape of this box (the box Rectangle or a special Shape, if set)
638
- * @name module:boxes/AbstractBox.AbstractBox#shape
639
- * @type {module:AWT.Shape} */
640
- shape: null,
641
- /**
642
- * Whether this box has a shape that is not a rectangle
643
- * @name module:boxes/AbstractBox.AbstractBox#specialShape
644
- * @type {boolean} */
645
- specialShape: false,
646
- /**
647
- * Whether this box is visible or not
648
- * @name module:boxes/AbstractBox.AbstractBox#visible
649
- * @type {boolean} */
650
- visible: true,
651
- /**
652
- * Used to temporary hide a box while other drawing operations are done
653
- * @name module:boxes/AbstractBox.AbstractBox#temporaryHidden
654
- * @type {boolean} */
655
- temporaryHidden: false,
656
- /**
657
- * Cells with this attribute will be transparent but with painted border
658
- * @name module:boxes/AbstractBox.AbstractBox#tmpTrans
659
- * @type {boolean}*/
660
- tmpTrans: false,
661
- /**
662
- * Whether this box is active or inactive
663
- * @name module:boxes/AbstractBox.AbstractBox#inactive
664
- * @type {boolean} */
665
- inactive: false,
666
- /**
667
- * Whether this box must be displayed with inverted or regular colors
668
- * @name module:boxes/AbstractBox.AbstractBox#inverted
669
- * @type {boolean} */
670
- inverted: false,
671
- /**
672
- * Whether this box must be displayed with alternative or regular color and font settings
673
- * @name module:boxes/AbstractBox.AbstractBox#alternative
674
- * @type {boolean} */
675
- alternative: false,
676
- /**
677
- * Whether this box is marked (selected) or not
678
- * @name module:boxes/AbstractBox.AbstractBox#marked
679
- * @type {boolean} */
680
- marked: false,
681
- /**
682
- * Whether this box holds the input focus
683
- * @name module:boxes/AbstractBox.AbstractBox#focused
684
- * @type {boolean} */
685
- focused: false,
686
- /**
687
- * Text to be used in accessible contexts
688
- * @name module:boxes/AbstractBox.AbstractBox#accessibleText
689
- * @type {string} */
690
- accessibleText: '',
691
- /**
692
- * Describes the main role of this box on the activity. Useful in wai-aria descriptions.
693
- * @name module:boxes/AbstractBox.AbstractBox#role
694
- * @type {string} */
695
- role: 'cell',
696
- /**
697
- * DOM element used to display this cell content in wai-aria contexts
698
- * @name module:boxes/AbstractBox.AbstractBox#$accessibleElement
699
- * @type {external:jQuery} */
700
- $accessibleElement: null,
701
- /**
702
- * Flag indicating that $accessibleElement should be always active
703
- * @name module:boxes/AbstractBox.AbstractBox#accessibleAlwaysActive
704
- * @type {boolean} */
705
- accessibleAlwaysActive: false,
706
- /**
707
- * An external JQuery DOM element hosted by this box
708
- * @name module:boxes/AbstractBox.AbstractBox#$hostedComponent
709
- * @type {external:jQuery} */
710
- $hostedComponent: null,
711
- });
712
-
713
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AbstractBox);
714
-
715
-
716
- /***/ })
717
-
718
- };
719
- ;
720
- //# sourceMappingURL=9513.jclic-node.js.map