nglview-js-widgets
Advanced tools
Comparing version 1.2.0 to 2.0.0
{ | ||
"name": "nglview-js-widgets", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "nglview-js-widgets", | ||
@@ -41,3 +41,3 @@ "author": "Hai Nguyen <hainm.comp@gmail.com>, Alexander Rose <alexander.rose@weirdbyte.de>", | ||
"json-loader": "^0.5.4", | ||
"ngl": "2.0.0-dev.35", | ||
"ngl": "2.0.0-dev.36", | ||
"style-loader": "^0.13.1", | ||
@@ -50,3 +50,3 @@ "webpack": "^1.12.14" | ||
"underscore": "^1.8.3", | ||
"ngl": "2.0.0-dev.35", | ||
"ngl": "2.0.0-dev.36", | ||
"@jupyter-widgets/base": "^1.0.0" | ||
@@ -53,0 +53,0 @@ }, |
@@ -254,4 +254,11 @@ var widgets = require("@jupyter-widgets/base"); | ||
var ngl_stage_params = that.model.get('_ngl_full_stage_parameters_embed'); | ||
var ngl_color_dict = that.model.get("_ngl_color_dict"); | ||
var loadfile_list = []; | ||
var label | ||
// reconstruct colors | ||
for (label in ngl_color_dict){ | ||
that._make_color_scheme(ngl_color_dict[label], label); | ||
} | ||
_.each(ngl_msg_archive, function(msg){ | ||
@@ -957,2 +964,3 @@ if (msg.methodName == 'loadFile'){ | ||
var file = new File([""], args0.data); | ||
var path = ""; | ||
if (args0.type == 'path' && ! file.exists){ | ||
@@ -988,6 +996,10 @@ // hacky fix for jupyterlab | ||
_make_color_scheme: function(args){ | ||
console.log("making color scheme", args); | ||
return NGL.ColormakerRegistry.addSelectionScheme(args) | ||
}, | ||
_make_color_scheme: function(args, label){ | ||
var id = NGL.ColormakerRegistry.addSelectionScheme(args, label); | ||
var scheme = NGL.ColormakerRegistry.userSchemes[id]; | ||
NGL.ColormakerRegistry.removeScheme(id); | ||
// hard code the scheme ID | ||
NGL.ColormakerRegistry.add(label, scheme); | ||
return label | ||
}, | ||
@@ -1001,6 +1013,13 @@ on_msg: function(msg) { | ||
// handle color | ||
if (msg.methodName == 'addRepresentation' && | ||
msg.reconstruc_color_scheme){ | ||
msg.kwargs.color = this._make_color_scheme(msg.kwargs.color); | ||
msg.kwargs.color = this._make_color_scheme(msg.kwargs.color, msg.kwargs.color_label); | ||
} | ||
if ("colorVolume" in msg.kwargs){ | ||
// backend only send component index | ||
// so we need to convert to 'volume' data | ||
index = msg.kwargs["colorVolume"]; | ||
msg.kwargs["colorVolume"] = this.stage.compList[index].volume; | ||
} | ||
@@ -1007,0 +1026,0 @@ switch (msg.target) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
4406731
24318
+ Addedngl@2.0.0-dev.36(transitive)
- Removedngl@2.0.0-dev.35(transitive)
Updatedngl@2.0.0-dev.36