Skip to content

Commit

Permalink
annotate
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm committed Dec 11, 2024
1 parent 07c303b commit fcef217
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
3 changes: 2 additions & 1 deletion js/src/ui_manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StageManager } from "./stage_manager";
import { NGLView } from "./widget_ngl";
import * as NGL from 'ngl';

export class UIManager {
view: NGLView;
Expand All @@ -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';
Expand Down
19 changes: 17 additions & 2 deletions js/src/widget_ngl.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -63,13 +63,28 @@ export class NGLModel extends widgets.DOMWidgetModel {
}

export class NGLView extends widgets.DOMWidgetView {
stage: NGL.Stage;
stageManager: StageManager;
eventHandler: EventHandler;
uiManager: UIManager;
embedHandler: EmbedHandler;
representationHandler: RepresentationHandler;
messageHandler: MessageHandler;
model: NGLModel;
player_pview: Promise<any>;
btn_pview_fullscreen: Promise<any>;
image_btn_pview: Promise<any>;
pgui_view: Promise<any>;
$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);
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions notebooks/custom_color.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "70326173cf5d4ff5a85cdc8cf76d1bcc",
"model_id": "336252d1c1f140b88fee28aa82c74d3d",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -42,7 +42,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2203a46f80094f71988df970f3053835",
"model_id": "64950eebf7bc4d838346392316a52e04",
"version_major": 2,
"version_minor": 0
},
Expand Down

0 comments on commit fcef217

Please sign in to comment.