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

camera centered by translations; fixes #53

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions app/app.view.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ namespace $.$$ {
},
},

Data_text: {
font: {
family: 'inherit',
},
},

Body: {
flex: {
direction: 'column',
Expand Down
2 changes: 2 additions & 0 deletions app/app.view.tree → app/app.web.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ $optimade_cifplayer_app $mol_drop
data <= data_str? \
vibrate? => vibrate?
unvibrate => unvibrate
fullscreen false
light_theme_auto null
Copy link

Choose a reason for hiding this comment

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

false может?

Start $mol_view
sub /
<= Start_message $mol_text
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions lib/three/view/view.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ $optimade_cifplayer_lib_three_view $mol_view
<= controls_target_changed null
<= resize null
<= start_render_loop null
event *
pointerdown? <=> pointerdown? null
4 changes: 4 additions & 0 deletions lib/three/view/view.view.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ namespace $.$$ {
this.renderer()?.dispose()
}

pointerdown() {
this.focused( true )
Copy link

Choose a reason for hiding this comment

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

А зачем фокусировка?

}

}


Expand Down
2 changes: 1 addition & 1 deletion player/player.view.tree → player/player.web.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $optimade_cifplayer_player $mol_view
<= Theme $mol_theme_auto
-
auto /
<= external_theme_auto null
<= light_theme_auto null
<= dir_light null
<= ambient_light null
^ atom_boxes /
Expand Down
10 changes: 6 additions & 4 deletions player/player.view.web.ts → player/player.web.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace $.$$ {
export class $optimade_cifplayer_player extends $.$optimade_cifplayer_player {

@ $mol_mem
external_theme_auto() {
light_theme_auto() {
this.$.$mol_lights( true )
}

Expand Down Expand Up @@ -157,18 +157,20 @@ namespace $.$$ {

@ $mol_mem
controls_target() {
const cell_center = this.cell_center()
let cell_center = this.cell_center()

if( !cell_center ) {
const atoms = this.structure_3d_data().atoms

return atoms.reduce(( acc: InstanceType< THREE["Vector3"] >, atom ) => {
cell_center = atoms.reduce(( acc: InstanceType< THREE["Vector3"] >, atom ) => {
const { x, y, z } = atom
return acc.add( new THREE.Vector3( x, y, z ) )
}, new THREE.Vector3() ).divideScalar( atoms.length )
}

return this.centered() ? cell_center.clone() : new THREE.Vector3()
const [ a, b, c ] = this.translate_cells()

return this.centered() ? cell_center.clone().multiply( new THREE.Vector3( a, b, c ) ) : new THREE.Vector3()
}

@ $mol_mem
Expand Down
Loading