Merge pull request #260 from astrofrog/jlab2

Fix compatibility with Jupyter Lab 2.0
This commit is contained in:
Peter Williams 2020-04-02 13:37:03 -04:00 коммит произвёл GitHub
Родитель 9775b08778 8341ede8bc
Коммит 9cf4f2efc2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -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",