Jean-Yves Didier

added dependencies and qr detector

1 +/******/ "use strict";
1 /******/ var __webpack_modules__ = ([ 2 /******/ var __webpack_modules__ = ([
2 /* 0 */ 3 /* 0 */
3 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 4 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
......
1 +import ARCS from '../build/arcs.js';
2 +
3 +let QRCodeDetector;
4 +
5 +QRCodeDetector = ARCS.Componenent.create(
6 + function() {
7 + let busy = false;
8 + let dataCache = null;
9 + const worker = new Worker("../deps/jsqr/worker.js");
10 + worker.addEventListener("message", ({data} => {
11 + busy = false;
12 + dataCache = data;
13 + });
14 +
15 + this.detect(imageData) {
16 + if (!busy) {
17 + busy = true;
18 + worker.postMessage(imageData);
19 + }
20 + if (dataCache !== null) {
21 + this.emit('onQRCode', dataCache);
22 + }
23 + };
24 + },
25 + ['detect'],
26 + ['onQRCode']
27 +);
28 +
29 +
30 +
31 +export default {QRCodeDetector: QRCodeDetector};
1 +import jsQR from './jsQR.js';
2 +
3 +self.addEventListener("message", e => {
4 + const obj = e.data;
5 + const qrData = jsQR(obj.data, obj.width, obj.height);
6 + self.postMessage(qrData);
7 +});
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
35 "js-aruco": ">=0.1", 35 "js-aruco": ">=0.1",
36 "three": ">=0.131", 36 "three": ">=0.131",
37 "tracking": ">=1.1.3", 37 "tracking": ">=1.1.3",
38 - "webpack": "^5.51.1" 38 + "webpack": "^5.51.1",
39 + "jsqr": "^1.4.0",
40 + "html2canvas": "^1.3.3"
39 }, 41 },
40 "devDependencies": { 42 "devDependencies": {
41 "copy-webpack-plugin": "^9.0.1", 43 "copy-webpack-plugin": "^9.0.1",
......
...@@ -3,7 +3,7 @@ const path=require('path'); ...@@ -3,7 +3,7 @@ const path=require('path');
3 3
4 module.exports = { 4 module.exports = {
5 entry : './arcsapp.json', 5 entry : './arcsapp.json',
6 - mode: "none", 6 + mode: "production",
7 7
8 output: { 8 output: {
9 path: path.resolve(__dirname, ''), 9 path: path.resolve(__dirname, ''),
......
...@@ -89,8 +89,10 @@ module.exports = [ ...@@ -89,8 +89,10 @@ module.exports = [
89 plugins: [ 89 plugins: [
90 new copy({ 90 new copy({
91 patterns: [ 91 patterns: [
92 + { from: 'node_modules/html2canvas/dist/html2canvas.min.js', to: '../deps/html2canvas/html2canvas.min.js'},
93 + { from: 'node_modules/jsqr/dist/jsQR.js', to: '../deps/jsqr/jsQR.js'},
92 { from: 'node_modules/tracking/build/tracking.js', to: '../deps/tracking/tracking.js'}, 94 { from: 'node_modules/tracking/build/tracking.js', to: '../deps/tracking/tracking.js'},
93 - { from: 'node_modules/three/build/three.module.js', to: '../deps/three.js/index.js'}, 95 + { from: 'node_modules/three/build/three.module.js', to: '../deps/three.js/index.js'},
94 { 96 {
95 from: 'node_modules/three/examples/jsm/loaders/OBJLoader.js', 97 from: 'node_modules/three/examples/jsm/loaders/OBJLoader.js',
96 to: '../deps/objloader/index.js', 98 to: '../deps/objloader/index.js',
...@@ -122,6 +124,16 @@ module.exports = [ ...@@ -122,6 +124,16 @@ module.exports = [
122 } 124 }
123 }, 125 },
124 { 126 {
127 + from: 'node_modules/three/examples/jsm/webxr/ARButton.js',
128 + to: '../deps/three.js/ARButton.js',
129 + transform: function(content, path) {
130 + return Buffer.from(content.toString().replace(
131 + '../../../build/three.module.js',
132 + './index.js'
133 + ));
134 + }
135 + },
136 + {
125 from: 'node_modules/js-aruco/src/aruco.js', 137 from: 'node_modules/js-aruco/src/aruco.js',
126 to: '../deps/aruco/index.js', 138 to: '../deps/aruco/index.js',
127 transform: function(content, path) { 139 transform: function(content, path) {
......