diff --git a/package.json b/package.json index 8da318a6..bd69dba2 100644 --- a/package.json +++ b/package.json @@ -168,7 +168,7 @@ "style-loader": "^1.0.0", "stylelint": "^11.0.0", "stylelint-config-standard": "^19.0.0", - "three": "=0.108.0", + "three": "0.109.0", "toastr": "^2.1.4", "uglify-js": "^3.6.0", "url-loader": "^2.1.0", diff --git a/rollup.config.js b/rollup.config.js index b8c9ec52..130b7ca8 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,6 +6,7 @@ import rollupPluginReplace from 'rollup-plugin-replace'; import rollupPluginNodeResolve from 'rollup-plugin-node-resolve'; import rollupPluginString from 'rollup-plugin-string'; +import path from 'path'; import version from './tools/version'; import packageJson from './package.json'; @@ -51,11 +52,12 @@ export default { rollupPluginBabel({ runtimeHelpers: true, exclude: [ - './node_modules/**', + /node_modules[\\/](?!three)/, './vendor/js/**', './src/utils/SelectionParser', './src/utils/MiewCLIParser.js', ], + extends: path.join(__dirname, '/.babelrc'), }), ], diff --git a/src/chem/Residue.js b/src/chem/Residue.js index 67a5aefb..9765ab09 100644 --- a/src/chem/Residue.js +++ b/src/chem/Residue.js @@ -186,8 +186,11 @@ class Residue { const vectorB = prevLeadPos.clone().sub(prevWingPos); vectorB.crossVectors(vectorA, vectorB); vectorB.crossVectors(vectorA, vectorB).normalize(); - if (prevWing !== null && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2) { - vectorB.negate(); + if (prevWing !== null && prevWing.length() > 0.0001) { + const needToNegate = vectorB.length() > 0.0001 && Math.abs(prevWing.angleTo(vectorB)) > Math.PI / 2; + if (needToNegate) { + vectorB.negate(); + } } return vectorB; } diff --git a/webpack.config.babel.js b/webpack.config.babel.js index a2752182..1ab65b37 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -22,8 +22,13 @@ const configure = (prod) => ({ module: { rules: [{ test: /\.js$/, - exclude: /(node_modules|vendor)/, - use: ['babel-loader'], + exclude: /(node_modules[\\/](?!three))|vendor/, + use: { + loader: 'babel-loader', + options: { + extends: path.join(__dirname, '/.babelrc'), + }, + }, }, { test: /\.[sp]?css$/, use: [ diff --git a/yarn.lock b/yarn.lock index c4224231..bd9402aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8812,10 +8812,10 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -three@=0.108.0: - version "0.108.0" - resolved "https://registry.yarnpkg.com/three/-/three-0.108.0.tgz#53d26597c7932f214bb43f4655e566d2058143b5" - integrity sha512-d1ysIXwi8qTlbmMwrTxi5pYiiYIflEr0e48krP0LAY8ndS8c6fkLHn6NvRT+o76/Fs9PBLxFViuI62iGVWwwlg== +three@0.109.0: + version "0.109.0" + resolved "https://registry.yarnpkg.com/three/-/three-0.109.0.tgz#611c9ef860d10bd107695cead6c6abcd2422e5fd" + integrity sha512-XT99T3Hvgh2CEvwPdHYEunNE+clLK6KiT1U8En7YOgIqTUw4MrLeIc8zxQAJ6wbP8hhJaY5+Cff3jwBPpBa0gA== through2@^2.0.0: version "2.0.5"