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 2 commits
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
14 changes: 9 additions & 5 deletions player/player.view.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,18 @@ namespace $.$$ {
},

Message: {
background: {
color: $mol_theme.back,
},
position: 'absolute',
zIndex: 1,
top: '6rem',
left: '50%',
transform: 'translateX(-50%)',
left: 0,
right: 0,
},

Message_card: {
background: {
color: $mol_theme.back,
},
margin: 'auto',
},

} )
Expand Down
5 changes: 3 additions & 2 deletions player/player.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ $mpds_cifplayer_player $mol_view
sub <= overlays_sub /
<= Switch_overlay $mol_switch
value? <=> overlay? \S
options <= available_overlays *
options <= available_overlays *string
\
\display none
S \elements
^ message_visible / <= Message $mol_view
sub /
<= Message_card $mol_card
title <= message? \
theme \$mol_theme_special
Copy link

Choose a reason for hiding this comment

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

А тут accent не уместней?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

я карточке поставил цвет фона $mol_theme.back, чтобы была непрозрачной, и тему special т.к. стандартная тема сливается с фоном, accent будет выглядеть как кнопка.
2024-03-09 21 42 29

ну или можно на Message_card().Content() сделать цвет фона $mol_theme.card (а на Message_card - $mol_theme.back) и тогда уже без тем будет непрозрачной и не сливаться, (еще есть контейнер - Message, можно было бы сделать непрозрачным его, но с margin auto он теперь на всю ширину)

Copy link

Choose a reason for hiding this comment

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

А зачем вообще что-то показывать под сообщением? Мы же не смогли отрендерить ничего.

title <= message \
colors_light *
a \#990000
b \#009900
Expand Down
32 changes: 21 additions & 11 deletions player/player.view.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ namespace $.$$ {

@ $mol_mem
available_overlays() {
try {
this.structure_3d_data()
} catch (error) {
return {}
}

return {
...super.available_overlays(),
...this.structure_3d_data().overlayed
Expand Down Expand Up @@ -91,23 +97,21 @@ namespace $.$$ {
}

@ $mol_mem
structure_3d_data() {
message(): string {
try {

this.message( '' )
this.structure_3d_data()
return ''

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

} catch ( error: any ) {

const message = error.message || error
this.message( message )

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

return error.message || error
}
}

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

@ $mol_mem_key
text_canvas( text: string ) {
const canvas = document.createElement( 'canvas' )
Expand Down Expand Up @@ -456,6 +460,12 @@ namespace $.$$ {

@ $mol_mem
left_panel(): readonly any[] {
try {
this.structure_3d_data()
} catch (error) {
return []
}

return this.structure_3d_data().cell_matrix ? super.left_panel() : []
}

Expand Down
Loading