jclic 2.1.21 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/jclic-node.js +1 -1
- package/dist/jclic-node.js.map +1 -1
- package/dist/jclic.min.js +2 -2
- package/dist/jclic.min.js.map +1 -1
- package/package.json +1 -1
- package/src/GlobalData.js +1 -1
- package/dist/1078.jclic-node.js +0 -282
- package/dist/1078.jclic-node.js.map +0 -1
- package/dist/1196.jclic-node.js +0 -808
- package/dist/1196.jclic-node.js.map +0 -1
- package/dist/1253.jclic-node.js +0 -1432
- package/dist/1253.jclic-node.js.map +0 -1
- package/dist/13.jclic-node.js +0 -103
- package/dist/13.jclic-node.js.map +0 -1
- package/dist/1567.jclic-node.js +0 -2313
- package/dist/1567.jclic-node.js.map +0 -1
- package/dist/1588.jclic-node.js +0 -602
- package/dist/1588.jclic-node.js.map +0 -1
- package/dist/1725.jclic-node.js +0 -836
- package/dist/1725.jclic-node.js.map +0 -1
- package/dist/1731.jclic-node.js +0 -438
- package/dist/1731.jclic-node.js.map +0 -1
- package/dist/1842.jclic-node.js +0 -651
- package/dist/1842.jclic-node.js.map +0 -1
- package/dist/2160.jclic-node.js +0 -1016
- package/dist/2160.jclic-node.js.map +0 -1
- package/dist/222.jclic-node.js +0 -129
- package/dist/222.jclic-node.js.map +0 -1
- package/dist/2316.jclic-node.js +0 -949
- package/dist/2316.jclic-node.js.map +0 -1
- package/dist/2355.jclic-node.js +0 -371
- package/dist/2355.jclic-node.js.map +0 -1
- package/dist/2366.jclic-node.js +0 -431
- package/dist/2366.jclic-node.js.map +0 -1
- package/dist/2379.jclic-node.js +0 -202
- package/dist/2379.jclic-node.js.map +0 -1
- package/dist/2437.jclic-node.js +0 -450
- package/dist/2437.jclic-node.js.map +0 -1
- package/dist/2531.jclic-node.js +0 -869
- package/dist/2531.jclic-node.js.map +0 -1
- package/dist/2608.jclic-node.js +0 -160
- package/dist/2608.jclic-node.js.map +0 -1
- package/dist/2715.jclic-node.js +0 -554
- package/dist/2715.jclic-node.js.map +0 -1
- package/dist/277.jclic-node.js +0 -22
- package/dist/277.jclic-node.js.map +0 -1
- package/dist/2921.jclic-node.js +0 -660
- package/dist/2921.jclic-node.js.map +0 -1
- package/dist/2952.jclic-node.js +0 -101
- package/dist/2952.jclic-node.js.map +0 -1
- package/dist/3018.jclic-node.js +0 -421
- package/dist/3018.jclic-node.js.map +0 -1
- package/dist/3019.jclic-node.js +0 -682
- package/dist/3019.jclic-node.js.map +0 -1
- package/dist/3231.jclic-node.js +0 -274
- package/dist/3231.jclic-node.js.map +0 -1
- package/dist/331.jclic-node.js +0 -115
- package/dist/331.jclic-node.js.map +0 -1
- package/dist/3391.jclic-node.js +0 -276
- package/dist/3391.jclic-node.js.map +0 -1
- package/dist/3502.jclic-node.js +0 -671
- package/dist/3502.jclic-node.js.map +0 -1
- package/dist/3653.jclic-node.js +0 -982
- package/dist/3653.jclic-node.js.map +0 -1
- package/dist/371.jclic.min.js +0 -2
- package/dist/371.jclic.min.js.map +0 -1
- package/dist/3856.jclic-node.js +0 -575
- package/dist/3856.jclic-node.js.map +0 -1
- package/dist/4112.jclic-node.js +0 -659
- package/dist/4112.jclic-node.js.map +0 -1
- package/dist/4123.jclic-node.js +0 -910
- package/dist/4123.jclic-node.js.map +0 -1
- package/dist/427.jclic-node.js +0 -894
- package/dist/427.jclic-node.js.map +0 -1
- package/dist/4483.jclic-node.js +0 -327
- package/dist/4483.jclic-node.js.map +0 -1
- package/dist/4548.jclic-node.js +0 -1078
- package/dist/4548.jclic-node.js.map +0 -1
- package/dist/466.jclic-node.js +0 -99
- package/dist/466.jclic-node.js.map +0 -1
- package/dist/485.jclic-node.js +0 -783
- package/dist/485.jclic-node.js.map +0 -1
- package/dist/4921.jclic-node.js +0 -500
- package/dist/4921.jclic-node.js.map +0 -1
- package/dist/5091.jclic-node.js +0 -239
- package/dist/5091.jclic-node.js.map +0 -1
- package/dist/520.jclic-node.js +0 -550
- package/dist/520.jclic-node.js.map +0 -1
- package/dist/5312.jclic-node.js +0 -1126
- package/dist/5312.jclic-node.js.map +0 -1
- package/dist/5338.jclic-node.js +0 -212
- package/dist/5338.jclic-node.js.map +0 -1
- package/dist/5344.jclic-node.js +0 -229
- package/dist/5344.jclic-node.js.map +0 -1
- package/dist/5550.jclic-node.js +0 -238
- package/dist/5550.jclic-node.js.map +0 -1
- package/dist/5626.jclic-node.js +0 -614
- package/dist/5626.jclic-node.js.map +0 -1
- package/dist/5977.jclic-node.js +0 -1081
- package/dist/5977.jclic-node.js.map +0 -1
- package/dist/6148.jclic-node.js +0 -345
- package/dist/6148.jclic-node.js.map +0 -1
- package/dist/6176.jclic-node.js +0 -481
- package/dist/6176.jclic-node.js.map +0 -1
- package/dist/6221.jclic-node.js +0 -1072
- package/dist/6221.jclic-node.js.map +0 -1
- package/dist/6238.jclic-node.js +0 -718
- package/dist/6238.jclic-node.js.map +0 -1
- package/dist/6454.jclic-node.js +0 -1413
- package/dist/6454.jclic-node.js.map +0 -1
- package/dist/6565.jclic-node.js +0 -294
- package/dist/6565.jclic-node.js.map +0 -1
- package/dist/6579.jclic-node.js +0 -719
- package/dist/6579.jclic-node.js.map +0 -1
- package/dist/6715.jclic-node.js +0 -148
- package/dist/6715.jclic-node.js.map +0 -1
- package/dist/6777.jclic-node.js +0 -171
- package/dist/6777.jclic-node.js.map +0 -1
- package/dist/6782.jclic-node.js +0 -1611
- package/dist/6782.jclic-node.js.map +0 -1
- package/dist/6847.jclic-node.js +0 -601
- package/dist/6847.jclic-node.js.map +0 -1
- package/dist/6856.jclic-node.js +0 -252
- package/dist/6856.jclic-node.js.map +0 -1
- package/dist/696.jclic-node.js +0 -1821
- package/dist/696.jclic-node.js.map +0 -1
- package/dist/698.jclic-node.js +0 -583
- package/dist/698.jclic-node.js.map +0 -1
- package/dist/704.jclic-node.js +0 -80
- package/dist/704.jclic-node.js.map +0 -1
- package/dist/7046.jclic-node.js +0 -735
- package/dist/7046.jclic-node.js.map +0 -1
- package/dist/7220.jclic-node.js +0 -156
- package/dist/7220.jclic-node.js.map +0 -1
- package/dist/7257.jclic-node.js +0 -931
- package/dist/7257.jclic-node.js.map +0 -1
- package/dist/743.jclic-node.js +0 -583
- package/dist/743.jclic-node.js.map +0 -1
- package/dist/757.jclic-node.js +0 -1072
- package/dist/757.jclic-node.js.map +0 -1
- package/dist/7781.jclic-node.js +0 -202
- package/dist/7781.jclic-node.js.map +0 -1
- package/dist/7912.jclic-node.js +0 -2103
- package/dist/7912.jclic-node.js.map +0 -1
- package/dist/827.jclic-node.js +0 -708
- package/dist/827.jclic-node.js.map +0 -1
- package/dist/8276.jclic-node.js +0 -409
- package/dist/8276.jclic-node.js.map +0 -1
- package/dist/8322.jclic-node.js +0 -498
- package/dist/8322.jclic-node.js.map +0 -1
- package/dist/8641.jclic-node.js +0 -360
- package/dist/8641.jclic-node.js.map +0 -1
- package/dist/8837.jclic-node.js +0 -651
- package/dist/8837.jclic-node.js.map +0 -1
- package/dist/8895.jclic-node.js +0 -151
- package/dist/8895.jclic-node.js.map +0 -1
- package/dist/9072.jclic-node.js +0 -1285
- package/dist/9072.jclic-node.js.map +0 -1
- package/dist/9078.jclic-node.js +0 -935
- package/dist/9078.jclic-node.js.map +0 -1
- package/dist/9103.jclic-node.js +0 -718
- package/dist/9103.jclic-node.js.map +0 -1
- package/dist/9359.jclic-node.js +0 -145
- package/dist/9359.jclic-node.js.map +0 -1
- package/dist/9409.jclic-node.js +0 -921
- package/dist/9409.jclic-node.js.map +0 -1
- package/dist/9513.jclic-node.js +0 -720
- package/dist/9513.jclic-node.js.map +0 -1
- package/dist/9704.jclic-node.js +0 -81
- package/dist/9704.jclic-node.js.map +0 -1
- package/dist/9950.jclic-node.js +0 -827
- package/dist/9950.jclic-node.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"485.jclic-node.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEuB;AACkB;AACuC;AACzB;AAClB;;AAErC;AACA;AACA;AACA;AACA;AACO,wBAAwB,2EAAgB;AAC/C;AACA;AACA,aAAa,0CAA0C;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,wCAAwC;AACpD;AACA,CAAC;;AAED;AACA,QAAQ,2FAA2F,OAAO,4DAA4D;AACtK;AACA;AACO,6BAA6B,gFAAqB;AACzD;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F,aAAa,gCAAgC;AAC7C;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,6CAAC,mBAAmB,eAAe,YAAY,gBAAgB;AACpF;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,oBAAoB,8DAAY;AAChC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,wDAAwD;AACrE,aAAa,iBAAiB;AAC9B;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA,6BAA6B,MAAM,wBAAwB,YAAY;AACvE;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,aAAa,wDAAwD;AACrE,aAAa,wDAAwD;AACrE;AACA;AACA;AACA;AACA;AACA,gBAAgB,6CAAC;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,QAAQ;AACR;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,0DAA0D;AACvE;AACA,2BAA2B,wCAAwC;AACnE,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,wDAAwD;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA,kCAAkC,UAAU;AAC5C;;AAEA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA,IAAI,6CAAC;AACL;AACA;;AAEA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B,eAAe,SAAS;AACxB,6CAA6C;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,oDAAK;AAC7D;AACA;AACA;AACA;AACA;AACA,gBAAgB,oDAAK;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,6EAA6E;AACzF;AACA;AACA;AACA;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA,CAAC;;AAED;AACA,qDAAqD;AACrD,UAAU,OAAO;AACjB;;AAEA;AACA,iEAAe,oDAAQ,wCAAwC,EAAC;;;;;;;;;;;;;ACpahE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEwD;;AAExD;;AAEA;AACA,sDAAsD,kDAAkD;AACxG,IAAI,kDAAkD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,sBAAsB;AACnC,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA,kDAAkD,0BAA0B;AAC5E,mBAAmB,wDAAS;AAC5B,sBAAsB,oDAAK;AAC3B,oBAAoB,oDAAK;AACzB,2BAA2B,oDAAK;AAChC;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA,gBAAgB,wDAAK;AACrB;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,oDAAK;AACzB,sBAAsB,wDAAS,kCAAkC,wDAAS;AAC1E;AACA,oBAAoB,oDAAK;AACzB,wBAAwB,wDAAS,kCAAkC,wDAAS;AAC5E;AACA;;AAEA;AACA;AACA,yBAAyB,oDAAK;AAC9B;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B,aAAa,kCAAkC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,oDAAK;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA,uBAAuB,mDAAmD;AAC1E;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,YAAY,QAAQ;AACpB;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA,YAAY,kCAAkC;AAC9C;AACA;AACA;AACA;AACA,YAAY,mCAAmC;AAC/C;AACA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED,iEAAe,YAAY,EAAC","sources":["webpack://jclic/./src/activities/text/OrderText.js","webpack://jclic/./src/boxes/BoxConnector.js"],"sourcesContent":["/**\n * File : activities/text/OrderText.js\n * Created : 20/06/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport $ from 'jquery';\nimport Activity from '../../Activity.js';\nimport { TextActivityBase, TextActivityBasePanel } from './TextActivityBase.js';\nimport BoxConnector from '../../boxes/BoxConnector.js';\nimport { Point } from '../../AWT.js';\n\n/**\n * In this type of text activity users must put in order some words or paragraphs that have been\n * initially shuffled.\n * @extends module:activities/text/TextActivityBase.TextActivityBase\n */\nexport class OrderText extends TextActivityBase {\n /**\n * OrderText constructor\n * @param {module:project/JClicProject.JClicProject} project - The project to which this activity belongs\n */\n constructor(project) {\n super(project);\n }\n\n /**\n * Whether or not the activity uses random to shuffle internal components\n * @override\n * @returns {boolean}\n */\n hasRandom() {\n return true;\n }\n\n /**\n * When `true`, the activity must always be shuffled\n * @override\n * @returns {boolean}\n */\n shuffleAlways() {\n return true;\n }\n\n /**\n * Whether the activity allows the user to request help.\n * @override\n * @returns {boolean}\n */\n helpSolutionAllowed() {\n return true;\n }\n}\n\nObject.assign(OrderText.prototype, {\n /**\n * Whether to allow or not to shuffle words among different paragraphs.\n * @name module:activities/text/OrderText.OrderText#amongParagraphs\n * @type {boolean} */\n amongParagraphs: false,\n /**\n * The box connector\n * @name module:activities/text/OrderText.OrderText#bc\n * @type {module:boxes/BoxConnector.BoxConnector} */\n bc: null,\n});\n\n/**\n * The {@link module:activities/text/TextActivityBase.TextActivityBasePanel TextActivityBasePanel} where {@link module:activities/text/OrderText.OrderText OrderText} activities are played.\n * @extends module:activities/text/TextActivityBase.TextActivityBasePanel\n */\nexport class OrderTextPanel extends TextActivityBasePanel {\n /**\n * OrderTextPanel constructor\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} to which this Panel belongs\n * @param {module:JClicPlayer.JClicPlayer} ps - Any object implementing the methods defined in the\n * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) Java interface.\n * @param {external:jQuery} [$div] - The jQuery DOM element where this Panel will deploy\n */\n constructor(act, ps, $div) {\n super(act, ps, $div);\n }\n\n /**\n * Prepares the text panel\n * @override\n */\n buildVisualComponents() {\n this.act.document.style['target'].css.cursor = 'pointer';\n super.buildVisualComponents();\n }\n\n /**\n * Sets the size and position of this activity panel\n * @override\n * @param {module:AWT.Rectangle} rect\n */\n setBounds(rect) {\n if (this.$canvas)\n this.$canvas.remove();\n\n super.setBounds(rect);\n if (!this.act.dragCells) {\n // Create the main canvas\n this.$canvas = $(`<canvas width=\"${rect.dim.width}\" height=\"${rect.dim.height}\"/>`).css({\n position: 'absolute',\n top: 0,\n left: 0,\n 'pointer-events': 'none'\n });\n this.$div.append(this.$canvas);\n\n // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context\n this.bc = new BoxConnector(this, this.$canvas);\n this.bc.compositeOp = this.bc.DEFAULT_COMPOSITE_OP;\n\n // Repaint all\n this.invalidate().update();\n }\n }\n\n /**\n * Creates a target DOM element for the provided target.\n * @override\n * @param {module:activities/text/TextActivityDocument.TextTarget} target - The target related to the DOM object to be created\n * @param {external:jQuery} $span - - An initial DOM object (usually a `span`) that can be used\n * to store the target, or replaced by another type of object.\n * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.\n */\n $createTargetElement(target, $span) {\n super.$createTargetElement(target, $span);\n const idLabel = `target${`000${this.targets.length - 1}`.slice(-3)}`;\n $span.addClass('JClicTextTarget').bind('click', event => {\n event.textTarget = target;\n event.idLabel = idLabel;\n this.processEvent(event);\n });\n return $span;\n }\n\n /**\n * Swaps the position of two targets in the document\n * @param {module:activities/text/TextActivityDocument.TextTarget} t1 - One target\n * @param {module:activities/text/TextActivityDocument.TextTarget} t2 - Another target\n */\n swapTargets(t1, t2) {\n const\n $span1 = t1.$span,\n $span2 = t2.$span,\n $marker = $('<span/>');\n $marker.insertAfter($span2);\n $span2.detach();\n $span2.insertAfter($span1);\n $span1.detach();\n $span1.insertAfter($marker);\n $marker.remove();\n\n const\n pos = t1.pos,\n $p = t1.$p;\n t1.pos = t2.pos;\n t1.$p = t2.$p;\n t2.pos = pos;\n t2.$p = $p;\n }\n\n /**\n * Basic initialization procedure\n * @override\n */\n initActivity() {\n super.initActivity();\n if (!this.firstRun)\n this.buildVisualComponents();\n else\n this.firstRun = false;\n }\n\n /**\n * Called when the activity starts playing\n * @override\n */\n startActivity() {\n super.startActivity();\n if (!this.showingPrevScreen) {\n if (this.act.type === 'orderWords' && !this.act.amongParagraphs) {\n // Group targets by paragraph\n const groups = [];\n let\n lastTarget = null,\n currentGroup = [];\n this.targets.forEach(t => {\n if (lastTarget !== null && lastTarget.$p !== t.$p) {\n groups.push(currentGroup);\n currentGroup = [];\n }\n currentGroup.push(t);\n lastTarget = t;\n });\n if (currentGroup.length > 0)\n groups.push(currentGroup);\n\n // Scramble group by group\n groups.forEach(group => this.shuffleTargets(group, this.act.shuffles));\n } else\n this.shuffleTargets(this.targets, this.act.shuffles);\n\n this.playing = true;\n }\n this.setBounds(this);\n }\n\n /**\n * Randomly shuffles a set of targets\n * @param {module:activities/text/TextActivityDocument.TextTarget[]} targets - The set of targets to shuffle (can be all\n * document targets or just the targets belonging to the same paragraph, depending on the value of\n * `amongParagraphs` in {@link module:Activity.Activity Activity}.\n * @param {number} steps - The number of times to shuffle the elements\n */\n shuffleTargets(targets, steps) {\n const nt = targets.length;\n if (nt > 1) {\n let repeatCount = 100;\n for (let i = 0; i < steps; i++) {\n const\n r1 = Math.floor(Math.random() * nt),\n r2 = Math.floor(Math.random() * nt);\n if (r1 !== r2) {\n this.swapTargets(targets[r1], targets[r2]);\n } else {\n if (--repeatCount)\n i++;\n }\n }\n }\n }\n\n /**\n * Sets the current target\n * @param {module:activities/text/TextActivityDocument.TextTarget} target - The currently selected target. Can be `null`.\n */\n setCurrentTarget(target) {\n const targetCss = this.act.document.getFullStyle('target').css;\n if (this.currentTarget && this.currentTarget.$span)\n this.currentTarget.$span.css(targetCss);\n if (target && target.$span) {\n target.$span.css({\n color: targetCss['background-color'],\n 'background-color': targetCss.color\n });\n }\n this.currentTarget = target;\n }\n\n /**\n * Counts the number of targets that are at right position\n * @returns {number}\n */\n countSolvedTargets() {\n return this.targets.filter(({ num, pos }) => num === pos).length;\n }\n\n /**\n * Evaluates all the targets in this panel. This method is usually called from the `Check` button.\n * @override\n * @returns {boolean} - `true` when all targets are OK, `false` otherwise.\n */\n evaluatePanel() {\n if (this.bc && this.bc.active)\n this.bc.end();\n this.setCurrentTarget(null);\n\n let targetsOk = 0;\n this.targets.forEach(target => {\n const ok = target.num === target.pos;\n target.targetStatus = ok ? 'SOLVED' : 'WITH_ERROR';\n if (ok)\n targetsOk++;\n target.checkColors();\n this.ps.reportNewAction(this.act, 'PLACE', target.text, target.pos, ok, targetsOk);\n });\n if (targetsOk === this.targets.length) {\n this.finishActivity(true);\n return true;\n } else {\n this.playEvent('finishedError');\n }\n return false;\n }\n\n /**\n * Ordinary ending of the activity, usually called form `processEvent`\n * @override\n * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise\n */\n finishActivity(result) {\n $('.JClicTextTarget').css('cursor', 'pointer');\n return super.finishActivity(result);\n }\n\n /**\n * Main handler used to process mouse, touch, keyboard and edit events.\n * @override\n * @param {external:Event} event - The HTML event to be processed\n * @returns {boolean} - When this event handler returns `false`, jQuery will stop its\n * propagation through the DOM tree. See: {@link http://api.jquery.com/on}\n */\n processEvent(event) {\n if (!super.processEvent(event))\n return false;\n\n const target = event.textTarget;\n let p = null;\n if (this.bc && this.playing && !this.showingPrevScreen) {\n //\n // _touchend_ event don't provide pageX nor pageY information\n if (event.type === 'touchend')\n p = this.bc.active ? this.bc.dest.clone() : new Point();\n else {\n // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`\n const\n x = event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,\n y = event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;\n p = new Point(x - this.$div.offset().left, y - this.$div.offset().top);\n }\n\n switch (event.type) {\n case 'click':\n if (target && target !== this.currentTarget) {\n if (this.currentTarget) {\n if (this.bc && this.bc.active)\n this.bc.end();\n this.swapTargets(target, this.currentTarget);\n this.setCurrentTarget(null);\n\n if (!this.$checkButton) {\n // Check and notify action\n const\n cellsAtPlace = this.countSolvedTargets(),\n ok = target.pos === target.num;\n this.ps.reportNewAction(this.act, 'PLACE', target.text, target.pos, ok, cellsAtPlace);\n\n // End activity or play event sound\n if (ok && cellsAtPlace === this.targets.length)\n this.finishActivity(true);\n else\n this.playEvent(ok ? 'actionOk' : 'actionError');\n }\n } else {\n this.setCurrentTarget(target);\n this.bc.begin(p);\n this.playEvent('click');\n }\n }\n break;\n\n case 'mousemove':\n this.bc.moveTo(p);\n break;\n\n default:\n break;\n }\n event.preventDefault();\n return true;\n }\n }\n}\n\n// Properties and methods specific to OrderTextPanel\nObject.assign(OrderTextPanel.prototype, {\n /**\n * Currently selected text target\n * @name module:activities/text/OrderText.OrderTextPanel#currentTarget\n * @type {module:activities/text/TextActivityDocument.TextActivityDocument.TextTarget} */\n currentTarget: null,\n /**\n * The box connector\n * @name module:activities/text/OrderText.OrderTextPanel#bc\n * @type {module:boxes/BoxConnector.BoxConnector} */\n bc: null,\n /**\n * List of mouse, touch and keyboard events intercepted by this panel\n * @override\n * @name module:activities/text/OrderText.OrderTextPanel#events\n * @type {string[]} */\n events: ['click', 'mousemove'],\n});\n\n/**\n * Panel class associated to this type of activity: {@link module:activities/text/OrderText.OrderTextPanel OrderTextPanel}\n * @type {class} */\nOrderText.Panel = OrderTextPanel;\n\n// Register activity class\nexport default Activity.registerClass('@text.Order', OrderText);\n","/**\n * File : boxes/BoxConnector.js\n * Created : 26/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport { Point, Dimension, Rectangle } from '../AWT.js';\n\nconst DEFAULT_COMPOSITE_OP = 'source-over';\n\n/**\n * BoxConnector allows users to visually connect two {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects of an\n * {@link module:Activity.ActivityPanel ActivityPanel}. There are two modes of operation:\n *\n * - Drawing a line between an origin point (usually the point where the user clicks on) and a\n * destination point.\n * - Dragging the ActiveBox from one location to another.\n *\n * The connecting lines can have arrowheads at its endings.\n */\nexport class BoxConnector {\n /**\n * BoxConnector constructor\n * @param {module:AWT.Container} parent - The Container to which this BoxConnector belongs\n * @param {external:jQuery} $canvas - The HTML `canvas` element where this BoxConnector will draw.\n */\n constructor(parent, $canvas) {\n this.parent = parent;\n this.ctx = $canvas.get(-1).getContext('2d', { willReadFrequently: true });\n this.dim = new Dimension(this.ctx.canvas.width, this.ctx.canvas.height);\n this.origin = new Point();\n this.dest = new Point();\n this.relativePos = new Point();\n }\n\n /**\n * Displaces the ending point of the connector\n * @param {number} dx - Displacement on the X axis\n * @param {number} dy - Displacement on the Y axis\n */\n moveBy(dx, dy) {\n this.moveTo(Point(this.dest.x + dx, this.dest.y + dy));\n }\n\n /**\n * Moves the ending point of the connector to a new position\n * @param {module:AWT.Point} pt - The new position\n * @param {boolean} forcePaint - When `true`, forces the repaint of all the area also if there is\n * no movement at all.\n */\n moveTo(pt, forcePaint) {\n if (!this.active || !forcePaint && this.dest.equals(pt))\n return;\n\n // Restore the background\n if (this.bgRect) {\n if (this.bgImg) {\n this.ctx.putImageData(\n this.bgImg,\n 0, 0,\n this.bgRect.pos.x, this.bgRect.pos.y,\n this.bgRect.dim.width, this.bgRect.dim.height);\n } else if (this.parent)\n this.parent.updateContent();\n }\n\n this.dest.moveTo(pt);\n\n // Calculate the bounds of the invalidated area after the move:\n // Start with the origin point or box area\n const pt1 = new Point(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);\n this.bgRect = new Rectangle(pt1, this.bx ? this.bx.dim : new Dimension());\n // Add the destination point or box area\n const pt2 = new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y);\n this.bgRect.add(new Rectangle(pt2, this.bx ? this.bx.dim : new Dimension()));\n // Add a generous border around the area\n this.bgRect.grow(10, 10);\n\n if (this.bx !== null) {\n // Move the ActiveBox\n this.bx.moveTo(new Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y));\n this.bx.setTemporaryHidden(false);\n this.bx.update(this.ctx, null);\n this.bx.setTemporaryHidden(true);\n } else {\n // Draw the connecting line\n this.drawLine();\n this.linePainted = true;\n }\n }\n\n /**\n * Starts the box connector operation\n * @param {module:AWT.Point} pt - Starting point\n * @param {module:boxes/ActiveBox.ActiveBox} [box] - Passed only when the BoxConnector runs in drag&drop mode\n */\n begin(pt, box) {\n if (this.active)\n this.end();\n this.origin.moveTo(pt);\n this.dest.moveTo(pt);\n this.linePainted = false;\n this.active = true;\n\n if (box) {\n // Remember what box will be moved, hide it from the panel and repaint all\n this.bx = box;\n this.relativePos.moveTo(pt.x - box.pos.x, pt.y - box.pos.y);\n this.bx.setFocused(true);\n this.bx.setTemporaryHidden(true);\n this.linePainted = false;\n this.parent.invalidate().update();\n }\n\n // Save the full image currently displayed on the panel (with the box hidden)\n try {\n this.bgImg = this.ctx.getImageData(0, 0, this.dim.width, this.dim.height);\n } catch (_ex) {\n // Avoid \"canvas tainted by cross-origin data\" errors\n // Setting bgImg to null is less efficient, but works\n this.bgImg = null;\n }\n this.bgRect = null;\n\n // Make a first movement to make the box appear\n if (box)\n this.moveTo(pt, true);\n }\n\n /**\n * Finalizes the operation of this box connector until a new call to `begin`\n */\n end() {\n if (!this.active)\n return;\n\n this.active = false;\n this.linePainted = false;\n this.bgRect = null;\n this.bgImg = null;\n\n if (this.bx) {\n // Restore the original position and attributes of the box\n this.bx.setFocused(false);\n this.bx.moveTo(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);\n this.bx.setTemporaryHidden(false);\n this.bx = null;\n this.relativePos.moveTo(0, 0);\n }\n\n // Repaint all\n this.ctx.clearRect(0, 0, this.dim.width, this.dim.height);\n this.parent.invalidate().update();\n }\n\n /**\n * Strokes a line between `origin` and `dest`, optionally ended with an arrowhead.\n */\n drawLine() {\n if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {\n this.ctx.strokeStyle = this.xorColor;\n this.ctx.globalCompositeOperation = this.compositeOp;\n } else\n this.ctx.strokeStyle = this.lineColor;\n\n this.ctx.lineWidth = this.lineWidth;\n\n this.ctx.beginPath();\n this.ctx.moveTo(this.origin.x, this.origin.y);\n this.ctx.lineTo(this.dest.x, this.dest.y);\n this.ctx.stroke();\n\n if (this.arrow) {\n // Draws the arrow head\n const\n beta = Math.atan2(this.origin.x - this.dest.x, this.dest.x - this.origin.x),\n arp = new Point(this.dest.x - this.arrowLength * Math.cos(beta + this.arrowAngle),\n this.dest.y + this.arrowLength * Math.sin(beta + this.arrowAngle));\n this.ctx.beginPath();\n this.ctx.moveTo(this.dest.x, this.dest.y);\n this.ctx.lineTo(arp.x, arp.y);\n this.ctx.stroke();\n\n arp.moveTo(this.dest.x - this.arrowLength * Math.cos(beta - this.arrowAngle),\n this.dest.y + this.arrowLength * Math.sin(beta - this.arrowAngle));\n this.ctx.beginPath();\n this.ctx.moveTo(this.dest.x, this.dest.y);\n this.ctx.lineTo(arp.x, arp.y);\n this.ctx.stroke();\n }\n if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {\n // reset default settings\n this.ctx.globalCompositeOperation = DEFAULT_COMPOSITE_OP;\n }\n }\n}\n\nObject.assign(BoxConnector.prototype, {\n /**\n * The background image, saved and redrawn on each movement\n * @name module:boxes/BoxConnector.BoxConnector#bgImg\n * @type {external:HTMLImageElement} */\n bgImg: null,\n /**\n * The rectangle of {@link module:Activity.ActivityPanel ActivityPanel} saved in `bgImg`\n * @name module:boxes/BoxConnector.BoxConnector#bgRect\n * @type {module:AWT.Rectangle} */\n bgRect: null,\n /**\n * Initial position of the connector\n * @name module:boxes/BoxConnector.BoxConnector#origin\n * @type {module:AWT.Point} */\n origin: null,\n /**\n * Current (while moving) and final position of the connector\n * @name module:boxes/BoxConnector.BoxConnector#dest\n * @type {module:AWT.Point} */\n dest: null,\n /**\n * When `true`, the connector must end on arrowhead\n * @name module:boxes/BoxConnector.BoxConnector#arrow\n * @type {boolean} */\n arrow: false,\n /**\n * `true` while the connector is active\n * @name module:boxes/BoxConnector.BoxConnector#active\n * @type {boolean} */\n active: false,\n /**\n * `true` while the line has already been painted (used for XOR expressions)\n * @name module:boxes/BoxConnector.BoxConnector#linePainted\n * @type {boolean} */\n linePainted: false,\n /**\n * The arrowhead length (in pixels)\n * @name module:boxes/BoxConnector.BoxConnector#arrowLength\n * @type {number} */\n arrowLength: 10,\n /**\n * The arrowhead angle\n * @name module:boxes/BoxConnector.BoxConnector#arrowAngle\n * @type {number} */\n arrowAngle: Math.PI / 6,\n /**\n * The main color used in XOR operations\n * @name module:boxes/BoxConnector.BoxConnector#lineColor\n * @type {string} */\n lineColor: 'black',\n /**\n * The complementary color used in XOR operations\n * @name module:boxes/BoxConnector.BoxConnector#xorColor\n * @type {string} */\n xorColor: 'white',\n /**\n * The global composite operator used when drawing in XOR mode. Default is \"difference\".\n * For a list of possible values see:\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation}\n * @name module:boxes/BoxConnector.BoxConnector#compositeOp\n * @type {string} */\n compositeOp: 'difference',\n /**\n * The default {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation composite operator}\n * (\"source-over\").\n * @name module:boxes/BoxConnector.BoxConnector#DEFAULT_COMPOSITE_OP\n * @static\n * @type {string} */\n DEFAULT_COMPOSITE_OP: DEFAULT_COMPOSITE_OP,\n /**\n * Relative position of point B regarding A\n * @name module:boxes/BoxConnector.BoxConnector#relativePos\n * @type {module:AWT.Point} */\n relativePos: null,\n /**\n * The ActiveBox to connect or move\n * @name module:boxes/BoxConnector.BoxConnector#bx\n * @type {module:boxes/ActiveBox.ActiveBox} */\n bx: null,\n /**\n * The Graphics context where the BoxConnector will paint\n * @name module:boxes/BoxConnector.BoxConnector#ctx\n * @type {external:CanvasRenderingContext2D} */\n ctx: null,\n /**\n * The dimension of the HTML canvas where to draw\n * @name module:boxes/BoxConnector.BoxConnector#dim\n * @type {module:AWT.Dimension} */\n dim: null,\n /**\n * The container to which this connector belongs\n * @name module:boxes/BoxConnector.BoxConnector#parent\n * @type {module:AWT.Container} */\n parent: null,\n /**\n * Width of the connector line\n * @name module:boxes/BoxConnector.BoxConnector#lineWidth\n * @type {number} */\n lineWidth: 1.5,\n});\n\nexport default BoxConnector;\n"],"names":[],"sourceRoot":""}
|
package/dist/4921.jclic-node.js
DELETED
|
@@ -1,500 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 4921;
|
|
3
|
-
exports.ids = [4921,8276];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 4921:
|
|
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 Rectangular */
|
|
13
|
-
/* harmony import */ var _Shaper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8276);
|
|
14
|
-
/* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7912);
|
|
15
|
-
/**
|
|
16
|
-
* File : shapers/Rectangular.js
|
|
17
|
-
* Created : 19/05/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 Catalan Educational Telematic Network (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
|
-
*
|
|
51
|
-
* This is the simplest {@link module:shapers/Shaper.Shaper Shaper}. It divides the graphic object in a set of rectangular
|
|
52
|
-
* shapes distributed in the specified number of rows and columns.
|
|
53
|
-
* @extends module:shapers/Shaper.Shaper
|
|
54
|
-
*/
|
|
55
|
-
class Rectangular extends _Shaper_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
56
|
-
/**
|
|
57
|
-
* Rectangular constructor
|
|
58
|
-
* @param {number} nx - Number of columns
|
|
59
|
-
* @param {number} ny - Number of rows
|
|
60
|
-
*/
|
|
61
|
-
constructor(nx, ny) {
|
|
62
|
-
super(nx, ny);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Builds the rectangular shapes based on the number of rows and columns
|
|
67
|
-
* @override
|
|
68
|
-
*/
|
|
69
|
-
buildShapes() {
|
|
70
|
-
const
|
|
71
|
-
w = 1 / this.nCols,
|
|
72
|
-
h = 1 / this.nRows;
|
|
73
|
-
for (let y = 0; y < this.nRows; y++) {
|
|
74
|
-
for (let x = 0; x < this.nCols; x++) {
|
|
75
|
-
this.shapeData[y * this.nCols + x] = new _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Rectangle */ .M_(new _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Point */ .bR(x * w, y * h), new _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Dimension */ .fg(w, h));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
this.initiated = true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
Object.assign(Rectangular.prototype, {
|
|
83
|
-
/**
|
|
84
|
-
* Overrides same flag in {@link module:/shapers/Shaper.Shaper#rectangularShapes Shaper#rectangularShapes}
|
|
85
|
-
* @name module:shapers/Rectangular.Rectangular#rectangularShapes
|
|
86
|
-
* @override
|
|
87
|
-
* @type {boolean} */
|
|
88
|
-
rectangularShapes: true,
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// Register this class in the list of known shapers
|
|
92
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Shaper_js__WEBPACK_IMPORTED_MODULE_0__["default"].registerClass('@Rectangular', Rectangular));
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/***/ }),
|
|
96
|
-
|
|
97
|
-
/***/ 8276:
|
|
98
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
99
|
-
|
|
100
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
101
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
102
|
-
/* harmony export */ });
|
|
103
|
-
/* unused harmony export Shaper */
|
|
104
|
-
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
|
|
105
|
-
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
|
106
|
-
/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1253);
|
|
107
|
-
/* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7912);
|
|
108
|
-
/**
|
|
109
|
-
* File : shapers/Shaper.js
|
|
110
|
-
* Created : 13/04/2015
|
|
111
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
112
|
-
*
|
|
113
|
-
* JClic.js
|
|
114
|
-
* An HTML5 player of JClic activities
|
|
115
|
-
* https://projectestac.github.io/jclic.js
|
|
116
|
-
*
|
|
117
|
-
* @source https://github.com/projectestac/jclic.js
|
|
118
|
-
*
|
|
119
|
-
* @license EUPL-1.2
|
|
120
|
-
* @licstart
|
|
121
|
-
* (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
|
|
122
|
-
*
|
|
123
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
124
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
125
|
-
* You may not use this work except in compliance with the Licence.
|
|
126
|
-
*
|
|
127
|
-
* You may obtain a copy of the Licence at:
|
|
128
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
129
|
-
*
|
|
130
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
131
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
132
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
133
|
-
* Licence for the specific language governing permissions and limitations
|
|
134
|
-
* under the Licence.
|
|
135
|
-
* @licend
|
|
136
|
-
* @module
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* The function of this class and its subclasses is to draw a set of "shapes" that will be used to
|
|
145
|
-
* place {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects at a specific position, and to determine its dimension and
|
|
146
|
-
* appearance.
|
|
147
|
-
*/
|
|
148
|
-
class Shaper {
|
|
149
|
-
/**
|
|
150
|
-
* Shaper constructor
|
|
151
|
-
* @param {number} nx - Number of columns (in grid-based shapers)
|
|
152
|
-
* @param {number} ny - Number of rows (in grid-based shapers)
|
|
153
|
-
*/
|
|
154
|
-
constructor(nx, ny) {
|
|
155
|
-
this.reset(nx, ny);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Registers a new type of shaper
|
|
160
|
-
* @param {string} shaperName - The name used to identify this shaper
|
|
161
|
-
* @param {function} shaperClass - The shaper class, usually extending Shaper
|
|
162
|
-
* @returns {module:shapers/Shaper.Shaper} - The provided shaper class
|
|
163
|
-
*/
|
|
164
|
-
static registerClass(shaperName, shaperClass) {
|
|
165
|
-
Shaper.CLASSES[shaperName] = shaperClass;
|
|
166
|
-
return shaperClass;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Factory constructor that returns a Shaper of the requested class.
|
|
171
|
-
* @param {string} className - The class name of the requested Shaper.
|
|
172
|
-
* @param {number} nx - Number of columns (in grid-based shapers)
|
|
173
|
-
* @param {number} ny - Number of rows (in grid-based shapers)
|
|
174
|
-
* @returns {module:shapers/Shaper.Shaper}
|
|
175
|
-
*/
|
|
176
|
-
static getShaper(className, nx, ny) {
|
|
177
|
-
const cl = Shaper.CLASSES[(className || '').replace(/^edu\.xtec\.jclic\.shapers\./, '@')];
|
|
178
|
-
if (!cl)
|
|
179
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .log */ .Rm)('error', `Unknown shaper: ${className}`);
|
|
180
|
-
return cl ? new cl(nx, ny) : null;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Initializes this Shaper to default values
|
|
185
|
-
* @param {number} nCols - Number of columns
|
|
186
|
-
* @param {number} nRows - Number of rows
|
|
187
|
-
*/
|
|
188
|
-
reset(nCols, nRows) {
|
|
189
|
-
this.nCols = nCols;
|
|
190
|
-
this.nRows = nRows;
|
|
191
|
-
this.nCells = nRows * nCols;
|
|
192
|
-
this.initiated = false;
|
|
193
|
-
this.shapeData = [];
|
|
194
|
-
for (let i = 0; i < this.nCells; i++)
|
|
195
|
-
this.shapeData[i] = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Shape */ .yp();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Loads this shaper settings from a specific JQuery XML element
|
|
200
|
-
* @param {external:jQuery} $xml - The XML element with the shaper data
|
|
201
|
-
*/
|
|
202
|
-
setProperties($xml) {
|
|
203
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .attrForEach */ .GM)($xml.get(0).attributes, (name, value) => {
|
|
204
|
-
switch (name) {
|
|
205
|
-
case 'class':
|
|
206
|
-
this.className = value;
|
|
207
|
-
break;
|
|
208
|
-
case 'cols':
|
|
209
|
-
this.nCols = Number(value);
|
|
210
|
-
break;
|
|
211
|
-
case 'rows':
|
|
212
|
-
this.nRows = Number(value);
|
|
213
|
-
break;
|
|
214
|
-
case 'baseWidthFactor':
|
|
215
|
-
case 'toothHeightFactor':
|
|
216
|
-
case 'scaleX':
|
|
217
|
-
case 'scaleY':
|
|
218
|
-
this[name] = Number(value);
|
|
219
|
-
break;
|
|
220
|
-
case 'randomLines':
|
|
221
|
-
case 'showEnclosure':
|
|
222
|
-
this[name] = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getBoolean */ .pW)(value, true);
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
// Reads the 'enclosing'
|
|
228
|
-
// (main shape area where the other shape elements are placed)
|
|
229
|
-
$xml.children('enclosing:first').each((_n, child) => {
|
|
230
|
-
jquery__WEBPACK_IMPORTED_MODULE_0___default()(child).children('shape:first').each((_n, child2) => {
|
|
231
|
-
let sh = Shaper.readShapeData(child2, this.scaleX, this.scaleY);
|
|
232
|
-
this.enclosing = sh;
|
|
233
|
-
this.showEnclosure = true;
|
|
234
|
-
this.hasRemainder = true;
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
// Read the shape elements
|
|
239
|
-
$xml.children('shape').each((n, child) => {
|
|
240
|
-
this.shapeData[n] = Shaper.readShapeData(child, this.scaleX, this.scaleY);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
// Correction needed for '@Holes' shaper
|
|
244
|
-
if (this.shapeData.length > 0 /* && this.shapeData.length !== this.nRows * this.nCols */) {
|
|
245
|
-
//this.nRows = this.shapeData.length
|
|
246
|
-
//this.nCols = 1
|
|
247
|
-
//this.nCells = this.nCols * this.nRows
|
|
248
|
-
this.nCells = this.shapeData.length;
|
|
249
|
-
}
|
|
250
|
-
return this;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Reads an individual shape from an XML element.
|
|
255
|
-
* Shapes are arrays of `stroke` objects.
|
|
256
|
-
* Each `stroke` has an `action` (_move to_, _line to_, _quad to_...) and associated `data`.
|
|
257
|
-
* @param {external:jQuery} $xml - The XML element with the shape data
|
|
258
|
-
* @param {number} scaleX
|
|
259
|
-
* @param {number} scaleY
|
|
260
|
-
* @returns {module:AWT.Shape}
|
|
261
|
-
*/
|
|
262
|
-
static readShapeData(xml, scaleX, scaleY) {
|
|
263
|
-
const shd = [];
|
|
264
|
-
let result = null;
|
|
265
|
-
jquery__WEBPACK_IMPORTED_MODULE_0___default().each(xml.textContent.split('|'), (_n, txt) => {
|
|
266
|
-
const sd = txt.split(':');
|
|
267
|
-
// Possible strokes are: `rectangle`, `ellipse`, `M`, `L`, `Q`, `B`, `X`
|
|
268
|
-
// Also possible, but not currently used in JClic: `roundRectangle` and `pie`
|
|
269
|
-
let data = sd.length > 1 ? sd[1].split(',') : null;
|
|
270
|
-
//
|
|
271
|
-
// Data should be always divided by the scale (X or Y)
|
|
272
|
-
if (data)
|
|
273
|
-
data = data.map((d, n) => d / (n % 2 ? scaleY : scaleX));
|
|
274
|
-
|
|
275
|
-
switch (sd[0]) {
|
|
276
|
-
case 'rectangle':
|
|
277
|
-
result = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_(data[0], data[1], data[2], data[3]);
|
|
278
|
-
break;
|
|
279
|
-
case 'ellipse':
|
|
280
|
-
result = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Ellipse */ .Pp(data[0], data[1], data[2], data[3]);
|
|
281
|
-
break;
|
|
282
|
-
default:
|
|
283
|
-
// It's an `AWT.PathStroke`
|
|
284
|
-
shd.push(new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .PathStroke */ .kg(sd[0], data));
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
return !result && shd.length > 0 ? new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Path */ .wA(shd) : result;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Gets a object with the basic attributes needed to rebuild this instance excluding functions,
|
|
294
|
-
* parent references, constants and also attributes retaining the default value.
|
|
295
|
-
* The resulting object is commonly usued to serialize elements in JSON format.
|
|
296
|
-
* @returns {object} - The resulting object, with minimal attrributes
|
|
297
|
-
*/
|
|
298
|
-
getAttributes() {
|
|
299
|
-
const fields = [
|
|
300
|
-
'className', 'nCols', 'nRows',
|
|
301
|
-
'baseWidthFactor', 'toothHeightFactor',
|
|
302
|
-
'scaleX', 'scaleY',
|
|
303
|
-
'randomLines',
|
|
304
|
-
];
|
|
305
|
-
|
|
306
|
-
if (this.customShapes) {
|
|
307
|
-
['showEnclosure', 'hasRemainder',
|
|
308
|
-
'enclosing', 'shapeData', // Array of AWT.Rectangle, AWT.Ellipse or (AWT.Path -> AWT.PathStroke)
|
|
309
|
-
].forEach(f => fields.push(f));
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getAttr */ .iu)(this, fields);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Builds a new shaper, based on the properties specified in a data object
|
|
317
|
-
* @param {object} data - The data object to be parsed
|
|
318
|
-
* @returns {module:shapers/Shaper.Shaper}
|
|
319
|
-
*/
|
|
320
|
-
static factory(data) {
|
|
321
|
-
const result = Shaper.getShaper(data.className, data.nCols, data.nRows);
|
|
322
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .setAttr */ .ob)(result, data, [
|
|
323
|
-
'className', 'nCols', 'nRows',
|
|
324
|
-
'baseWidthFactor', 'toothHeightFactor',
|
|
325
|
-
'scaleX', 'scaleY',
|
|
326
|
-
'randomLines',
|
|
327
|
-
'showEnclosure', 'hasRemainder',
|
|
328
|
-
{ key: 'enclosing', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Shape */ .yp },
|
|
329
|
-
{ key: 'shapeData', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Shape */ .yp, group: 'array' },
|
|
330
|
-
]);
|
|
331
|
-
|
|
332
|
-
result.nCells = result.shapeData.length || result.nCols * result.nRows;
|
|
333
|
-
|
|
334
|
-
return result;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Builds the individual shapes that will form this Shaper
|
|
339
|
-
*/
|
|
340
|
-
buildShapes() {
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Gets a clone of the nth Shape object, scaled and located inside a Rectangle
|
|
345
|
-
* @param {number} n
|
|
346
|
-
* @param {module:AWT.Rectangle} rect
|
|
347
|
-
* @returns {module:AWT.Shape}
|
|
348
|
-
*/
|
|
349
|
-
getShape(n, rect) {
|
|
350
|
-
if (!this.initiated)
|
|
351
|
-
this.buildShapes();
|
|
352
|
-
if (n >= this.nCells || this.shapeData[n] === null)
|
|
353
|
-
return null;
|
|
354
|
-
return this.shapeData[n].getShape(rect);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Gets the nth Shape data object
|
|
359
|
-
* @param {number} n
|
|
360
|
-
* @returns {object}
|
|
361
|
-
*/
|
|
362
|
-
getShapeData(n) {
|
|
363
|
-
return n >= 0 && n < this.shapeData.length ? this.shapeData[n] : null;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Gets the AWT.Rectangle that contains all shapes of this Shaper.
|
|
368
|
-
* @returns {module:AWT.Rectangle}
|
|
369
|
-
*/
|
|
370
|
-
getEnclosingShapeData() {
|
|
371
|
-
return new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_(0, 0, 1, 1);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* When `hasRemainder` is true, this method gets the rectangle containing the full surface where
|
|
376
|
-
* the Shaper develops.
|
|
377
|
-
* @param {module:AWT.Rectangle} rect - The frame where to move and scale all the shapes
|
|
378
|
-
* @returns {module:AWT.Rectangle}
|
|
379
|
-
*/
|
|
380
|
-
getRemainderShape(rect) {
|
|
381
|
-
if (!this.hasRemainder)
|
|
382
|
-
return null;
|
|
383
|
-
|
|
384
|
-
if (!this.initiated)
|
|
385
|
-
this.buildShapes();
|
|
386
|
-
|
|
387
|
-
const sh = this.getEnclosingShapeData();
|
|
388
|
-
const r = sh ? sh.getShape(rect) : new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Rectangle */ .M_();
|
|
389
|
-
for (let i = 0; i < this.nCells; i++) {
|
|
390
|
-
if (this.shapeData[i])
|
|
391
|
-
r.add(this.shapeData[i].getShape(rect), false);
|
|
392
|
-
}
|
|
393
|
-
return r;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
Object.assign(Shaper.prototype, {
|
|
398
|
-
/**
|
|
399
|
-
* This shaper class name
|
|
400
|
-
* @name module:shapers/Shaper.Shaper#className
|
|
401
|
-
* @type {string} */
|
|
402
|
-
className: 'Shaper',
|
|
403
|
-
/**
|
|
404
|
-
* Number of columns (useful in grid-based shapers)
|
|
405
|
-
* @name module:shapers/Shaper.Shaper#nCols
|
|
406
|
-
* @type {number} */
|
|
407
|
-
nCols: 0,
|
|
408
|
-
/**
|
|
409
|
-
* Number of rows (useful in grid-based shapers)
|
|
410
|
-
* @name module:shapers/Shaper.Shaper#nRows
|
|
411
|
-
* @type {number} */
|
|
412
|
-
nRows: 0,
|
|
413
|
-
/**
|
|
414
|
-
* Number of cells managed by this shaper
|
|
415
|
-
* @name module:shapers/Shaper.Shaper#nCells
|
|
416
|
-
* @type {number} */
|
|
417
|
-
nCells: 0,
|
|
418
|
-
/**
|
|
419
|
-
* Contains the specific definition of each shape
|
|
420
|
-
* @name module:shapers/Shaper.Shaper#shapeData
|
|
421
|
-
* @type {object} */
|
|
422
|
-
shapeData: null,
|
|
423
|
-
/**
|
|
424
|
-
* Flag used to check if the `Shaper` has been initialized against a real surface
|
|
425
|
-
* @name module:shapers/Shaper.Shaper#initiated
|
|
426
|
-
* @type {boolean} */
|
|
427
|
-
initiated: false,
|
|
428
|
-
//
|
|
429
|
-
// Fields used only in JigSaw shapers
|
|
430
|
-
/**
|
|
431
|
-
* In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the base width of the tooth and the total length of the side.
|
|
432
|
-
* @name module:shapers/Shaper.Shaper#baseWidthFactor
|
|
433
|
-
* @type {number} */
|
|
434
|
-
baseWidthFactor: 1.0 / 3,
|
|
435
|
-
/**
|
|
436
|
-
* In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the tooth height and the total length of the side.
|
|
437
|
-
* @name module:shapers/Shaper.Shaper#toothHeightFactor
|
|
438
|
-
* @type {number} */
|
|
439
|
-
toothHeightFactor: 1.0 / 6,
|
|
440
|
-
/**
|
|
441
|
-
* In {@link module:shapers/JigSaw.JigSaw JigSaw}, whether the tooths take random directions or not
|
|
442
|
-
* @name module:shapers/Shaper.Shaper#randomLines
|
|
443
|
-
* @type {boolean} */
|
|
444
|
-
randomLines: false,
|
|
445
|
-
//
|
|
446
|
-
// Fields used only in the `Holes` shaper
|
|
447
|
-
/**
|
|
448
|
-
* In {@link module:shapers/Holes.Holes Holes}, scale to be applied to horizontal positions and lengths to achieve the real
|
|
449
|
-
* value of the shape placed on a real surface.
|
|
450
|
-
* @name module:shapers/Shaper.Shaper#scaleX
|
|
451
|
-
* @type {number} */
|
|
452
|
-
scaleX: 1.0,
|
|
453
|
-
/**
|
|
454
|
-
* In {@link module:shapers/Holes.Holes Holes}, scale to be applied to vertical positions and lengths to achieve the real
|
|
455
|
-
* value of the shape placed on a real surface.
|
|
456
|
-
* @name module:shapers/Shaper.Shaper#scaleY
|
|
457
|
-
* @type {number} */
|
|
458
|
-
scaleY: 1.0,
|
|
459
|
-
/**
|
|
460
|
-
* In {@link module:shapers/Holes.Holes Holes}, the enclosing area where all shapes are placed.
|
|
461
|
-
* @name module:shapers/Shaper.Shaper#enclosing
|
|
462
|
-
* @type {module:AWT.Shape} */
|
|
463
|
-
enclosing: null,
|
|
464
|
-
/**
|
|
465
|
-
* In {@link module:shapers/Holes.Holes Holes}, when `true`, the enclosing area will be drawn
|
|
466
|
-
* @name module:shapers/Shaper.Shaper#showEnclosure
|
|
467
|
-
* @type {boolean} */
|
|
468
|
-
showEnclosure: false,
|
|
469
|
-
/**
|
|
470
|
-
* Flag indicating if this shaper organizes its cells in rows and columns
|
|
471
|
-
* @name module:shapers/Shaper.Shaper#rectangularShapes
|
|
472
|
-
* @type {boolean} */
|
|
473
|
-
rectangularShapes: false,
|
|
474
|
-
/**
|
|
475
|
-
* Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
|
|
476
|
-
* all its shapes
|
|
477
|
-
* @name module:shapers/Shaper.Shaper#hasRemainder
|
|
478
|
-
* @type {boolean} */
|
|
479
|
-
hasRemainder: false,
|
|
480
|
-
/**
|
|
481
|
-
* Only the `Holes` shaper has this flag activated
|
|
482
|
-
* @name module:shapers/Shaper.Shaper#customShapes
|
|
483
|
-
* @type {boolean} */
|
|
484
|
-
customShapes: false,
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* List of known classes derived from Shaper. It should be filled by real shaper classes at
|
|
489
|
-
* declaration time.
|
|
490
|
-
* @type {object} */
|
|
491
|
-
Shaper.CLASSES = {};
|
|
492
|
-
|
|
493
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Shaper);
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
/***/ })
|
|
497
|
-
|
|
498
|
-
};
|
|
499
|
-
;
|
|
500
|
-
//# sourceMappingURL=4921.jclic-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"4921.jclic-node.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEiC;AACuB;;AAExD;AACA;AACA,yBAAyB,0CAA0C;AACnE;AACA;AACA;AACO,0BAA0B,kDAAM;AACvC;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC,sBAAsB,gBAAgB;AACtC,iDAAiD,wDAAS,KAAK,oDAAK,oBAAoB,wDAAS;AACjG;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,YAAY,SAAS;AACrB;AACA,CAAC;;AAED;AACA,iEAAe,kDAAM,2CAA2C,EAAC;;;;;;;;;;;;;;;;AC7EjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEuB;AACsD;AACL;;AAExE;AACA;AACA,UAAU,kDAAkD;AAC5D;AACA;AACO;AACP;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,UAAU;AACvB,eAAe,8BAA8B;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA,MAAM,wDAAG,6BAA6B,UAAU;AAChD;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC,8BAA8B,oDAAK;AACnC;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA,IAAI,gEAAW;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+DAAU;AACjC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,MAAM,6CAAC;AACP;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,iBAAiB;AAC9B,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;AACA,IAAI,kDAAM;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,wDAAS;AAChC;AACA;AACA,uBAAuB,sDAAO;AAC9B;AACA;AACA;AACA,uBAAuB,yDAAU;AACjC;AACA;AACA,KAAK;;AAEL,2CAA2C,mDAAI;AAC/C;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,WAAW,4DAAO;AAClB;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA,IAAI,4DAAO;AACX;AACA;AACA;AACA;AACA;AACA,QAAQ,sBAAsB,oDAAK,EAAE;AACrC,QAAQ,sBAAsB,oDAAK,kBAAkB;AACrD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,sBAAsB;AACnC,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA,eAAe,wDAAS;AACxB;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2CAA2C,wDAAS;AACpD,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,SAAS,0CAA0C;AACnD;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,0CAA0C;AACnD;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,0CAA0C;AACnD;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,SAAS,uCAAuC;AAChD;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,uCAAuC;AAChD;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,SAAS,uCAAuC;AAChD;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA,SAAS,uCAAuC;AAChD;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA,CAAC;;AAED;AACA;AACA;AACA,UAAU,QAAQ;AAClB;;AAEA,iEAAe,MAAM,EAAC","sources":["webpack://jclic/./src/shapers/Rectangular.js","webpack://jclic/./src/shapers/Shaper.js"],"sourcesContent":["/**\n * File : shapers/Rectangular.js\n * Created : 19/05/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport Shaper from './Shaper.js';\nimport { Rectangle, Point, Dimension } from '../AWT.js';\n\n/**\n *\n * This is the simplest {@link module:shapers/Shaper.Shaper Shaper}. It divides the graphic object in a set of rectangular\n * shapes distributed in the specified number of rows and columns.\n * @extends module:shapers/Shaper.Shaper\n */\nexport class Rectangular extends Shaper {\n /**\n * Rectangular constructor\n * @param {number} nx - Number of columns\n * @param {number} ny - Number of rows\n */\n constructor(nx, ny) {\n super(nx, ny);\n }\n\n /**\n * Builds the rectangular shapes based on the number of rows and columns\n * @override\n */\n buildShapes() {\n const\n w = 1 / this.nCols,\n h = 1 / this.nRows;\n for (let y = 0; y < this.nRows; y++) {\n for (let x = 0; x < this.nCols; x++) {\n this.shapeData[y * this.nCols + x] = new Rectangle(new Point(x * w, y * h), new Dimension(w, h));\n }\n }\n this.initiated = true;\n }\n}\n\nObject.assign(Rectangular.prototype, {\n /**\n * Overrides same flag in {@link module:/shapers/Shaper.Shaper#rectangularShapes Shaper#rectangularShapes}\n * @name module:shapers/Rectangular.Rectangular#rectangularShapes\n * @override\n * @type {boolean} */\n rectangularShapes: true,\n});\n\n// Register this class in the list of known shapers\nexport default Shaper.registerClass('@Rectangular', Rectangular);\n","/**\n * File : shapers/Shaper.js\n * Created : 13/04/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport $ from 'jquery';\nimport { log, attrForEach, getBoolean, getAttr, setAttr } from '../Utils.js';\nimport { Shape, Rectangle, Ellipse, PathStroke, Path } from '../AWT.js';\n\n/**\n * The function of this class and its subclasses is to draw a set of \"shapes\" that will be used to\n * place {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects at a specific position, and to determine its dimension and\n * appearance.\n */\nexport class Shaper {\n /**\n * Shaper constructor\n * @param {number} nx - Number of columns (in grid-based shapers)\n * @param {number} ny - Number of rows (in grid-based shapers)\n */\n constructor(nx, ny) {\n this.reset(nx, ny);\n }\n\n /**\n * Registers a new type of shaper\n * @param {string} shaperName - The name used to identify this shaper\n * @param {function} shaperClass - The shaper class, usually extending Shaper\n * @returns {module:shapers/Shaper.Shaper} - The provided shaper class\n */\n static registerClass(shaperName, shaperClass) {\n Shaper.CLASSES[shaperName] = shaperClass;\n return shaperClass;\n }\n\n /**\n * Factory constructor that returns a Shaper of the requested class.\n * @param {string} className - The class name of the requested Shaper.\n * @param {number} nx - Number of columns (in grid-based shapers)\n * @param {number} ny - Number of rows (in grid-based shapers)\n * @returns {module:shapers/Shaper.Shaper}\n */\n static getShaper(className, nx, ny) {\n const cl = Shaper.CLASSES[(className || '').replace(/^edu\\.xtec\\.jclic\\.shapers\\./, '@')];\n if (!cl)\n log('error', `Unknown shaper: ${className}`);\n return cl ? new cl(nx, ny) : null;\n }\n\n /**\n * Initializes this Shaper to default values\n * @param {number} nCols - Number of columns\n * @param {number} nRows - Number of rows\n */\n reset(nCols, nRows) {\n this.nCols = nCols;\n this.nRows = nRows;\n this.nCells = nRows * nCols;\n this.initiated = false;\n this.shapeData = [];\n for (let i = 0; i < this.nCells; i++)\n this.shapeData[i] = new Shape();\n }\n\n /**\n * Loads this shaper settings from a specific JQuery XML element\n * @param {external:jQuery} $xml - The XML element with the shaper data\n */\n setProperties($xml) {\n attrForEach($xml.get(0).attributes, (name, value) => {\n switch (name) {\n case 'class':\n this.className = value;\n break;\n case 'cols':\n this.nCols = Number(value);\n break;\n case 'rows':\n this.nRows = Number(value);\n break;\n case 'baseWidthFactor':\n case 'toothHeightFactor':\n case 'scaleX':\n case 'scaleY':\n this[name] = Number(value);\n break;\n case 'randomLines':\n case 'showEnclosure':\n this[name] = getBoolean(value, true);\n break;\n }\n });\n\n // Reads the 'enclosing'\n // (main shape area where the other shape elements are placed)\n $xml.children('enclosing:first').each((_n, child) => {\n $(child).children('shape:first').each((_n, child2) => {\n let sh = Shaper.readShapeData(child2, this.scaleX, this.scaleY);\n this.enclosing = sh;\n this.showEnclosure = true;\n this.hasRemainder = true;\n });\n });\n\n // Read the shape elements\n $xml.children('shape').each((n, child) => {\n this.shapeData[n] = Shaper.readShapeData(child, this.scaleX, this.scaleY);\n });\n\n // Correction needed for '@Holes' shaper\n if (this.shapeData.length > 0 /* && this.shapeData.length !== this.nRows * this.nCols */) {\n //this.nRows = this.shapeData.length\n //this.nCols = 1\n //this.nCells = this.nCols * this.nRows\n this.nCells = this.shapeData.length;\n }\n return this;\n }\n\n /**\n * Reads an individual shape from an XML element.\n * Shapes are arrays of `stroke` objects.\n * Each `stroke` has an `action` (_move to_, _line to_, _quad to_...) and associated `data`.\n * @param {external:jQuery} $xml - The XML element with the shape data\n * @param {number} scaleX\n * @param {number} scaleY\n * @returns {module:AWT.Shape}\n */\n static readShapeData(xml, scaleX, scaleY) {\n const shd = [];\n let result = null;\n $.each(xml.textContent.split('|'), (_n, txt) => {\n const sd = txt.split(':');\n // Possible strokes are: `rectangle`, `ellipse`, `M`, `L`, `Q`, `B`, `X`\n // Also possible, but not currently used in JClic: `roundRectangle` and `pie`\n let data = sd.length > 1 ? sd[1].split(',') : null;\n //\n // Data should be always divided by the scale (X or Y)\n if (data)\n data = data.map((d, n) => d / (n % 2 ? scaleY : scaleX));\n\n switch (sd[0]) {\n case 'rectangle':\n result = new Rectangle(data[0], data[1], data[2], data[3]);\n break;\n case 'ellipse':\n result = new Ellipse(data[0], data[1], data[2], data[3]);\n break;\n default:\n // It's an `AWT.PathStroke`\n shd.push(new PathStroke(sd[0], data));\n break;\n }\n });\n\n return !result && shd.length > 0 ? new Path(shd) : result;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n const fields = [\n 'className', 'nCols', 'nRows',\n 'baseWidthFactor', 'toothHeightFactor',\n 'scaleX', 'scaleY',\n 'randomLines',\n ];\n\n if (this.customShapes) {\n ['showEnclosure', 'hasRemainder',\n 'enclosing', 'shapeData', // Array of AWT.Rectangle, AWT.Ellipse or (AWT.Path -> AWT.PathStroke)\n ].forEach(f => fields.push(f));\n }\n\n return getAttr(this, fields);\n }\n\n /**\n * Builds a new shaper, based on the properties specified in a data object\n * @param {object} data - The data object to be parsed\n * @returns {module:shapers/Shaper.Shaper}\n */\n static factory(data) {\n const result = Shaper.getShaper(data.className, data.nCols, data.nRows);\n setAttr(result, data, [\n 'className', 'nCols', 'nRows',\n 'baseWidthFactor', 'toothHeightFactor',\n 'scaleX', 'scaleY',\n 'randomLines',\n 'showEnclosure', 'hasRemainder',\n { key: 'enclosing', fn: Shape },\n { key: 'shapeData', fn: Shape, group: 'array' },\n ]);\n\n result.nCells = result.shapeData.length || result.nCols * result.nRows;\n\n return result;\n }\n\n /**\n * Builds the individual shapes that will form this Shaper\n */\n buildShapes() {\n }\n\n /**\n * Gets a clone of the nth Shape object, scaled and located inside a Rectangle\n * @param {number} n\n * @param {module:AWT.Rectangle} rect\n * @returns {module:AWT.Shape}\n */\n getShape(n, rect) {\n if (!this.initiated)\n this.buildShapes();\n if (n >= this.nCells || this.shapeData[n] === null)\n return null;\n return this.shapeData[n].getShape(rect);\n }\n\n /**\n * Gets the nth Shape data object\n * @param {number} n\n * @returns {object}\n */\n getShapeData(n) {\n return n >= 0 && n < this.shapeData.length ? this.shapeData[n] : null;\n }\n\n /**\n * Gets the AWT.Rectangle that contains all shapes of this Shaper.\n * @returns {module:AWT.Rectangle}\n */\n getEnclosingShapeData() {\n return new Rectangle(0, 0, 1, 1);\n }\n\n /**\n * When `hasRemainder` is true, this method gets the rectangle containing the full surface where\n * the Shaper develops.\n * @param {module:AWT.Rectangle} rect - The frame where to move and scale all the shapes\n * @returns {module:AWT.Rectangle}\n */\n getRemainderShape(rect) {\n if (!this.hasRemainder)\n return null;\n\n if (!this.initiated)\n this.buildShapes();\n\n const sh = this.getEnclosingShapeData();\n const r = sh ? sh.getShape(rect) : new Rectangle();\n for (let i = 0; i < this.nCells; i++) {\n if (this.shapeData[i])\n r.add(this.shapeData[i].getShape(rect), false);\n }\n return r;\n }\n}\n\nObject.assign(Shaper.prototype, {\n /**\n * This shaper class name\n * @name module:shapers/Shaper.Shaper#className\n * @type {string} */\n className: 'Shaper',\n /**\n * Number of columns (useful in grid-based shapers)\n * @name module:shapers/Shaper.Shaper#nCols\n * @type {number} */\n nCols: 0,\n /**\n * Number of rows (useful in grid-based shapers)\n * @name module:shapers/Shaper.Shaper#nRows\n * @type {number} */\n nRows: 0,\n /**\n * Number of cells managed by this shaper\n * @name module:shapers/Shaper.Shaper#nCells\n * @type {number} */\n nCells: 0,\n /**\n * Contains the specific definition of each shape\n * @name module:shapers/Shaper.Shaper#shapeData\n * @type {object} */\n shapeData: null,\n /**\n * Flag used to check if the `Shaper` has been initialized against a real surface\n * @name module:shapers/Shaper.Shaper#initiated\n * @type {boolean} */\n initiated: false,\n //\n // Fields used only in JigSaw shapers\n /**\n * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the base width of the tooth and the total length of the side.\n * @name module:shapers/Shaper.Shaper#baseWidthFactor\n * @type {number} */\n baseWidthFactor: 1.0 / 3,\n /**\n * In {@link module:shapers/JigSaw.JigSaw JigSaw}, ratio between the tooth height and the total length of the side.\n * @name module:shapers/Shaper.Shaper#toothHeightFactor\n * @type {number} */\n toothHeightFactor: 1.0 / 6,\n /**\n * In {@link module:shapers/JigSaw.JigSaw JigSaw}, whether the tooths take random directions or not\n * @name module:shapers/Shaper.Shaper#randomLines\n * @type {boolean} */\n randomLines: false,\n //\n // Fields used only in the `Holes` shaper\n /**\n * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to horizontal positions and lengths to achieve the real\n * value of the shape placed on a real surface.\n * @name module:shapers/Shaper.Shaper#scaleX\n * @type {number} */\n scaleX: 1.0,\n /**\n * In {@link module:shapers/Holes.Holes Holes}, scale to be applied to vertical positions and lengths to achieve the real\n * value of the shape placed on a real surface.\n * @name module:shapers/Shaper.Shaper#scaleY\n * @type {number} */\n scaleY: 1.0,\n /**\n * In {@link module:shapers/Holes.Holes Holes}, the enclosing area where all shapes are placed.\n * @name module:shapers/Shaper.Shaper#enclosing\n * @type {module:AWT.Shape} */\n enclosing: null,\n /**\n * In {@link module:shapers/Holes.Holes Holes}, when `true`, the enclosing area will be drawn\n * @name module:shapers/Shaper.Shaper#showEnclosure\n * @type {boolean} */\n showEnclosure: false,\n /**\n * Flag indicating if this shaper organizes its cells in rows and columns\n * @name module:shapers/Shaper.Shaper#rectangularShapes\n * @type {boolean} */\n rectangularShapes: false,\n /**\n * Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing\n * all its shapes\n * @name module:shapers/Shaper.Shaper#hasRemainder\n * @type {boolean} */\n hasRemainder: false,\n /**\n * Only the `Holes` shaper has this flag activated\n * @name module:shapers/Shaper.Shaper#customShapes\n * @type {boolean} */\n customShapes: false,\n});\n\n/**\n * List of known classes derived from Shaper. It should be filled by real shaper classes at\n * declaration time.\n * @type {object} */\nShaper.CLASSES = {};\n\nexport default Shaper;\n"],"names":[],"sourceRoot":""}
|