Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm committed Dec 11, 2024
1 parent 7eb0880 commit b6bb207
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions js/src/event_handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NGLView } from "./widget_ngl";
import { NGLModel, NGLView } from "./widget_ngl";

export class EventHandler {
view: NGLView;
Expand Down Expand Up @@ -85,9 +85,9 @@ export class EventHandler {
var m = this.view.stage.viewerControls.getOrientation();
if (this.view._synced_model_ids.length > 0 && this.view._ngl_focused == 1) {
this.view._synced_model_ids.forEach(async (mid) => {
var model = await this.view.model.widget_manager.get_model(mid);
var model = await this.view.model.widget_manager.get_model(mid) as NGLModel;
for (var k in model.views) {
var view = await model.views[k];
var view = await model.views[k] as NGLView;
if (view.uuid != this.view.uuid) {
view.stage.viewerControls.orient(m);
}
Expand Down
3 changes: 2 additions & 1 deletion js/src/message_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export class MessageHandler {
var component = this.view.stage.compList[msg.args[0]];
this.view.stage.removeComponent(component);
} else if (msg.methodName === 'loadFile') {
if (this.view.model.views.length > 1 && msg.kwargs && msg.kwargs.defaultRepresentation) {
var views = this.view.model.views;
if (Object.keys(views).length > 1 && msg.kwargs && msg.kwargs.defaultRepresentation) {
msg.kwargs.defaultRepresentation = false;
}
await this.view._handleStageLoadFile(msg);
Expand Down
4 changes: 2 additions & 2 deletions js/src/representation_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class RepresentationHandler {
this.view._synced_repr_model_ids.forEach(async (mid) => {
var model = await this.view.model.widget_manager.get_model(mid);
for (var k in model.views) {
var view = await model.views[k];
var view = await model.views[k] as NGLView;
if (view.uuid != this.view.uuid) {
view._set_representation_from_repr_dict(repr_dict);
}
Expand Down Expand Up @@ -68,7 +68,7 @@ export class RepresentationHandler {
async syncReprWithMe() {
var repr_dict = this.getReprDictFrontEnd();
for (var k in this.view.model.views) {
var v = await this.view.model.views[k];
var v = await this.view.model.views[k] as NGLView;
if (v.uuid != this.view.uuid) {
v._set_representation_from_repr_dict(repr_dict);
}
Expand Down
1 change: 1 addition & 0 deletions js/src/widget_ngl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class NGLView extends widgets.DOMWidgetView {
_synced_model_ids: string[];
_synced_repr_model_ids: string[];
atomColor: any;
$pickingInfo: any;


constructor(options: any) {
Expand Down

0 comments on commit b6bb207

Please sign in to comment.