Skip to content

Commit

Permalink
plot.sub refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-donarise committed Jan 31, 2025
1 parent 746d5fd commit 7bd600e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
14 changes: 8 additions & 6 deletions plot/plot.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ $mpds_visavis_plot $mol_view
plot_raw null
show_setup false
notify? null
Fullscreen $mol_check
Icon <= Expand_icon $mol_icon_arrow_expand_all
checked? <=> fullscreen? false
show_demo_warn? false
Demo_warn $mol_paragraph
title \You are using the limited demo. Buy the full access and support our work.
sub /
^ demo_warn_visible / <= Demo_warn $mol_paragraph
title \You are using the limited demo. Buy the full access and support our work.
<= Fullscreen $mol_check
Icon <= Expand_icon $mol_icon_arrow_expand_all
checked? <=> fullscreen? false
<= Plot $mol_view
plots *
matrix <= Matrix $mpds_visavis_plot_matrix
plot_raw <= plot_raw
Expand All @@ -36,7 +38,7 @@ $mpds_visavis_plot $mol_view
plot_raw <= plot_raw
multi_jsons <= multi_jsons
show_setup <= show_setup
show_fixel? <= show_fixel? true
- show_fixel? <= show_fixel? true
nonformers_checked? <=> nonformers_checked?
fixel_checked? <=> cube_fixel_checked? false
x_op? => x_op?
Expand Down
29 changes: 18 additions & 11 deletions plot/plot.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,24 @@ namespace $.$$ {
}

@ $mol_mem
sub() {
const phase_data_demo = this.plot_raw()?.type()! == 'pd' ? this.phase_data_demo() : false
const show_demo_warn = this.show_demo_warn()
&& ! [ 'matrix', 'discovery' ].includes( this.plot_raw()?.type()! )
&& ! phase_data_demo

return this.plot_raw() ? [
... show_demo_warn ? [ this.Demo_warn() ] : [],
this.Fullscreen(),
this.plots()[ this.plot_raw()!.type() ]
] : []
plot_type(): ReturnType< $mpds_visavis_plot_raw['type'] > {
return this.plot_raw()?.type()!
}

@ $mol_mem
demo_warn_visible() {
if( !this.show_demo_warn() ) return []

if( this.plot_type() == 'matrix' ) return []
if( this.plot_type() == 'discovery' ) return []
if( this.plot_type() == 'pd' && !this.phase_data_demo() ) return []

return [ this.Demo_warn() ]
}

@ $mol_mem
Plot() {
return this.plot_type() ? this.plots()[ this.plot_type()! ] : super.Plot()
}

@ $mol_mem
Expand Down

0 comments on commit 7bd600e

Please sign in to comment.