diff --git a/js/src/ui_manager.ts b/js/src/ui_manager.ts index c80e9e1d..07ba1a31 100644 --- a/js/src/ui_manager.ts +++ b/js/src/ui_manager.ts @@ -1,5 +1,6 @@ import { StageManager } from "./stage_manager"; import { NGLView } from "./widget_ngl"; +import * as NGL from 'ngl'; export class UIManager { view: NGLView; @@ -11,7 +12,7 @@ export class UIManager { async createFullscreenBtn() { this.view.btn_pview_fullscreen = this.view.createView("_ibtn_fullscreen"); var view = await this.view.btn_pview_fullscreen; - var stage = this.view.stage; + var stage: NGL.Stage = this.view.stage; var pe = view.el; pe.style.position = 'absolute'; diff --git a/js/src/widget_ngl.ts b/js/src/widget_ngl.ts index 62835ecb..a563d2c5 100644 --- a/js/src/widget_ngl.ts +++ b/js/src/widget_ngl.ts @@ -1,4 +1,4 @@ -var widgets = require("@jupyter-widgets/base") +import * as widgets from "@jupyter-widgets/base" import * as NGL from "ngl" import * as $ from 'jquery' import * as _ from 'underscore' @@ -63,6 +63,7 @@ export class NGLModel extends widgets.DOMWidgetModel { } export class NGLView extends widgets.DOMWidgetView { + stage: NGL.Stage; stageManager: StageManager; eventHandler: EventHandler; uiManager: UIManager; @@ -70,6 +71,20 @@ export class NGLView extends widgets.DOMWidgetView { representationHandler: RepresentationHandler; messageHandler: MessageHandler; model: NGLModel; + player_pview: Promise; + btn_pview_fullscreen: Promise; + image_btn_pview: Promise; + pgui_view: Promise; + $container: any; + ngl_view_id: string; + uuid: string; + stage_widget: typeof StageWidget; + _ngl_focused: number; + comp_uuids: string[]; + _synced_model_ids: string[]; + _synced_repr_model_ids: string[]; + atomColor: any; + constructor(options: any) { super(options); @@ -120,7 +135,7 @@ export class NGLView extends widgets.DOMWidgetView { this.touch(); if (!this.embedHandler.isEmbeded() && this.stage.compList.length < this.model.get("n_components")) { // only call this in notebook to avoid calling handleEmbed twice in embeded mode. - this.handleEmbed() + this.embedHandler.handleEmbed() } var ngl_view_ids = this.model.get("_ngl_view_id") ngl_view_ids.push(this.ngl_view_id) diff --git a/notebooks/custom_color.ipynb b/notebooks/custom_color.ipynb index 74d10251..8591dd69 100644 --- a/notebooks/custom_color.ipynb +++ b/notebooks/custom_color.ipynb @@ -15,7 +15,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "70326173cf5d4ff5a85cdc8cf76d1bcc", + "model_id": "336252d1c1f140b88fee28aa82c74d3d", "version_major": 2, "version_minor": 0 }, @@ -42,7 +42,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "2203a46f80094f71988df970f3053835", + "model_id": "64950eebf7bc4d838346392316a52e04", "version_major": 2, "version_minor": 0 },