redhotmagma-visualization 1.27.3-beta.8 → 1.27.6
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/README.md +4 -11
- package/babel.config.js +41 -0
- package/package.json +67 -9
- package/scripts/cpPath.js +151 -0
- package/scripts/moveLibToPackageRoot.js +44 -0
- package/scripts/utils/process.js +19 -0
- package/src/CommonUtils/Observable.js +0 -1
- package/src/CommonUtils/pointerEvent.js +1 -2
- package/src/DevApp.js +1 -2
- package/src/FallbackVisualization.js +5 -1
- package/src/PrintingEffects/DomingEffect.js +0 -1
- package/src/PrintingEffects/EmbroideryEffect.js +2 -3
- package/src/React/ReactBase.js +1 -1
- package/src/Three/Controls/OrbitControls.js +0 -2
- package/src/Three/Loaders/ColladaLoader.js +294 -111
- package/src/Three/Loaders/MTLLoader.js +0 -2
- package/src/Three/Loaders/OBJLoader.js +0 -2
- package/src/Three/Three2D.js +6 -7
- package/src/Three/Three3D.js +1 -9
- package/src/Three/ThreeBase.js +1 -10
- package/src/Utils/DesignArea/getDesignAreaCanvasSize.js +0 -1
- package/src/Utils/TextureBuilder/createTextureBuilder.js +0 -2
- package/src/Utils/imagePreloader.js +0 -1
- package/src/Utils/initTextureCanvas.js +0 -3
- package/src/Utils/isMobileDevice.js +0 -2
- package/src/Utils/optimizeTextureImage.js +0 -1
- package/src/VisualizationContainer.js +1 -3
- package/src/VisualizationInterface.js +1 -10
- package/tsconfig.json +22 -0
- package/AlignTargetProvider.js +0 -129
- package/CommonUtils/Deferred.js +0 -135
- package/CommonUtils/Observable.js +0 -126
- package/CommonUtils/PropertyObserver.js +0 -61
- package/CommonUtils/SyncCurrentFunction.js +0 -59
- package/CommonUtils/SyncObservableEvent.js +0 -19
- package/CommonUtils/pointerEvent.js +0 -415
- package/Constants.js +0 -23
- package/DevApp.js +0 -1049
- package/ExposedModules.js +0 -26
- package/FallbackVisualization.js +0 -26
- package/PrintingEffects/ColorEmbossingEffect.js +0 -58
- package/PrintingEffects/DomingEffect.js +0 -150
- package/PrintingEffects/EmbossingEffect.js +0 -65
- package/PrintingEffects/EmbroideryEffect.js +0 -541
- package/PrintingEffects/EngravingEffect.js +0 -65
- package/PrintingEffects/PrintingEffects.js +0 -117
- package/PrintingEffects/PrintingEffectsUtils.js +0 -53
- package/PrintingEffects/resources/embroidery_multiply.jpg +0 -0
- package/PrintingEffects/resources/embroidery_screen.jpg +0 -0
- package/React/ReactBase.js +0 -111
- package/Three/Controls/OrbitControls.js +0 -745
- package/Three/Exporters/glTFExporter.js +0 -48
- package/Three/Loaders/ColladaLoader.js +0 -2916
- package/Three/Loaders/MTLLoader.js +0 -449
- package/Three/Loaders/OBJLoader.js +0 -548
- package/Three/Three2D.js +0 -1778
- package/Three/Three2DLayers.js +0 -504
- package/Three/Three3D.js +0 -1412
- package/Three/Three3DScene.js +0 -1432
- package/Three/ThreeBase.js +0 -722
- package/Utils/DesignArea/getDesignAreaCanvasSize.js +0 -32
- package/Utils/TextureBuilder/createTextureBuilder.js +0 -335
- package/Utils/TextureBuilder/textureBuilderFunctions.js +0 -87
- package/Utils/alignToElement.js +0 -58
- package/Utils/createAlphaMapFromAlphaChannel.js +0 -50
- package/Utils/createCache.js +0 -46
- package/Utils/createCanvas.js +0 -29
- package/Utils/createImageRepository.js +0 -124
- package/Utils/disposeMaterial.js +0 -41
- package/Utils/getImageSize.js +0 -15
- package/Utils/imagePreloader.js +0 -76
- package/Utils/initTextureCanvas.js +0 -49
- package/Utils/isMobileDevice.js +0 -19
- package/Utils/optimizeTextureImage.js +0 -73
- package/Utils/rememberCameraViewOffset.js +0 -21
- package/Utils/removeObject.js +0 -22
- package/Utils/restrictCameraMovement.js +0 -45
- package/Utils/setOrthographicCameraSize.js +0 -16
- package/Utils/updateFitSizeToElement.js +0 -39
- package/VisualizationContainer.js +0 -279
- package/VisualizationInterface.js +0 -293
- package/VisualizationProvider.js +0 -38
- package/__mocks__/exportedSample.svg +0 -45
- package/index.js +0 -16
- package/public/libs/draco/README.md +0 -32
- package/public/libs/draco/draco_decoder.js +0 -52
- package/public/libs/draco/draco_decoder.wasm +0 -0
- package/public/libs/draco/draco_encoder.js +0 -33
- package/public/libs/draco/draco_wasm_wrapper.js +0 -104
- package/public/libs/draco/gltf/draco_decoder.js +0 -48
- package/public/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/public/libs/draco/gltf/draco_encoder.js +0 -33
- package/public/libs/draco/gltf/draco_wasm_wrapper.js +0 -104
- package/scripts/cpPublic.js +0 -36
- package/scripts/cpPublicLocal.js +0 -30
- package/visualizationAdapterCreator.js +0 -76
package/README.md
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
# redhotmagma-visualization
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
1.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## development
|
|
8
|
-
1. new features:
|
|
9
|
-
- consider adding a demo to the dev app
|
|
10
|
-
- write tests (if possible, interacting with the canvas element is not supported yet)
|
|
11
|
-
1. CRs:
|
|
12
|
-
- test the affected functionalities in the dev app
|
|
13
|
-
- write tests and adjust existing ones if needed
|
|
3
|
+
## Setup for Development
|
|
4
|
+
1. Install NodeJs `> 8.x`
|
|
5
|
+
2. `npm install`
|
|
6
|
+
3. `npm start`
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module.exports = function(api) {
|
|
2
|
+
const presets = [
|
|
3
|
+
"@babel/preset-env",
|
|
4
|
+
"@babel/preset-typescript",
|
|
5
|
+
"@babel/preset-react" // Transpile React components to JavaScript
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
const plugins = [
|
|
9
|
+
"@babel/plugin-proposal-class-properties",
|
|
10
|
+
"@babel/plugin-syntax-dynamic-import",
|
|
11
|
+
|
|
12
|
+
[
|
|
13
|
+
"module-resolver",
|
|
14
|
+
{
|
|
15
|
+
root: ["./src"]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const ignore = [];
|
|
21
|
+
|
|
22
|
+
if (api.env("development")) {
|
|
23
|
+
plugins.push("react-hot-loader/babel"); // Enables React code to work with HMR.
|
|
24
|
+
api.cache(true);
|
|
25
|
+
} else if (api.env("production")) {
|
|
26
|
+
ignore.push(
|
|
27
|
+
"**/__tests__", // ignore the whole test directory
|
|
28
|
+
"**/*.test.js", // ignore test files only
|
|
29
|
+
"**/__mocks__"
|
|
30
|
+
);
|
|
31
|
+
api.cache(false);
|
|
32
|
+
} else {
|
|
33
|
+
api.cache(true);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
presets,
|
|
38
|
+
plugins,
|
|
39
|
+
ignore
|
|
40
|
+
};
|
|
41
|
+
};
|
package/package.json
CHANGED
|
@@ -1,26 +1,84 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redhotmagma-visualization",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.6",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"private": false,
|
|
6
|
-
"main": "./index.js",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"src",
|
|
10
|
+
"babel.config.js",
|
|
11
|
+
"tsconfig.json",
|
|
12
|
+
"scripts"
|
|
13
|
+
],
|
|
7
14
|
"dependencies": {
|
|
15
|
+
"@babel/cli": "^7.13.10",
|
|
16
|
+
"@babel/core": "^7.13.14",
|
|
17
|
+
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
18
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
19
|
+
"@babel/plugin-transform-async-to-generator": "^7.13.0",
|
|
8
20
|
"@babel/polyfill": "^7.12.1",
|
|
9
|
-
"@
|
|
21
|
+
"@babel/preset-env": "^7.13.12",
|
|
22
|
+
"@babel/preset-react": "^7.13.13",
|
|
23
|
+
"@babel/preset-typescript": "^7.13.0",
|
|
10
24
|
"@tweenjs/tween.js": "^17.6.0",
|
|
25
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
11
26
|
"console-polyfill": "^0.3.0",
|
|
27
|
+
"cross-env": "^7.0.3",
|
|
12
28
|
"css-element-queries": "^1.2.3",
|
|
29
|
+
"lodash": "^4.17.21",
|
|
13
30
|
"prop-types": "^15.7.2",
|
|
14
|
-
"
|
|
15
|
-
"react-dom": "^16.14.0",
|
|
31
|
+
"rimraf": "^3.0.2",
|
|
16
32
|
"three": "^0.127.0",
|
|
17
33
|
"uuid": "^3.4.0"
|
|
18
34
|
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@material-ui/core": "^4.11.*",
|
|
37
|
+
"@types/jest": "^26.0.22",
|
|
38
|
+
"@types/lodash": "^4.14.168",
|
|
39
|
+
"babel-eslint": "^10.0.1",
|
|
40
|
+
"babel-jest": "^26.6.3",
|
|
41
|
+
"babel-loader": "^8.2.2",
|
|
42
|
+
"enzyme": "^3.11.0",
|
|
43
|
+
"enzyme-adapter-react-16": "^1.15.6",
|
|
44
|
+
"eslint": "^5.16.0",
|
|
45
|
+
"eslint-config-prettier": "^4.3.0",
|
|
46
|
+
"eslint-plugin-import": "^2.22.1",
|
|
47
|
+
"eslint-plugin-prettier": "^3.3.1",
|
|
48
|
+
"eslint-plugin-react": "^7.23.1",
|
|
49
|
+
"eslint-plugin-react-hooks": "^2.5.1",
|
|
50
|
+
"file-loader": "^6.2.0",
|
|
51
|
+
"jest": "^26.6.3",
|
|
52
|
+
"jest-enzyme": "^7.1.2",
|
|
53
|
+
"jsdom": "^16.5.2",
|
|
54
|
+
"prettier": "1.19.1",
|
|
55
|
+
"react": "^16.14.0",
|
|
56
|
+
"react-dom": "^16.14.0",
|
|
57
|
+
"react-hot-loader": "^4.13.0",
|
|
58
|
+
"react-test-renderer": "^16.14.0",
|
|
59
|
+
"sinon": "^10.0.0",
|
|
60
|
+
"ts-jest": "^26.5.4",
|
|
61
|
+
"typescript": "^4.2.3",
|
|
62
|
+
"url-loader": "^4.1.1",
|
|
63
|
+
"webpack": "^5.28.0",
|
|
64
|
+
"webpack-cli": "^4.6.0",
|
|
65
|
+
"webpack-dev-server": "^3.11.2"
|
|
66
|
+
},
|
|
19
67
|
"peerDependencies": {
|
|
20
|
-
"
|
|
68
|
+
"react": "*",
|
|
69
|
+
"react-dom": "*"
|
|
21
70
|
},
|
|
22
71
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
72
|
+
"start": "webpack serve --port 3003 --host 0.0.0.0",
|
|
73
|
+
"package": "npm run package:clean && npm run package:compile && npm run package:copy && npm run package:after",
|
|
74
|
+
"package:clean": "rimraf ./lib",
|
|
75
|
+
"package:compile": "cross-env NODE_ENV=production babel ./src --out-dir ./lib --extensions .ts,.tsx,.js,.jsx",
|
|
76
|
+
"package:copy": "node ./scripts/cpPath.js ./src ./lib \"\\.(scss|eot|svg|ttf|woff|woff2|png|jpg)$\"",
|
|
77
|
+
"package:after": "node ./scripts/moveLibToPackageRoot.js",
|
|
78
|
+
"install": "npm run package",
|
|
79
|
+
"test": "jest",
|
|
80
|
+
"lint": "eslint ./ --ext .js,.jsx,.ts",
|
|
81
|
+
"lint-ci": "eslint ./ --ext .js,.jsx,.ts -c .eslintrc.ci.json --quiet",
|
|
82
|
+
"lint-fix": "eslint ./ --ext .js,.jsx,.ts --fix"
|
|
25
83
|
}
|
|
26
|
-
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This script is created to copy specific files with their folder structure
|
|
3
|
+
* usage: node copyWithFolder.js src dst [filterRegExp]
|
|
4
|
+
* @author boda@redhotmagma.de
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
|
|
9
|
+
let src = null;
|
|
10
|
+
let dst = null;
|
|
11
|
+
let reg = null;
|
|
12
|
+
|
|
13
|
+
process.argv.forEach(function(val, index) {
|
|
14
|
+
switch (index) {
|
|
15
|
+
case 2:
|
|
16
|
+
src = val;
|
|
17
|
+
break;
|
|
18
|
+
case 3:
|
|
19
|
+
dst = val;
|
|
20
|
+
break;
|
|
21
|
+
case 4:
|
|
22
|
+
reg = new RegExp(val);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (!src || !fs.existsSync(src)) {
|
|
27
|
+
throw new Error("src must be an existing directory");
|
|
28
|
+
}
|
|
29
|
+
if (!dst || !fs.existsSync(dst)) {
|
|
30
|
+
throw new Error("dst must be an existing directory");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function walk(path, cb) {
|
|
34
|
+
try {
|
|
35
|
+
const files = fs.readdirSync(path);
|
|
36
|
+
for (const f of files) {
|
|
37
|
+
const cf = path + "/" + f;
|
|
38
|
+
const s = fs.lstatSync(cf);
|
|
39
|
+
cb(cf);
|
|
40
|
+
s.isDirectory() && walk(cf, cb);
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function copyWithParent(src, dst) {
|
|
48
|
+
if (typeof dst === "function") {
|
|
49
|
+
dst = dst(src);
|
|
50
|
+
}
|
|
51
|
+
createDirDeep(dst.replace(/\/[^/]+$/, ""));
|
|
52
|
+
console.log(src + " -> " + dst);
|
|
53
|
+
const fileExt = src.replace(/.+\.([\w]+)$/, "$1");
|
|
54
|
+
switch (fileExt) {
|
|
55
|
+
case "scss":
|
|
56
|
+
fs.readFile(src, "utf8", function read(err, data) {
|
|
57
|
+
if (err) {
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
const modifiedContent = prepareSassFile(src, data);
|
|
61
|
+
fs.writeFile(dst, modifiedContent, "utf8", function write(err) {
|
|
62
|
+
if (err) {
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
fs.createReadStream(src).pipe(fs.createWriteStream(dst));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function prepareSassFile(src, content) {
|
|
74
|
+
if (!content || !content.match) {
|
|
75
|
+
console.log("Strange file: " + src);
|
|
76
|
+
return content;
|
|
77
|
+
}
|
|
78
|
+
const replaceImports = content.match(/@import ['"][^.~].+/g);
|
|
79
|
+
let output = content;
|
|
80
|
+
if (replaceImports) {
|
|
81
|
+
const pathUp =
|
|
82
|
+
".." +
|
|
83
|
+
src
|
|
84
|
+
.match(/src\/.+/)[0]
|
|
85
|
+
.match(/\//g)
|
|
86
|
+
.splice(1)
|
|
87
|
+
.join("..");
|
|
88
|
+
for (let i in replaceImports) {
|
|
89
|
+
const pathToImport = replaceImports[i].replace(/@import ['"][/]?([^'"]+).*/, "$1");
|
|
90
|
+
const resolverPath = pathUp + pathToImport;
|
|
91
|
+
|
|
92
|
+
const srcPathDir = src.replace(/\/[^/]+$/, "/");
|
|
93
|
+
const relativeImportPath = srcPathDir + pathToImport;
|
|
94
|
+
const rootImportPath = srcPathDir + resolverPath;
|
|
95
|
+
|
|
96
|
+
let resolveRootImport = false;
|
|
97
|
+
try {
|
|
98
|
+
fs.accessSync(relativeImportPath);
|
|
99
|
+
} catch (err) {
|
|
100
|
+
try {
|
|
101
|
+
fs.accessSync(relativeImportPath + ".scss");
|
|
102
|
+
} catch (err) {
|
|
103
|
+
try {
|
|
104
|
+
fs.accessSync(rootImportPath);
|
|
105
|
+
resolveRootImport = true;
|
|
106
|
+
} catch (err) {
|
|
107
|
+
try {
|
|
108
|
+
fs.accessSync(rootImportPath + ".scss");
|
|
109
|
+
resolveRootImport = true;
|
|
110
|
+
} catch (err) {
|
|
111
|
+
throw "Cannot resolve import path: " + replaceImports[i] + " in " + src;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (resolveRootImport) {
|
|
117
|
+
console.log("Resolved root import in " + src + ": " + pathToImport + " -> " + resolverPath);
|
|
118
|
+
const resolvedImport = replaceImports[i].replace(
|
|
119
|
+
/(@import ['"])[^'"]+(.*)/,
|
|
120
|
+
"$1" + resolverPath + "$2"
|
|
121
|
+
);
|
|
122
|
+
output = output.replace(replaceImports[i], resolvedImport);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function createDirDeep(path) {
|
|
130
|
+
const ps = path.split("/");
|
|
131
|
+
let dir = ps.splice(0, 1);
|
|
132
|
+
for (const p of ps) {
|
|
133
|
+
dir = [dir, p].join("/");
|
|
134
|
+
if (!fs.existsSync(dir)) {
|
|
135
|
+
fs.mkdirSync(dir);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
console.log(
|
|
141
|
+
"\x1b[37m\x1b[42m%s\x1b[0m",
|
|
142
|
+
"Copying files from " + src + " to " + dst + (reg ? " with filter: " + reg : " without filter")
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
walk(src, function(f) {
|
|
146
|
+
if (reg === null || (reg && reg.test(f))) {
|
|
147
|
+
copyWithParent(f, function(path) {
|
|
148
|
+
return dst + path.replace(src, "");
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const rimraf = require("rimraf");
|
|
4
|
+
const { isDependency } = require('./utils/process');
|
|
5
|
+
|
|
6
|
+
function walk(dir, cb, cbAfter) {
|
|
7
|
+
try {
|
|
8
|
+
const files = fs.readdirSync(dir);
|
|
9
|
+
for (const f of files) {
|
|
10
|
+
const cf = path.resolve(dir, f);
|
|
11
|
+
const s = fs.lstatSync(cf);
|
|
12
|
+
cb && cb(cf);
|
|
13
|
+
s.isDirectory() && walk(cf, cb, cbAfter);
|
|
14
|
+
cbAfter && cbAfter(cf);
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (isDependency()) {
|
|
22
|
+
console.log(
|
|
23
|
+
"\x1b[37m\x1b[42m%s\x1b[0m",
|
|
24
|
+
"Moving content of lib into the root package directory"
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const src = path.resolve(__dirname, "../", "lib");
|
|
28
|
+
const dst = path.resolve(__dirname, "../");
|
|
29
|
+
walk(src, function(file) {
|
|
30
|
+
const relativePath = file.replace(src, "");
|
|
31
|
+
const tp = path.resolve(dst + relativePath);
|
|
32
|
+
if (fs.statSync(file).isFile()) {
|
|
33
|
+
fs.createReadStream(file).pipe(fs.createWriteStream(tp));
|
|
34
|
+
} else {
|
|
35
|
+
fs.mkdirSync(tp);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
rimraf(src, function(err) {
|
|
40
|
+
if (err) {
|
|
41
|
+
console.log("Error occured while clearing the directory: " + src, err);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These utils are made to simplify querying process information for the node scripts.
|
|
3
|
+
*
|
|
4
|
+
* @author boda@redhotmagma.de
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the current installation process is a dependency installation
|
|
9
|
+
* @return {boolean}
|
|
10
|
+
*/
|
|
11
|
+
function isDependency() {
|
|
12
|
+
// if the path of the initial directory contains 'node_modules', it's probably installed as a dependency
|
|
13
|
+
const { INIT_CWD } = process.env;
|
|
14
|
+
return INIT_CWD.indexOf('node_modules') !== -1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
isDependency,
|
|
19
|
+
};
|
|
@@ -126,7 +126,6 @@ export const createPointerEventListener = (element, name, fn) => {
|
|
|
126
126
|
};
|
|
127
127
|
const mouseHandler = (evt, ...args) => {
|
|
128
128
|
if (evt.timeStamp - timeStamp < tolerance) {
|
|
129
|
-
// eslint-disable-next-line no-console
|
|
130
129
|
console.log("Skipped double event handling.");
|
|
131
130
|
return;
|
|
132
131
|
}
|
|
@@ -244,7 +243,7 @@ export const createPointerMoveEventListener = (element, fn) => {
|
|
|
244
243
|
});
|
|
245
244
|
});
|
|
246
245
|
|
|
247
|
-
const endListener = createPointerEventListener(element, "end",
|
|
246
|
+
const endListener = createPointerEventListener(element, "end", evt => {
|
|
248
247
|
removeMoveListener();
|
|
249
248
|
});
|
|
250
249
|
|
package/src/DevApp.js
CHANGED
|
@@ -396,7 +396,7 @@ const drawToTexture = (effect, designAreaList) => async (
|
|
|
396
396
|
|
|
397
397
|
for (const designArea of designAreas) {
|
|
398
398
|
await drawCanvasToArea({
|
|
399
|
-
drawToContext: (ctx, x, y, width) => {
|
|
399
|
+
drawToContext: (ctx, x, y, width, height) => {
|
|
400
400
|
drawImage(ctx, width / designArea.position.width, effect);
|
|
401
401
|
},
|
|
402
402
|
designArea,
|
|
@@ -646,7 +646,6 @@ const App = () => {
|
|
|
646
646
|
let restoreColor;
|
|
647
647
|
let to;
|
|
648
648
|
visualization.observable.on(EventTypes.Intersection, v => {
|
|
649
|
-
// eslint-disable-next-line no-console
|
|
650
649
|
console.log("Intersection", v);
|
|
651
650
|
const mat = v.data.target.object.material;
|
|
652
651
|
window.clearTimeout(to);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
export const FallbackVisualization = ({
|
|
3
|
+
export const FallbackVisualization = ({
|
|
4
|
+
imageSrc,
|
|
5
|
+
className,
|
|
6
|
+
classNameEmpty
|
|
7
|
+
}) =>
|
|
4
8
|
imageSrc ? (
|
|
5
9
|
<img className={className} src={imageSrc} />
|
|
6
10
|
) : (
|
|
@@ -51,7 +51,6 @@ const createDropShadow = ({ offsetX, offsetY, blur, color }) =>
|
|
|
51
51
|
|
|
52
52
|
function modifyImage(srcCanvas, shadows) {
|
|
53
53
|
if (!shadows || shadows.length === 0) {
|
|
54
|
-
// eslint-disable-next-line no-console
|
|
55
54
|
console.warn("Could not apply effect, shadows has to be provided!");
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
@@ -10,7 +10,7 @@ const SVG_DATA_URL_HDR = "data:image/svg+xml;base64,";
|
|
|
10
10
|
|
|
11
11
|
const getScaleValues = node => {
|
|
12
12
|
const transform = node.getAttribute("transform") || "";
|
|
13
|
-
const matches = transform.match(/scale\(([
|
|
13
|
+
const matches = transform.match(/scale\(([^\)]+)\)/);
|
|
14
14
|
if (matches) {
|
|
15
15
|
const [x, y] = matches[1].split(",").map(window.parseFloat);
|
|
16
16
|
return [x, y || x];
|
|
@@ -20,7 +20,7 @@ const getScaleValues = node => {
|
|
|
20
20
|
|
|
21
21
|
const getRotateValue = node => {
|
|
22
22
|
const transform = node.getAttribute("transform") || "";
|
|
23
|
-
const matches = transform.match(/rotate\(([
|
|
23
|
+
const matches = transform.match(/rotate\(([^\)]+)\)/);
|
|
24
24
|
if (matches) {
|
|
25
25
|
return window.parseFloat(matches[1]);
|
|
26
26
|
}
|
|
@@ -105,7 +105,6 @@ const applyOnEmbeddedSvg = async (imageNode, imageCanvas, ctx, rootSvgElement) =
|
|
|
105
105
|
ctx.drawImage(tmpCanvas, 0, 0);
|
|
106
106
|
ctx.restore();
|
|
107
107
|
} catch (e) {
|
|
108
|
-
// eslint-disable-next-line no-console
|
|
109
108
|
console.error("Error during embedded svg image processing!", e);
|
|
110
109
|
}
|
|
111
110
|
};
|
package/src/React/ReactBase.js
CHANGED
|
@@ -19,7 +19,7 @@ export class ReactBase extends VisualizationInterface {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
init(container = document.createElement("div")) {
|
|
22
|
+
init(container = document.createElement("div"), useDefaultSetup = true) {
|
|
23
23
|
this._isInitialized = true;
|
|
24
24
|
this._container = container;
|
|
25
25
|
this.render();
|