Merge pull request #260 from astrofrog/jlab2
Fix compatibility with Jupyter Lab 2.0
This commit is contained in:
Коммит
9cf4f2efc2
16
lib/wwt.js
16
lib/wwt.js
|
@ -61,6 +61,9 @@ var WWTView = widgets.DOMWidgetView.extend({
|
|||
this.model.on('msg:custom', this.handle_custom_message, this);
|
||||
},
|
||||
|
||||
// Note: processPhosphorMessage is needed for Jupyter Lab <2 and
|
||||
// processLuminoMessage is needed for Jupyter Lab 2.0+
|
||||
|
||||
processPhosphorMessage: function(msg) {
|
||||
// We listen for phosphor resize events so that when Jupyter Lab is
|
||||
// used, we adjust the canvas size to the tab/panel in Jupyter Lab.
|
||||
|
@ -74,6 +77,19 @@ var WWTView = widgets.DOMWidgetView.extend({
|
|||
}
|
||||
},
|
||||
|
||||
processLuminoMessage: function(msg) {
|
||||
// We listen for lumino resize events so that when Jupyter Lab is
|
||||
// used, we adjust the canvas size to the tab/panel in Jupyter Lab.
|
||||
// See relayout for more details.
|
||||
WWTView.__super__.processLuminoMessage.apply(this, arguments);
|
||||
switch (msg.type) {
|
||||
case 'resize':
|
||||
case 'after-show':
|
||||
this.relayout();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
relayout: function() {
|
||||
// Only do resizing if we are not in the notebook context but in a
|
||||
// split panel context. We find this out by checking if one of the
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"clean:nbextension": "rimraf pywwt/nbextension/static/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jupyter-widgets/base": "^2.0.1"
|
||||
"@jupyter-widgets/base": "^2 || ^3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2",
|
||||
|
|
Загрузка…
Ссылка в новой задаче