Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed support for optimade, poscar and some cifs; error styles #23

Merged
merged 7 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions player/player.view.css
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут лучше бы просто перехватывать ошибки и рисовать кастомное сообщение.

This file was deleted.

11 changes: 11 additions & 0 deletions player/player.view.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ namespace $.$$ {
height: '2rem',
},

Message: {
background: {
color: $mol_theme.back,
},
position: 'absolute',
zIndex: 1,
top: '6rem',
left: '50%',
transform: 'translateX(-50%)',
stan-donarise marked this conversation as resolved.
Show resolved Hide resolved
},

} )

}
4 changes: 4 additions & 0 deletions player/player.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ $mpds_cifplayer_player $mol_view
\
\display none
S \elements
^ message_visible / <= Message $mol_view
sub /
<= Message_card $mol_card
title <= message? \
colors_light *
a \#990000
b \#009900
Expand Down
27 changes: 19 additions & 8 deletions player/player.view.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace $.$$ {

export class $mpds_cifplayer_player extends $.$mpds_cifplayer_player {

@ $mol_mem
render(): void {
this.structure_3d_data() //for bubbling errors into view
super.render()
}

@ $mol_mem
available_overlays() {
return {
Expand Down Expand Up @@ -91,9 +85,27 @@ namespace $.$$ {
this.camera().position.add( this.camera_distance().multiplyScalar( this.zoom_scale_step() ) )
}

@ $mol_mem
message_visible() {
return this.message() ? super.message_visible() : []
}

@ $mol_mem
structure_3d_data() {
return new $mpds_cifplayer_matinfio( this.data() ).player()
try {

this.message( '' )

return new $mpds_cifplayer_matinfio( this.data() ).player()

} catch ( error: any ) {

const message = error.message || error
this.message( message )
stan-donarise marked this conversation as resolved.
Show resolved Hide resolved

return {} as ReturnType< $mpds_cifplayer_matinfio['player'] >

}
}

@ $mol_mem_key
Expand Down Expand Up @@ -444,7 +456,6 @@ namespace $.$$ {

@ $mol_mem
left_panel(): readonly any[] {
console.log('this.structure_3d_data()', this.structure_3d_data())
return this.structure_3d_data().cell_matrix ? super.left_panel() : []
}

Expand Down
Loading