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,982 +0,0 @@
1
- "use strict";
2
- exports.id = 3653;
3
- exports.ids = [3653,7781,6148];
4
- exports.modules = {
5
-
6
- /***/ 3653:
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 DoublePuzzle, DoublePuzzlePanel */
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 _boxes_BoxConnector_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6148);
19
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7912);
20
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1253);
21
- /**
22
- * File : activities/puzzles/DoublePuzzle.js
23
- * Created : 22/05/2015
24
- * By : Francesc Busquets <francesc@gmail.com>
25
- *
26
- * JClic.js
27
- * An HTML5 player of JClic activities
28
- * https://projectestac.github.io/jclic.js
29
- *
30
- * @source https://github.com/projectestac/jclic.js
31
- *
32
- * @license EUPL-1.2
33
- * @licstart
34
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
35
- *
36
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
37
- * the European Commission- subsequent versions of the EUPL (the "Licence");
38
- * You may not use this work except in compliance with the Licence.
39
- *
40
- * You may obtain a copy of the Licence at:
41
- * https://joinup.ec.europa.eu/software/page/eupl
42
- *
43
- * Unless required by applicable law or agreed to in writing, software
44
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
45
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
46
- * Licence for the specific language governing permissions and limitations
47
- * under the Licence.
48
- * @licend
49
- * @module
50
- */
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
- /**
61
- * The aim of this class of {@link module:Activity.Activity Activity} is to put in order the shuffled elements of an
62
- * {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} that contains an image, sounds, text... or any other media content.
63
- *
64
- * The activity uses two panels: one with the shuffled cells, and other initially empty where
65
- * this cells must be placed in order.
66
- * @extends module:Activity.Activity
67
- */
68
- class DoublePuzzle extends _Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .Activity */ .I {
69
- /**
70
- * DoublePuzzle constructor
71
- * @param {module:project/JClicProject.JClicProject} project - The {@link module:project/JClicProject.JClicProject JClicProject} to which this activity belongs
72
- */
73
- constructor(project) {
74
- super(project);
75
- }
76
-
77
- /**
78
- * Retrieves the minimum number of actions needed to solve this activity.
79
- * @override
80
- * @returns {number}
81
- */
82
- getMinNumActions() {
83
- return this.abc.primary.getNumCells();
84
- }
85
-
86
- /**
87
- * Whether or not the activity uses random to shuffle internal components
88
- * @override
89
- * @returns {boolean}
90
- */
91
- hasRandom() {
92
- return true;
93
- }
94
-
95
- /**
96
- * When `true`, the activity must always be shuffled
97
- * @override
98
- * @returns {boolean}
99
- */
100
- shuffleAlways() {
101
- return true;
102
- }
103
-
104
- /**
105
- * Whether the activity allows the user to request help.
106
- * @override
107
- * @returns {boolean}
108
- */
109
- helpSolutionAllowed() {
110
- return true;
111
- }
112
- }
113
-
114
- /**
115
- * The {@link module:Activity.ActivityPanel ActivityPanel} where {@link module:activities/puzzles/DoublePuzzle.DoublePuzzle DoublePuzzle} activities are played.
116
- * @extends module:Activity.ActivityPanel
117
- */
118
- class DoublePuzzlePanel extends _Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .ActivityPanel */ .S {
119
- /**
120
- * DoublePuzzlePanel constructor
121
- * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs
122
- * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the
123
- * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
124
- * Java interface.
125
- * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy
126
- */
127
- constructor(act, ps, $div) {
128
- super(act, ps, $div);
129
- }
130
-
131
- /**
132
- * Miscellaneous cleaning operations
133
- * @override
134
- */
135
- clear() {
136
- if (this.bgA) {
137
- this.bgA.end();
138
- this.bgA = null;
139
- }
140
- if (this.bgB) {
141
- this.bgB.end();
142
- this.bgB = null;
143
- }
144
- }
145
-
146
- /**
147
- * Prepares the visual components of the activity
148
- * @override
149
- */
150
- buildVisualComponents() {
151
- if (this.firstRun)
152
- super.buildVisualComponents();
153
- this.clear();
154
-
155
- const abc = this.act.abc['primary'];
156
- if (abc) {
157
- if (abc.image)
158
- abc.setImgContent(this.act.project.mediaBag, null, false);
159
-
160
- if (this.act.acp !== null)
161
- this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);
162
-
163
- this.bgA = _boxes_ActiveBoxGrid_js__WEBPACK_IMPORTED_MODULE_2__["default"].createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
164
- this.bgB = _boxes_ActiveBoxGrid_js__WEBPACK_IMPORTED_MODULE_2__["default"].createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
165
-
166
- this.bgA.setContent(abc);
167
-
168
- this.bgA.accessibleText = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_6__/* .getMsg */ .qG)('source');
169
- this.bgB.accessibleText = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_6__/* .getMsg */ .qG)('target');
170
-
171
- this.bgA.setVisible(true);
172
- this.bgB.setVisible(true);
173
-
174
- const bgbA = this.bgA.getBackgroundActiveBox();
175
- const bgbB = this.bgB.getBackgroundActiveBox();
176
- if (bgbA && bgbB)
177
- bgbB.exchangeContent(bgbA);
178
- }
179
- }
180
-
181
- /**
182
- * Basic initialization procedure
183
- * @override
184
- */
185
- initActivity() {
186
- super.initActivity();
187
- if (!this.firstRun)
188
- this.buildVisualComponents();
189
- else
190
- this.firstRun = false;
191
-
192
- if (this.bgA && this.bgB) {
193
- this.shuffle([this.bgA], true, true);
194
- if (this.useOrder)
195
- this.currentItem = this.bgA.getNextItem(-1);
196
- this.setAndPlayMsg('initial', 'start');
197
- this.invalidate().update();
198
- this.playing = true;
199
- }
200
- }
201
-
202
- /**
203
- * Updates the graphic content of this panel.
204
- * This method will be called from {@link module:AWT.Container#update} when needed.
205
- * @override
206
- * @param {module:AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
207
- * it's the whole panel.
208
- */
209
- updateContent(dirtyRegion) {
210
- super.updateContent();
211
- if (this.bgA && this.bgB && this.$canvas) {
212
- const
213
- canvas = this.$canvas.get(-1),
214
- ctx = canvas.getContext('2d');
215
- if (!dirtyRegion)
216
- dirtyRegion = new _AWT_js__WEBPACK_IMPORTED_MODULE_5__/* .Rectangle */ .M_(0, 0, canvas.width, canvas.height);
217
- ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
218
- this.bgA.update(ctx, dirtyRegion);
219
- this.bgB.update(ctx, dirtyRegion);
220
- }
221
- return this;
222
- }
223
-
224
- /**
225
- * Sets the real dimension of this panel.
226
- * @override
227
- * @param {module:AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
228
- * @returns {module:AWT.Dimension}
229
- */
230
- setDimension(preferredMaxSize) {
231
- return !this.bgA || !this.bgB || this.getBounds().equals(preferredMaxSize) ?
232
- preferredMaxSize :
233
- _boxes_BoxBag_js__WEBPACK_IMPORTED_MODULE_3__["default"].layoutDouble(preferredMaxSize, this.bgA, this.bgB, this.act.boxGridPos, this.act.margin);
234
- }
235
-
236
- /**
237
- * Sets the size and position of this activity panel
238
- * @override
239
- * @param {module:AWT.Rectangle} rect
240
- */
241
- setBounds(rect) {
242
- if (this.$canvas)
243
- this.$canvas.remove();
244
-
245
- super.setBounds(rect);
246
- if (this.bgA || this.bgB) {
247
- // Create the main canvas
248
- this.$canvas = jquery__WEBPACK_IMPORTED_MODULE_0___default()(`<canvas width="${rect.dim.width}" height="${rect.dim.height}"/>`).css({
249
- position: 'absolute',
250
- top: 0,
251
- left: 0
252
- });
253
- this.$div.append(this.$canvas);
254
-
255
- // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
256
- this.bc = new _boxes_BoxConnector_js__WEBPACK_IMPORTED_MODULE_4__["default"](this, this.$canvas);
257
-
258
- // Repaint all
259
- this.invalidate().update();
260
- }
261
- }
262
-
263
- /**
264
- * Builds the accessible components needed for this ActivityPanel
265
- * This method is called when all main elements are placed and visible, when the activity is ready
266
- * to start or when resized.
267
- * @override
268
- */
269
- buildAccessibleComponents() {
270
- if (this.$canvas && this.accessibleCanvas) {
271
- super.buildAccessibleComponents();
272
- if (this.bgA)
273
- this.bgA.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
274
- if (this.bgB) {
275
- this.bgB.setCellAttr('accessibleAlwaysActive', true);
276
- this.bgB.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
277
- }
278
- }
279
- }
280
-
281
- /**
282
- * Main handler used to process mouse, touch, keyboard and edit events
283
- * @override
284
- * @param {external:Event} event - The HTML event to be processed
285
- * @returns {boolean} - When this event handler returns `false`, jQuery will stop its
286
- * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
287
- */
288
- processEvent(event) {
289
- if (this.bc && this.playing) {
290
- //
291
- // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
292
- let p = null;
293
- //
294
- // Two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
295
- // `origin` and `dest` points.
296
- let bx1, bx2;
297
- // Array to be filled with actions to be executed at the end of event processing
298
- const delayedActions = [];
299
- //
300
- // _touchend_ event don't provide pageX nor pageY information
301
- if (event.type === 'touchend')
302
- p = this.bc.active ? this.bc.dest.clone() : new _AWT_js__WEBPACK_IMPORTED_MODULE_5__/* .Point */ .bR();
303
- else {
304
- // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
305
- const
306
- x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
307
- y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
308
- p = new _AWT_js__WEBPACK_IMPORTED_MODULE_5__/* .Point */ .bR(x - this.$div.offset().left, y - this.$div.offset().top);
309
- }
310
-
311
- // Flag for tracking `mouseup` events
312
- let up = false;
313
- switch (event.type) {
314
- case 'touchcancel':
315
- // Canvel movement
316
- if (this.bc.active)
317
- this.bc.end();
318
- break;
319
-
320
- case 'mouseup':
321
- // Don't consider drag moves below 3 pixels. Can be a "trembling click"
322
- if (this.bc.active && p.distanceTo(this.bc.origin) <= 3)
323
- break;
324
-
325
- up = true;
326
- /* falls through */
327
- case 'touchend':
328
- case 'touchstart':
329
- case 'mousedown':
330
- if (!this.bc.active) {
331
- //
332
- // A new pairing starts
333
- //
334
- // Pairings can never start with a `mouseup` event
335
- if (up)
336
- break;
337
-
338
- this.ps.stopMedia(1);
339
- //
340
- // Find the ActiveBox behind the clicked point
341
- bx1 = this.bgA.findActiveBox(p);
342
- if (bx1 && !bx1.isInactive() && (!this.act.useOrder || bx1.idOrder === this.currentItem)) {
343
- // Start the [BoxConnector](BoxConnector.html)
344
- if (this.act.dragCells)
345
- this.bc.begin(p, bx1);
346
- else
347
- this.bc.begin(p);
348
- // Play cell media or event sound
349
- if (!bx1.playMedia(this.ps, delayedActions))
350
- this.playEvent('click');
351
-
352
- // Move the focus to the opposite accessible group
353
- if (this.bgB.$accessibleDiv)
354
- this.bgB.$accessibleDiv.focus();
355
- }
356
- } else {
357
- this.ps.stopMedia(1);
358
- // Pairing completed
359
- //
360
- // Find the active boxes behind `bc.origin` and `p`
361
- if (this.act.dragCells)
362
- bx1 = this.bc.bx;
363
- else
364
- bx1 = this.bgA.findActiveBox(this.bc.origin);
365
- bx2 = this.bgB.findActiveBox(p);
366
-
367
- // BoxConnector ends here
368
- this.bc.end();
369
-
370
- // Check if the pairing was OK
371
- if (bx1 && bx2 && bx2.isInactive()) {
372
- let ok = false;
373
- const
374
- src = `${bx1.getDescription()} (${bx1.idOrder})`,
375
- dest = `(${bx2.idOrder})`,
376
- target = this.act.abc['primary'].getActiveBoxContent(bx2.idOrder);
377
- if (bx1.getContent().isEquivalent(target, true)) {
378
- // Pairing OK
379
- ok = true;
380
- bx1.exchangeContent(bx2);
381
- bx1.setVisible(false);
382
- if (this.act.useOrder)
383
- this.currentItem = this.bgA.getNextItem(this.currentItem);
384
- }
385
- // Check results and notify action
386
- const cellsAtPlace = this.bgA.countInactiveCells();
387
- this.ps.reportNewAction(this.act, 'PLACE', src, dest, ok, cellsAtPlace);
388
- // Finish activity or play event sound
389
- if (ok && cellsAtPlace === this.bgA.getNumCells())
390
- this.finishActivity(true);
391
- else
392
- this.playEvent(ok ? 'actionOk' : 'actionError');
393
- }
394
- this.update();
395
-
396
- // Move the focus to the `source` accessible group
397
- if (this.bgA.$accessibleDiv)
398
- this.bgA.$accessibleDiv.focus();
399
- }
400
- break;
401
-
402
- case 'mousemove':
403
- case 'touchmove':
404
- this.bc.moveTo(p);
405
- break;
406
- }
407
- delayedActions.forEach(action => action());
408
- event.preventDefault();
409
- }
410
- }
411
- }
412
-
413
- Object.assign(DoublePuzzlePanel.prototype, {
414
- /**
415
- * The {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} object containing the information to be displayed in the `primary` panel
416
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#bgA
417
- * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */
418
- bgA: null,
419
- /**
420
- * The secondary {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag}, initially empty.
421
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#bgB
422
- * @type {module:boxes/ActiveBoxBag.ActiveBoxBag} */
423
- bgB: null,
424
- /**
425
- * The box connector
426
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#bc
427
- * @type {module:boxes/BoxConnector.BoxConnector} */
428
- bc: null,
429
- /**
430
- * List of mouse, touch and keyboard events intercepted by this panel
431
- * @override
432
- * @name module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel#events
433
- * @type {string[]} */
434
- events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel'],
435
- });
436
-
437
- /**
438
- * Panel class associated to this type of activity: {@link module:activities/puzzles/DoublePuzzle.DoublePuzzlePanel DoublePuzzlePanel}
439
- * @type {class} */
440
- DoublePuzzle.Panel = DoublePuzzlePanel;
441
-
442
- // Register activity class
443
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Activity_js__WEBPACK_IMPORTED_MODULE_1__/* .Activity */ .I.registerClass('@puzzles.DoublePuzzle', DoublePuzzle));
444
-
445
-
446
-
447
- /***/ }),
448
-
449
- /***/ 7781:
450
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
451
-
452
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
453
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
454
- /* harmony export */ });
455
- /* unused harmony export ActiveBoxGrid */
456
- /* harmony import */ var _ActiveBoxBag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(427);
457
- /* harmony import */ var _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1725);
458
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7912);
459
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1253);
460
- /**
461
- * File : boxes/ActiveBoxGrid.js
462
- * Created : 19/05/2015
463
- * By : Francesc Busquets <francesc@gmail.com>
464
- *
465
- * JClic.js
466
- * An HTML5 player of JClic activities
467
- * https://projectestac.github.io/jclic.js
468
- *
469
- * @source https://github.com/projectestac/jclic.js
470
- *
471
- * @license EUPL-1.2
472
- * @licstart
473
- * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
474
- *
475
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
476
- * the European Commission- subsequent versions of the EUPL (the "Licence");
477
- * You may not use this work except in compliance with the Licence.
478
- *
479
- * You may obtain a copy of the Licence at:
480
- * https://joinup.ec.europa.eu/software/page/eupl
481
- *
482
- * Unless required by applicable law or agreed to in writing, software
483
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
484
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
485
- * Licence for the specific language governing permissions and limitations
486
- * under the Licence.
487
- * @licend
488
- * @module
489
- */
490
-
491
-
492
-
493
-
494
-
495
-
496
- /**
497
- * This class extends {@link module:boxes/ActiveBoxbag.ActiveBoxBag ActiveBoxBag} with constructors that take an argument of type
498
- * {@link module:shapers/Shaper.Shaper Shaper} used to build all its {@link module:boxes/ActiveBox.ActiveBox ActiveBox}components. It also maintains information
499
- * about the number of "rows" and "columns", useful to compute valid (integer) values when
500
- * resizing or moving its components.
501
- * @extends module:boxes/ActiveBoxBag.ActiveBoxBag
502
- */
503
- class ActiveBoxGrid extends _ActiveBoxBag_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
504
- /**
505
- * ActiveBxGrid constructor
506
- * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs
507
- * @param {module:AWT.Container} container - The container where this box grid is placed.
508
- * @param {module:boxes/BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
509
- * @param {number} px - `X` coordinate of the upper left corner of this box grid
510
- * @param {number} py - `Y` coordinate of the upper left corner of this box grid
511
- * @param {number} setWidth - Total width of the box grid
512
- * @param {number} setHeight - Total height of the box grid
513
- * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects
514
- */
515
- constructor(parent, container, boxBase, px, py, setWidth, setHeight, sh) {
516
- // ActiveBoxGrid derives from ActiveBoxBag
517
- super(parent, container, boxBase);
518
-
519
- this.nCols = sh.nCols;
520
- this.nRows = sh.nRows;
521
-
522
- // This will be the enclosing rectangle of this ActiveBox bag
523
- const r = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_(
524
- new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(px, py),
525
- new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
526
- Math.round(setWidth / this.nCols) * this.nCols,
527
- Math.round(setHeight / this.nRows) * this.nRows));
528
-
529
- // Create all the [ActiveBox](ActiveBox.html) objects based on the
530
- // shapes provided by the [Shaper](Shaper.html)
531
- for (let i = 0; i < sh.nCells; i++) {
532
- const
533
- tmpSh = sh.getShape(i, r),
534
- bx = new _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__["default"](this, container, boxBase, i, tmpSh.getBounds());
535
- if (!sh.rectangularShapes)
536
- bx.setShape(tmpSh);
537
- this.addActiveBox(bx);
538
- }
539
-
540
- // If the Shaper has `remainder` (extra space), set the background box of this
541
- // [BoxBag](BoxBag.html)
542
- if (sh.hasRemainder) {
543
- const
544
- tmpSh = sh.getRemainderShape(r),
545
- bx = new _ActiveBox_js__WEBPACK_IMPORTED_MODULE_1__["default"](this, container, boxBase, 0, tmpSh.getBounds());
546
- bx.setShape(tmpSh);
547
- this.setBackgroundBox(bx);
548
- }
549
- }
550
-
551
- /**
552
- * This factory constructor creates a new empty grid with the number of cells indicated by the
553
- * {@link module:boxes/ActiveBagContent.ActiveBagContent ActiveBagContent} `abc`, not filling the cells with any content.
554
- * @param {module:boxes/AbstractBox.AbstractBox} parent - The AbstractBox to which this box grid belongs
555
- * @param {module:AWT.Container} container - The container where this box grid is placed.
556
- * @param {number} px - `X` coordinate of the upper left corner of this box grid
557
- * @param {number} py - `Y` coordinate of the upper left corner of this box grid
558
- * @param {module:boxes/ActiveBagContent.ActiveBagContent} abc - Used only to get the number of cells and the shaper (when `sh` is `null`)
559
- * @param {module:shapers/Shaper.Shaper} sh - Shaper used to build the ActiveBox objects
560
- * @param {module:boxes/BoxBase.BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
561
- * of this box grid are defined.
562
- * @returns {module:boxes/ActiveBoxGrid.ActiveBoxGrid}
563
- */
564
- static createEmptyGrid(parent, container, px, py, abc, sh, boxBase) {
565
- const result = abc ? new ActiveBoxGrid(parent, container,
566
- boxBase || abc.style,
567
- px, py,
568
- abc.getTotalWidth(), abc.getTotalHeight(),
569
- sh || abc.getShaper()) : null;
570
-
571
- if (result)
572
- result.setBorder(abc.border);
573
-
574
- return result;
575
- }
576
-
577
- /**
578
- * Gets the minimum size of this grid
579
- * @returns {module:AWT.Dimension}
580
- */
581
- getMinimumSize() {
582
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
583
- _Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .settings */ .W0.MIN_CELL_SIZE * this.nCols,
584
- _Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .settings */ .W0.MIN_CELL_SIZE * this.nRows);
585
- }
586
-
587
- /**
588
- * Gets a scaled size of this grid, rounded to the nearest integer values
589
- * @param {number} scale - The scale factor
590
- * @returns {module:AWT.Dimension}
591
- */
592
- getScaledSize(scale) {
593
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(
594
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .roundTo */ .GB)(scale * this.preferredBounds.dim.width, this.nCols),
595
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .roundTo */ .GB)(scale * this.preferredBounds.dim.height, this.nRows));
596
- }
597
-
598
- /**
599
- * Returns the logical coordinates of the provided {@link module:boxes/ActiveBox.ActiveBox ActiveBox}.
600
- * The units of the result are not pixels, but ordinal numbers (relative positions) of columns
601
- * and rows in the grid.
602
- * @param {module:boxes/ActiveBox.ActiveBox} bx - The box to process
603
- * @returns {module:AWT.Point}
604
- */
605
- getCoord(bx) {
606
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(bx.idLoc % this.nCols, Math.floor(bx.idLoc / this.nCols));
607
- }
608
-
609
- /**
610
- * Calculates the logical distance between two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects.
611
- * Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows
612
- * in the grid.
613
- * @param {module:boxes/ActiveBox.ActiveBox} src - First box
614
- * @param {module:boxes/ActiveBox.ActiveBox} dest - Second box
615
- * @returns {module:AWT.Point}
616
- */
617
- getCoordDist(src, dest) {
618
- const
619
- ptSrc = this.getCoord(src),
620
- ptDest = this.getCoord(dest);
621
- return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Point */ .bR(ptDest.x - ptSrc.x, ptDest.y - ptSrc.y);
622
- }
623
- }
624
-
625
- Object.assign(ActiveBoxGrid.prototype, {
626
- /**
627
- * Number of columns of this box grid
628
- * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nCols
629
- * @type {number} */
630
- nCols: 1,
631
- /**
632
- * Number of rows of this box grid
633
- * @name module:boxes/ActiveBoxGrid.ActiveBoxGrid#nRows
634
- * @type {number} */
635
- nRows: 1,
636
- });
637
-
638
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ActiveBoxGrid);
639
-
640
-
641
- /***/ }),
642
-
643
- /***/ 6148:
644
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
645
-
646
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
647
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
648
- /* harmony export */ });
649
- /* unused harmony export BoxConnector */
650
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7912);
651
- /**
652
- * File : boxes/BoxConnector.js
653
- * Created : 26/05/2015
654
- * By : Francesc Busquets <francesc@gmail.com>
655
- *
656
- * JClic.js
657
- * An HTML5 player of JClic activities
658
- * https://projectestac.github.io/jclic.js
659
- *
660
- * @source https://github.com/projectestac/jclic.js
661
- *
662
- * @license EUPL-1.2
663
- * @licstart
664
- * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
665
- *
666
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
667
- * the European Commission- subsequent versions of the EUPL (the "Licence");
668
- * You may not use this work except in compliance with the Licence.
669
- *
670
- * You may obtain a copy of the Licence at:
671
- * https://joinup.ec.europa.eu/software/page/eupl
672
- *
673
- * Unless required by applicable law or agreed to in writing, software
674
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
675
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
676
- * Licence for the specific language governing permissions and limitations
677
- * under the Licence.
678
- * @licend
679
- * @module
680
- */
681
-
682
-
683
-
684
- const DEFAULT_COMPOSITE_OP = 'source-over';
685
-
686
- /**
687
- * BoxConnector allows users to visually connect two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects of an
688
- * {@link module:Activity.ActivityPanel ActivityPanel}. There are two modes of operation:
689
- *
690
- * - Drawing a line between an origin point (usually the point where the user clicks on) and a
691
- * destination point.
692
- * - Dragging the ActiveBox from one location to another.
693
- *
694
- * The connecting lines can have arrowheads at its endings.
695
- */
696
- class BoxConnector {
697
- /**
698
- * BoxConnector constructor
699
- * @param {module:AWT.Container} parent - The Container to which this BoxConnector belongs
700
- * @param {external:jQuery} $canvas - The HTML `canvas` element where this BoxConnector will draw.
701
- */
702
- constructor(parent, $canvas) {
703
- this.parent = parent;
704
- this.ctx = $canvas.get(-1).getContext('2d', { willReadFrequently: true });
705
- this.dim = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg(this.ctx.canvas.width, this.ctx.canvas.height);
706
- this.origin = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR();
707
- this.dest = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR();
708
- this.relativePos = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR();
709
- }
710
-
711
- /**
712
- * Displaces the ending point of the connector
713
- * @param {number} dx - Displacement on the X axis
714
- * @param {number} dy - Displacement on the Y axis
715
- */
716
- moveBy(dx, dy) {
717
- this.moveTo((0,_AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR)(this.dest.x + dx, this.dest.y + dy));
718
- }
719
-
720
- /**
721
- * Moves the ending point of the connector to a new position
722
- * @param {module:AWT.Point} pt - The new position
723
- * @param {boolean} forcePaint - When `true`, forces the repaint of all the area also if there is
724
- * no movement at all.
725
- */
726
- moveTo(pt, forcePaint) {
727
- if (!this.active || !forcePaint && this.dest.equals(pt))
728
- return;
729
-
730
- // Restore the background
731
- if (this.bgRect) {
732
- if (this.bgImg) {
733
- this.ctx.putImageData(
734
- this.bgImg,
735
- 0, 0,
736
- this.bgRect.pos.x, this.bgRect.pos.y,
737
- this.bgRect.dim.width, this.bgRect.dim.height);
738
- } else if (this.parent)
739
- this.parent.updateContent();
740
- }
741
-
742
- this.dest.moveTo(pt);
743
-
744
- // Calculate the bounds of the invalidated area after the move:
745
- // Start with the origin point or box area
746
- const pt1 = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
747
- this.bgRect = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(pt1, this.bx ? this.bx.dim : new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg());
748
- // Add the destination point or box area
749
- const pt2 = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(pt.x - this.relativePos.x, pt.y - this.relativePos.y);
750
- this.bgRect.add(new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Rectangle */ .M_(pt2, this.bx ? this.bx.dim : new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Dimension */ .fg()));
751
- // Add a generous border around the area
752
- this.bgRect.grow(10, 10);
753
-
754
- if (this.bx !== null) {
755
- // Move the ActiveBox
756
- this.bx.moveTo(new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(pt.x - this.relativePos.x, pt.y - this.relativePos.y));
757
- this.bx.setTemporaryHidden(false);
758
- this.bx.update(this.ctx, null);
759
- this.bx.setTemporaryHidden(true);
760
- } else {
761
- // Draw the connecting line
762
- this.drawLine();
763
- this.linePainted = true;
764
- }
765
- }
766
-
767
- /**
768
- * Starts the box connector operation
769
- * @param {module:AWT.Point} pt - Starting point
770
- * @param {module:boxes/ActiveBox.ActiveBox} [box] - Passed only when the BoxConnector runs in drag&drop mode
771
- */
772
- begin(pt, box) {
773
- if (this.active)
774
- this.end();
775
- this.origin.moveTo(pt);
776
- this.dest.moveTo(pt);
777
- this.linePainted = false;
778
- this.active = true;
779
-
780
- if (box) {
781
- // Remember what box will be moved, hide it from the panel and repaint all
782
- this.bx = box;
783
- this.relativePos.moveTo(pt.x - box.pos.x, pt.y - box.pos.y);
784
- this.bx.setFocused(true);
785
- this.bx.setTemporaryHidden(true);
786
- this.linePainted = false;
787
- this.parent.invalidate().update();
788
- }
789
-
790
- // Save the full image currently displayed on the panel (with the box hidden)
791
- try {
792
- this.bgImg = this.ctx.getImageData(0, 0, this.dim.width, this.dim.height);
793
- } catch (_ex) {
794
- // Avoid "canvas tainted by cross-origin data" errors
795
- // Setting bgImg to null is less efficient, but works
796
- this.bgImg = null;
797
- }
798
- this.bgRect = null;
799
-
800
- // Make a first movement to make the box appear
801
- if (box)
802
- this.moveTo(pt, true);
803
- }
804
-
805
- /**
806
- * Finalizes the operation of this box connector until a new call to `begin`
807
- */
808
- end() {
809
- if (!this.active)
810
- return;
811
-
812
- this.active = false;
813
- this.linePainted = false;
814
- this.bgRect = null;
815
- this.bgImg = null;
816
-
817
- if (this.bx) {
818
- // Restore the original position and attributes of the box
819
- this.bx.setFocused(false);
820
- this.bx.moveTo(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
821
- this.bx.setTemporaryHidden(false);
822
- this.bx = null;
823
- this.relativePos.moveTo(0, 0);
824
- }
825
-
826
- // Repaint all
827
- this.ctx.clearRect(0, 0, this.dim.width, this.dim.height);
828
- this.parent.invalidate().update();
829
- }
830
-
831
- /**
832
- * Strokes a line between `origin` and `dest`, optionally ended with an arrowhead.
833
- */
834
- drawLine() {
835
- if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
836
- this.ctx.strokeStyle = this.xorColor;
837
- this.ctx.globalCompositeOperation = this.compositeOp;
838
- } else
839
- this.ctx.strokeStyle = this.lineColor;
840
-
841
- this.ctx.lineWidth = this.lineWidth;
842
-
843
- this.ctx.beginPath();
844
- this.ctx.moveTo(this.origin.x, this.origin.y);
845
- this.ctx.lineTo(this.dest.x, this.dest.y);
846
- this.ctx.stroke();
847
-
848
- if (this.arrow) {
849
- // Draws the arrow head
850
- const
851
- beta = Math.atan2(this.origin.x - this.dest.x, this.dest.x - this.origin.x),
852
- arp = new _AWT_js__WEBPACK_IMPORTED_MODULE_0__/* .Point */ .bR(this.dest.x - this.arrowLength * Math.cos(beta + this.arrowAngle),
853
- this.dest.y + this.arrowLength * Math.sin(beta + this.arrowAngle));
854
- this.ctx.beginPath();
855
- this.ctx.moveTo(this.dest.x, this.dest.y);
856
- this.ctx.lineTo(arp.x, arp.y);
857
- this.ctx.stroke();
858
-
859
- arp.moveTo(this.dest.x - this.arrowLength * Math.cos(beta - this.arrowAngle),
860
- this.dest.y + this.arrowLength * Math.sin(beta - this.arrowAngle));
861
- this.ctx.beginPath();
862
- this.ctx.moveTo(this.dest.x, this.dest.y);
863
- this.ctx.lineTo(arp.x, arp.y);
864
- this.ctx.stroke();
865
- }
866
- if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
867
- // reset default settings
868
- this.ctx.globalCompositeOperation = DEFAULT_COMPOSITE_OP;
869
- }
870
- }
871
- }
872
-
873
- Object.assign(BoxConnector.prototype, {
874
- /**
875
- * The background image, saved and redrawn on each movement
876
- * @name module:boxes/BoxConnector.BoxConnector#bgImg
877
- * @type {external:HTMLImageElement} */
878
- bgImg: null,
879
- /**
880
- * The rectangle of {@link module:Activity.ActivityPanel ActivityPanel} saved in `bgImg`
881
- * @name module:boxes/BoxConnector.BoxConnector#bgRect
882
- * @type {module:AWT.Rectangle} */
883
- bgRect: null,
884
- /**
885
- * Initial position of the connector
886
- * @name module:boxes/BoxConnector.BoxConnector#origin
887
- * @type {module:AWT.Point} */
888
- origin: null,
889
- /**
890
- * Current (while moving) and final position of the connector
891
- * @name module:boxes/BoxConnector.BoxConnector#dest
892
- * @type {module:AWT.Point} */
893
- dest: null,
894
- /**
895
- * When `true`, the connector must end on arrowhead
896
- * @name module:boxes/BoxConnector.BoxConnector#arrow
897
- * @type {boolean} */
898
- arrow: false,
899
- /**
900
- * `true` while the connector is active
901
- * @name module:boxes/BoxConnector.BoxConnector#active
902
- * @type {boolean} */
903
- active: false,
904
- /**
905
- * `true` while the line has already been painted (used for XOR expressions)
906
- * @name module:boxes/BoxConnector.BoxConnector#linePainted
907
- * @type {boolean} */
908
- linePainted: false,
909
- /**
910
- * The arrowhead length (in pixels)
911
- * @name module:boxes/BoxConnector.BoxConnector#arrowLength
912
- * @type {number} */
913
- arrowLength: 10,
914
- /**
915
- * The arrowhead angle
916
- * @name module:boxes/BoxConnector.BoxConnector#arrowAngle
917
- * @type {number} */
918
- arrowAngle: Math.PI / 6,
919
- /**
920
- * The main color used in XOR operations
921
- * @name module:boxes/BoxConnector.BoxConnector#lineColor
922
- * @type {string} */
923
- lineColor: 'black',
924
- /**
925
- * The complementary color used in XOR operations
926
- * @name module:boxes/BoxConnector.BoxConnector#xorColor
927
- * @type {string} */
928
- xorColor: 'white',
929
- /**
930
- * The global composite operator used when drawing in XOR mode. Default is "difference".
931
- * For a list of possible values see:
932
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation}
933
- * @name module:boxes/BoxConnector.BoxConnector#compositeOp
934
- * @type {string} */
935
- compositeOp: 'difference',
936
- /**
937
- * The default {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation composite operator}
938
- * ("source-over").
939
- * @name module:boxes/BoxConnector.BoxConnector#DEFAULT_COMPOSITE_OP
940
- * @static
941
- * @type {string} */
942
- DEFAULT_COMPOSITE_OP: DEFAULT_COMPOSITE_OP,
943
- /**
944
- * Relative position of point B regarding A
945
- * @name module:boxes/BoxConnector.BoxConnector#relativePos
946
- * @type {module:AWT.Point} */
947
- relativePos: null,
948
- /**
949
- * The ActiveBox to connect or move
950
- * @name module:boxes/BoxConnector.BoxConnector#bx
951
- * @type {module:boxes/ActiveBox.ActiveBox} */
952
- bx: null,
953
- /**
954
- * The Graphics context where the BoxConnector will paint
955
- * @name module:boxes/BoxConnector.BoxConnector#ctx
956
- * @type {external:CanvasRenderingContext2D} */
957
- ctx: null,
958
- /**
959
- * The dimension of the HTML canvas where to draw
960
- * @name module:boxes/BoxConnector.BoxConnector#dim
961
- * @type {module:AWT.Dimension} */
962
- dim: null,
963
- /**
964
- * The container to which this connector belongs
965
- * @name module:boxes/BoxConnector.BoxConnector#parent
966
- * @type {module:AWT.Container} */
967
- parent: null,
968
- /**
969
- * Width of the connector line
970
- * @name module:boxes/BoxConnector.BoxConnector#lineWidth
971
- * @type {number} */
972
- lineWidth: 1.5,
973
- });
974
-
975
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BoxConnector);
976
-
977
-
978
- /***/ })
979
-
980
- };
981
- ;
982
- //# sourceMappingURL=3653.jclic-node.js.map