Comparing version 0.1.2 to 0.1.3
@@ -1,22 +0,22 @@ | ||
export default [ | ||
{ visualization_type: 'stick', color: '#fedcba' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#fedcba' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#abcdef' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
{ visualization_type: 'stick', color: '#bada55' }, | ||
]; | ||
export default { | ||
0: { visualization_type: 'stick', color: '#fedcba' }, | ||
1: { visualization_type: 'stick', color: '#abcdef' }, | ||
2: { visualization_type: 'stick', color: '#abcdef' }, | ||
3: { visualization_type: 'stick', color: '#abcdef' }, | ||
4: { visualization_type: 'stick', color: '#abcdef' }, | ||
5: { visualization_type: 'stick', color: '#abcdef' }, | ||
6: { visualization_type: 'stick', color: '#abcdef' }, | ||
7: { visualization_type: 'stick', color: '#fedcba' }, | ||
8: { visualization_type: 'stick', color: '#abcdef' }, | ||
9: { visualization_type: 'stick', color: '#abcdef' }, | ||
10: { visualization_type: 'stick', color: '#abcdef' }, | ||
11: { visualization_type: 'stick', color: '#abcdef' }, | ||
12: { visualization_type: 'stick', color: '#bada55' }, | ||
13: { visualization_type: 'stick', color: '#bada55' }, | ||
14: { visualization_type: 'stick', color: '#bada55' }, | ||
15: { visualization_type: 'stick', color: '#bada55' }, | ||
16: { visualization_type: 'stick', color: '#bada55' }, | ||
17: { visualization_type: 'stick', color: '#bada55' }, | ||
18: { visualization_type: 'stick', color: '#bada55' }, | ||
19: { visualization_type: 'stick', color: '#bada55' }, | ||
}; |
@@ -35,4 +35,4 @@ import Backbone from 'backbone'; | ||
onBlurShape(event) { | ||
this.model.set('shape', JSON.parse(event.target.value)); | ||
onBlurShapes(event) { | ||
this.model.set('shapes', JSON.parse(event.target.value)); | ||
}, | ||
@@ -102,3 +102,3 @@ | ||
const shapesLabel = document.createElement('h4'); | ||
shapesLabel.innerHTML = 'shape'; | ||
shapesLabel.innerHTML = 'shapes'; | ||
this.el.appendChild(shapesLabel); | ||
@@ -108,4 +108,4 @@ const shapesTA = document.createElement('textarea'); | ||
shapesTA.rows = '3'; | ||
shapesTA.value = JSON.stringify(this.model.get('shape')); | ||
shapesTA.addEventListener('blur', this.onBlurShape.bind(this)); | ||
shapesTA.value = JSON.stringify(this.model.get('shapes')); | ||
shapesTA.addEventListener('blur', this.onBlurShapes.bind(this)); | ||
this.el.appendChild(shapesTA); | ||
@@ -112,0 +112,0 @@ |
@@ -18,3 +18,3 @@ import 'babel-polyfill'; | ||
styles, | ||
shape: { | ||
shapes: [{ | ||
type: 'Arrow', | ||
@@ -31,3 +31,3 @@ start: { | ||
}, | ||
}, | ||
}], | ||
selection_type: selectionTypesConstants.ATOM, | ||
@@ -34,0 +34,0 @@ orbital, |
{ | ||
"name": "nbmolviz3d", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "3D molecule visualization", | ||
@@ -12,2 +12,3 @@ "main": "dist/bundle.js", | ||
"dependencies": { | ||
"babel-polyfill": "^6.13.0", | ||
"backbone": "^1.3.3", | ||
@@ -20,3 +21,2 @@ "jquery": "^3.1.0", | ||
"babel-loader": "^6.2.4", | ||
"babel-polyfill": "^6.13.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
@@ -28,5 +28,5 @@ "chai": "^3.5.0", | ||
"eslint-loader": "^1.3.0", | ||
"eslint-plugin-import": "^1.14.0", | ||
"eslint-plugin-import": "^1.15.0", | ||
"eslint-plugin-jsx-a11y": "^2.2.2", | ||
"eslint-plugin-react": "^6.2.0", | ||
"eslint-plugin-react": "^6.2.2", | ||
"inline-environment-variables-webpack-plugin": "^1.1.0", | ||
@@ -33,0 +33,0 @@ "karma": "^0.13.22", |
@@ -120,2 +120,11 @@ # nbmolviz3d | ||
### Running Tests | ||
Unit tests can be run with: | ||
npm test | ||
End-to-end tests can be run with: | ||
npm run e2e | ||
### Releasing a new version | ||
@@ -128,2 +137,3 @@ A new version should be released via npm every time new code is merged to master. Currently, this process is manual and obviously must be done by a collaborator of the npm package. | ||
git push origin master | ||
git push origin --tags | ||
npm publish | ||
@@ -130,0 +140,0 @@ |
@@ -19,2 +19,5 @@ /** | ||
import jquery from 'jquery'; | ||
import MolWidget3DModel from './models/mol_widget_3d_model'; | ||
import MolWidget3DView from './views/mol_widget_3d_view'; | ||
if (window) { | ||
@@ -25,5 +28,3 @@ window.jquery = jquery; | ||
import MolWidget3DModel from './models/mol_widget_3d_model'; | ||
import MolWidget3DView from './views/mol_widget_3d_view'; | ||
export { MolWidget3DModel, MolWidget3DView }; |
@@ -31,11 +31,6 @@ /** | ||
}, | ||
styles: [], | ||
styles: {}, | ||
selected_atom_indices: [], | ||
selection_type: selectionTypesConstants.ATOM, | ||
shape: { | ||
type: '', | ||
x: null, | ||
y: null, | ||
z: null, | ||
}, | ||
shape: [], | ||
width: '500px', | ||
@@ -42,0 +37,0 @@ }, |
@@ -36,3 +36,8 @@ import shapeConstants from '../constants/shape_constants'; | ||
getShapeSpec(shape, callback) { | ||
const shapeSpec = { | ||
let color; | ||
if (shape.color) { | ||
color = libUtils.colorStringToNumber(shape.color); | ||
} | ||
const shapeSpec = Object.assign({}, { | ||
alpha: 0.8, | ||
@@ -43,3 +48,3 @@ callback, | ||
radius: shape.radius, | ||
}; | ||
}, shape, { color }); | ||
@@ -46,0 +51,0 @@ if (shape.type === shapeConstants.ARROW) { |
@@ -10,3 +10,3 @@ import selectionTypesConstants from '../constants/selection_types_constants'; | ||
modelDataToCDJSON(modelData) { | ||
const atoms = modelData.atoms.map((atom) => ({ | ||
const atoms = modelData.atoms.map(atom => ({ | ||
l: atom.elem, | ||
@@ -19,3 +19,3 @@ x: atom.positions[0], | ||
const bonds = modelData.bonds.map((bond) => ({ | ||
const bonds = modelData.bonds.map(bond => ({ | ||
b: bond.atom1_index, | ||
@@ -22,0 +22,0 @@ e: bond.atom2_index, |
@@ -17,5 +17,2 @@ /** | ||
import Backbone from 'backbone'; | ||
const jQuery = require('jquery'); | ||
window.$ = jQuery; | ||
const $3Dmol = require('../vendor/3Dmol'); | ||
import environmentConstants from '../constants/environment_constants'; | ||
@@ -25,2 +22,7 @@ import libUtils from '../utils/lib_utils'; | ||
const jQuery = require('jquery'); | ||
window.$ = jQuery; | ||
const $3Dmol = require('../vendor/3Dmol'); | ||
const DEFAULT_VISUALIZATION_TYPE = 'stick'; | ||
@@ -49,3 +51,3 @@ const DEFAULT_FONT_SIZE = 14; | ||
this.mydiv = this.mydiv || document.createElement('div'); | ||
this.mydiv = this.mydiv || window.document.createElement('div'); | ||
this.mydiv.classList.add('nbmolviz3d'); | ||
@@ -125,7 +127,8 @@ this.mydiv.style.width = this.model.get('width'); | ||
// Shape | ||
const shape = this.model.get('shape'); | ||
if (shape.type) { | ||
glviewer[`add${shape.type}`](libUtils.getShapeSpec(shape, this.setSelectionTrait)); | ||
} | ||
// Shapes | ||
this.model.get('shapes').forEach((shape) => { | ||
if (shape.type) { | ||
glviewer[`add${shape.type}`](libUtils.getShapeSpec(shape, this.setSelectionTrait)); | ||
} | ||
}); | ||
@@ -137,3 +140,3 @@ // Orbital | ||
glviewer.addIsosurface(volumeData, { | ||
isoVal: orbital.iso_val, | ||
isoval: orbital.iso_val, | ||
color: ORBITAL_COLOR_POSITIVE, | ||
@@ -143,3 +146,3 @@ opacity: orbital.opacity, | ||
glviewer.addIsosurface(volumeData, { | ||
isoVal: -orbital.iso_val, | ||
isoval: -orbital.iso_val, | ||
color: ORBITAL_COLOR_NEGATIVE, | ||
@@ -146,0 +149,0 @@ opacity: orbital.opacity, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3422786
27
36708
151
4
+ Addedbabel-polyfill@^6.13.0
+ Addedbabel-polyfill@6.26.0(transitive)
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedregenerator-runtime@0.10.50.11.1(transitive)