From 7bd600e911325401240d06cf0427df505e92f421 Mon Sep 17 00:00:00 2001 From: stan-donarise Date: Sat, 1 Feb 2025 00:09:36 +0300 Subject: [PATCH 1/4] plot.sub refactoring --- plot/plot.view.tree | 14 ++++++++------ plot/plot.view.ts | 29 ++++++++++++++++++----------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/plot/plot.view.tree b/plot/plot.view.tree index 1dd625a..f700cf6 100644 --- a/plot/plot.view.tree +++ b/plot/plot.view.tree @@ -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 @@ -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? diff --git a/plot/plot.view.ts b/plot/plot.view.ts index 5a451a0..4fea72f 100644 --- a/plot/plot.view.ts +++ b/plot/plot.view.ts @@ -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 From 3248794bff7c3e4fde6217c001cdc3d31a34e28e Mon Sep 17 00:00:00 2001 From: stan-donarise Date: Mon, 24 Feb 2025 17:37:17 +0300 Subject: [PATCH 2/4] save state on error; `plot_raw.jsons` refactoring #43 --- app/app.view.ts | 10 +++-- plot/bar/bar.view.ts | 2 +- plot/cube/cube.view.tree | 1 - plot/cube/cube.view.ts | 16 +++---- plot/customscatter/customscatter.view.ts | 2 +- plot/discovery/discovery.view.tree | 2 +- plot/discovery/discovery.view.ts | 12 +++-- plot/eigen/eigen.view.ts | 2 +- plot/graph/graph.view.ts | 2 +- plot/heatmap/heatmap.view.ts | 2 +- plot/matrix/matrix.view.tree | 1 - plot/matrix/matrix.view.ts | 20 +++------ plot/phase/phase.view.ts | 2 +- plot/pie/pie.view.ts | 2 +- plot/plot.view.css.ts | 27 +++++++++++- plot/plot.view.tree | 11 +++-- plot/plot.view.ts | 56 ++++++++++++++++-------- plot/raw/raw.ts | 12 ++--- plot/scatter/scatter.view.ts | 2 +- 19 files changed, 113 insertions(+), 71 deletions(-) diff --git a/app/app.view.ts b/app/app.view.ts index cc4ff7f..ef2910a 100644 --- a/app/app.view.ts +++ b/app/app.view.ts @@ -8,7 +8,7 @@ namespace $.$$ { const data = $mol_wire_sync( this.$ ).$mol_blob_json( file ) - const plot_raw = $mol_wire_sync( this.$ ).$mpds_visavis_plot_raw_from_json( data, file.name ) + const plot_raw = $mol_wire_sync( this.$ ).$mpds_visavis_plot_raw_from_jsons( [ data ], file.name ) this.plot_opened_id( this.history_add( plot_raw ) ) } @@ -45,11 +45,13 @@ namespace $.$$ { return this.$.$mol_state_local.value( `${this}.history_plot_ids()` , next ) ?? [] } + @ $mol_mem_key plot_raw(id: string, next?: $mpds_visavis_plot_raw | null) { + if ( this.json_request_hash() ) { const json = $mpds_visavis_plot.fetch_plot_json( this.json_request_hash() ) - return $mpds_visavis_plot_raw_from_json( json, this.json_request_hash()! ) + return $mpds_visavis_plot_raw_from_jsons( [ json ], this.json_request_hash()! ) } if ( this.menu_section() == 'examples' ) { @@ -63,10 +65,10 @@ namespace $.$$ { @ $mol_mem_key plot_raw_example(id: string) { const data: $mpds_visavis_plot_raw['data_default'] | null = this.$.$mol_state_local.value( `${this}.plot_raw_example('${id}')` ) - if ( data ) return new $mpds_visavis_plot_raw( data ) + if ( data?.jsons ) return new $mpds_visavis_plot_raw( data ) const json = $mol_fetch.json( this.examples()[ id ] ) - const plot_raw = $mpds_visavis_plot_raw_from_json( json, id ) + const plot_raw = $mpds_visavis_plot_raw_from_jsons( [ json ], id ) this.$.$mol_state_local.value( `${this}.plot_raw_example('${id}')`, plot_raw.data() ) return plot_raw } diff --git a/plot/bar/bar.view.ts b/plot/bar/bar.view.ts index ada015a..b099727 100644 --- a/plot/bar/bar.view.ts +++ b/plot/bar/bar.view.ts @@ -16,7 +16,7 @@ namespace $.$$ { export class $mpds_visavis_plot_bar extends $.$mpds_visavis_plot_bar { json() { - return $mpds_visavis_plot_bar_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_bar_json( this.plot_raw().jsons()[0] ) } @ $mol_mem diff --git a/plot/cube/cube.view.tree b/plot/cube/cube.view.tree index 64f718a..7d654c6 100644 --- a/plot/cube/cube.view.tree +++ b/plot/cube/cube.view.tree @@ -2,7 +2,6 @@ $mpds_visavis_plot_cube $mol_view plot_raw $mpds_visavis_plot_raw auto / <= subscribe_click null - multi_jsons? null show_setup true show_fixel? true heatmap? false diff --git a/plot/cube/cube.view.ts b/plot/cube/cube.view.ts index 3879d99..3189b95 100644 --- a/plot/cube/cube.view.ts +++ b/plot/cube/cube.view.ts @@ -29,7 +29,7 @@ namespace $.$$ { setup() { return [ ... this.show_fixel() ? [ this.Fixel() ] : [], - ... this.multi_jsons() ? [ this.Intersection_on() ] : [], + ... this.plot_raw().jsons().length > 1 ? [ this.Intersection_on() ] : [], this.Nonformers(), ... this.show_setup() ? [ this.X_order(), this.Y_order(), this.Z_order() ] : [], ] @@ -39,13 +39,13 @@ namespace $.$$ { plot_body() { return [ this.Root(), - ... this.multi_jsons() ? [ this.Cmp_legend() ] : [], + ... this.plot_raw().jsons().length > 1 ? [ this.Cmp_legend() ] : [], ... this.heatmap() ? [ this.Side_right() ] : [], ] } json() { - return $mpds_visavis_plot_cube_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_cube_json( this.plot_raw().jsons()[0] ) } @ $mol_mem @@ -74,7 +74,7 @@ namespace $.$$ { @ $mol_mem heatmap_diif() { - const jsons = this.multi_jsons() as typeof $mpds_visavis_plot_cube_json.Value[] + const jsons = this.plot_raw().jsons() as typeof $mpds_visavis_plot_cube_json.Value[] if( jsons?.length == 2 ) { return jsons.every( json => json.payload.points.v.some(val => Math.floor(val) !== val) ) } @@ -85,7 +85,7 @@ namespace $.$$ { heatmap() { if( this.heatmap_diif() ) return this.intersection_only() - const jsons = this.multi_jsons() as typeof $mpds_visavis_plot_cube_json.Value[] + const jsons = this.plot_raw().jsons() as typeof $mpds_visavis_plot_cube_json.Value[] let json = this.json() if( jsons?.length == 1 ) json = jsons[0] @@ -171,7 +171,7 @@ namespace $.$$ { @ $mol_mem points_traversed() { - const jsons = this.multi_jsons() ?? [ this.json() ] + const jsons = this.plot_raw().jsons() const values_by_label: Record< string/*json index*/, @@ -297,7 +297,7 @@ namespace $.$$ { @ $mol_mem multi_dataset(): any[] | null { - if( ! this.multi_jsons() ) return null + if( this.plot_raw().jsons().length === 1 ) return null this.nonformers_checked( false ) @@ -310,7 +310,7 @@ namespace $.$$ { @ $mol_mem cmp_labels() { - return this.multi_jsons() ? this.multi_jsons()!.map( (json: any) => json.answerto ) : [] + return this.plot_raw().jsons().length > 1 ? this.plot_raw().jsons()!.map( (json: any) => json.answerto ) : [] } @ $mol_mem diff --git a/plot/customscatter/customscatter.view.ts b/plot/customscatter/customscatter.view.ts index e2ca2f4..462c16b 100644 --- a/plot/customscatter/customscatter.view.ts +++ b/plot/customscatter/customscatter.view.ts @@ -21,7 +21,7 @@ namespace $.$$ { export class $mpds_visavis_plot_customscatter extends $.$mpds_visavis_plot_customscatter { json() { - return $mpds_visavis_plot_customscatter_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_customscatter_json( this.plot_raw().jsons()[0] ) } @ $mol_mem diff --git a/plot/discovery/discovery.view.tree b/plot/discovery/discovery.view.tree index e62e33f..c468814 100644 --- a/plot/discovery/discovery.view.tree +++ b/plot/discovery/discovery.view.tree @@ -2,7 +2,7 @@ $mpds_visavis_plot_discovery $mol_view plot_raw $mpds_visavis_plot_raw auto / <= subscribe_click null - json_cmp? null + json_cmp null elementals_on? / show_setup true discovery_click? null diff --git a/plot/discovery/discovery.view.ts b/plot/discovery/discovery.view.ts index 49bfa19..47db501 100644 --- a/plot/discovery/discovery.view.ts +++ b/plot/discovery/discovery.view.ts @@ -110,7 +110,12 @@ namespace $.$$ { } json() { - return $mpds_visavis_plot_discovery_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_discovery_json( this.plot_raw().jsons()[0] ) + } + + json_cmp() { + const json_cmp = this.plot_raw().jsons()[1] + return json_cmp ? $mpds_visavis_plot_discovery_json( json_cmp ) : null } elementals_dict() { @@ -214,7 +219,7 @@ namespace $.$$ { data() { const json = this.json() - const json_cmp = this.json_cmp() ? $mpds_visavis_plot_discovery_json( this.json_cmp() ) : null + const json_cmp = this.json_cmp() const elementals_on = this.elementals_on() @@ -245,7 +250,8 @@ namespace $.$$ { @ $mol_mem cmp_labels() { - return this.json_cmp() ? [ this.json().answerto, this.json_cmp().answerto ] : [] + const cmp = this.json_cmp() + return cmp ? [ this.json().answerto, cmp.answerto ] : [] } } diff --git a/plot/eigen/eigen.view.ts b/plot/eigen/eigen.view.ts index a0f1234..ab32d60 100644 --- a/plot/eigen/eigen.view.ts +++ b/plot/eigen/eigen.view.ts @@ -61,7 +61,7 @@ namespace $.$$ { export class $mpds_visavis_plot_eigen extends $.$mpds_visavis_plot_eigen { json() { - return $mpds_visavis_plot_eigen_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_eigen_json( this.plot_raw().jsons()[0] ) } @ $mol_mem diff --git a/plot/graph/graph.view.ts b/plot/graph/graph.view.ts index 75c2abf..c8c87d9 100644 --- a/plot/graph/graph.view.ts +++ b/plot/graph/graph.view.ts @@ -37,7 +37,7 @@ namespace $.$$ { @ $mol_mem json() { - return $mpds_visavis_plot_graph_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_graph_json( this.plot_raw().jsons()[0] ) } plot_title() { diff --git a/plot/heatmap/heatmap.view.ts b/plot/heatmap/heatmap.view.ts index 09e7c32..4f27353 100644 --- a/plot/heatmap/heatmap.view.ts +++ b/plot/heatmap/heatmap.view.ts @@ -5,7 +5,7 @@ namespace $.$$ { export class $mpds_visavis_plot_heatmap extends $.$mpds_visavis_plot_heatmap { json() { - return this.plot_raw().json() as any + return this.plot_raw().jsons()[0] // return $mpds_visavis_plot_heatmap_json( this.plot_raw().json() as any ) } diff --git a/plot/matrix/matrix.view.tree b/plot/matrix/matrix.view.tree index c1fa272..1225d2c 100644 --- a/plot/matrix/matrix.view.tree +++ b/plot/matrix/matrix.view.tree @@ -3,7 +3,6 @@ $mpds_visavis_plot_matrix $mol_view auto / <= size_debounced 0 <= auto_reorder null - multi_jsons? null json_master null show_setup true size? 0 diff --git a/plot/matrix/matrix.view.ts b/plot/matrix/matrix.view.ts index df7669e..d76db50 100644 --- a/plot/matrix/matrix.view.ts +++ b/plot/matrix/matrix.view.ts @@ -52,8 +52,8 @@ namespace $.$$ { @ $mol_mem setup() { return [ - ... this.json().payload.fixel ? [ this.Fixel() ] : [], - ... this.multi_jsons() ? [ this.Intersection_on() ] : [], + ... this.json_master().payload.fixel ? [ this.Fixel() ] : [], + ... this.plot_raw().jsons().length > 1 ? [ this.Intersection_on() ] : [], this.Nonformers(), ... this.show_setup() ? this.sorting() : [], ] @@ -65,16 +65,11 @@ namespace $.$$ { this.Root(), ... this.x_op() ? [ this.X_label() ] : [], ... this.y_op() ? [ this.Y_label() ] : [], - ... this.multi_jsons() ? [ this.Cmp_legend() ] : [], + ... this.plot_raw().jsons().length > 1 ? [ this.Cmp_legend() ] : [], ... this.heatmap() ? [ this.Side_right() ] : [], ] } - @ $mol_mem - json() { - return $mpds_visavis_plot_matrix_json( this.plot_raw().json() as any ) - } - @ $mol_mem sort_dict() { return $mpds_visavis_elements_list.prop_names() @@ -94,14 +89,13 @@ namespace $.$$ { @ $mol_mem cmp_labels() { - return this.multi_jsons() ? this.multi_jsons()!.map( (json: any) => json.answerto ) : [] + const jsons = this.plot_raw().jsons() + return jsons.length > 1 ? jsons.map( json => json.answerto ) : [] } @ $mol_mem json_master() { - if ( ! this.multi_jsons() ) return this.json() - - const jsons: any[] = this.multi_jsons()! + const jsons = this.plot_raw().jsons() const json_master = JSON.parse( JSON.stringify( $mpds_visavis_plot_matrix_json( jsons[0] ) @@ -203,7 +197,7 @@ namespace $.$$ { return 'entries' } - const datesets_quantity = this.multi_jsons()?.length || 1 + const datesets_quantity = this.plot_raw().jsons().length if( datesets_quantity == heatmap_datasets.size && heatmap_datasets.size <= 2 ) { return 'heatmap' } diff --git a/plot/phase/phase.view.ts b/plot/phase/phase.view.ts index 0a0e464..2a10c7b 100644 --- a/plot/phase/phase.view.ts +++ b/plot/phase/phase.view.ts @@ -158,7 +158,7 @@ namespace $.$$ { export class $mpds_visavis_plot_phase extends $.$mpds_visavis_plot_phase { json() { - return $mpds_visavis_plot_phase_rect_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_phase_rect_json( this.plot_raw().jsons()[0] ) } json_title_b() { diff --git a/plot/pie/pie.view.ts b/plot/pie/pie.view.ts index 451fe8e..ce6df7b 100644 --- a/plot/pie/pie.view.ts +++ b/plot/pie/pie.view.ts @@ -38,7 +38,7 @@ namespace $.$$ { export class $mpds_visavis_plot_pie extends $.$mpds_visavis_plot_pie { json() { - return $mpds_visavis_plot_pie_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_pie_json( this.plot_raw().jsons()[0] ) } @ $mol_mem diff --git a/plot/plot.view.css.ts b/plot/plot.view.css.ts index f1c9bb5..5952699 100644 --- a/plot/plot.view.css.ts +++ b/plot/plot.view.css.ts @@ -24,7 +24,32 @@ namespace $.$$ { }, zIndex: 1, cursor: 'default', - } + }, + + Error: { + position: 'absolute', + width: '50%', + height: '50%', + left: '25%', + top: '25%', + + justify: { + content: 'center' + }, + align: { + items: 'center', + }, + + background: { + color: $mol_theme.back, + }, + border: { + radius: $mol_gap.round, + }, + + zIndex: 1, + cursor: 'default', + }, } ) diff --git a/plot/plot.view.tree b/plot/plot.view.tree index f700cf6..a2c3de1 100644 --- a/plot/plot.view.tree +++ b/plot/plot.view.tree @@ -6,10 +6,10 @@ $mpds_visavis_plot $mol_view Locale $mol_locale_select value <= locale \en json_request? null - json null json_cmp_request? null - json_cmp null multi_requests? /string + \https://api.mpds.io/v0/visavis/cube?q=%7B%22elements%22%3A%22Li-O%22%2C%22search_type%22%3A0%7D + \https://api.mpds.io/v0/visavis/cube?q=%7B%22props%22%3A%22crystal%20structure%22%2C%22classes%22%3A%22non-disordered%22%2C%22years%22%3A%222000-2020%22%7D multi_jsons null plot_raw null show_setup false @@ -22,10 +22,11 @@ $mpds_visavis_plot $mol_view Icon <= Expand_icon $mol_icon_arrow_expand_all checked? <=> fullscreen? false <= Plot $mol_view + ^ error_visible / <= Error $mol_view + sub / <= error_message \ plots * matrix <= Matrix $mpds_visavis_plot_matrix plot_raw <= plot_raw - multi_jsons <= multi_jsons show_setup <= show_setup nonformers_checked? <=> nonformers_checked? false fixel_checked? <=> matrix_fixel_checked? true @@ -36,9 +37,8 @@ $mpds_visavis_plot $mol_view matrix_click? <=> matrix_click? null plot3d <= Cube $mpds_visavis_plot_cube 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? @@ -57,7 +57,6 @@ $mpds_visavis_plot $mol_view bar_click? <=> bar_click? null discovery <= Discovery $mpds_visavis_plot_discovery plot_raw <= plot_raw - json_cmp <= json_cmp show_setup <= show_setup elementals_on? => discovery_elementals_on? discovery_click? <=> discovery_click? null diff --git a/plot/plot.view.ts b/plot/plot.view.ts index 4fea72f..2cacceb 100644 --- a/plot/plot.view.ts +++ b/plot/plot.view.ts @@ -14,32 +14,54 @@ namespace $.$$ { return json } + @ $mol_mem + requests() { + if( this.json_cmp_request() ) return [ this.json_request()!, this.json_cmp_request()! ] + if( this.multi_requests().length > 0 ) return this.multi_requests() + return [ this.json_request() ] + } + @ $mol_mem_key json_fetched( request: string ) { return $mpds_visavis_plot.fetch_plot_json( request ) } @ $mol_mem - json() { - return this.json_fetched( this.json_request() ) + jsons_fetched() { + const requests = this.requests() + return requests.map( req => this.json_fetched( req ) ) } + jsons_cached?: any[] | null @ $mol_mem - json_cmp(): any { - return this.multi_jsons()?.[1] ?? null + jsons() { + try { + const jsons = this.jsons_fetched() + this.jsons_cached = jsons + return jsons + + } catch( error ) { + if( !this.$.$mol_promise_like( error ) && this.jsons_cached ) { + console.error( error ) + return this.jsons_cached + } + throw error + } } - @ $mol_mem - multi_requests( next?: string[] ): readonly string[] { - if( next !== undefined ) return next - if( this.json_cmp_request() ) return [ this.json_request()!, this.json_cmp_request()! ] - return super.multi_requests() + error_visible() { + return this.error_message() ? super.error_visible() : [] } - @ $mol_mem - multi_jsons() { - let requests = this.multi_requests() - return requests.length > 0 ? requests.map( req => this.json_fetched( req ) ) : null + error_message(): string { + try { + this.jsons_fetched() + return '' + + } catch( error: any ) { + if( this.$.$mol_promise_like( error ) ) throw error + return error.message || String( error ) + } } @ $mol_mem @@ -53,7 +75,7 @@ namespace $.$$ { @ $mol_mem inconsistent_projection() { const fixels = new Set - this.multi_jsons()?.forEach( json => fixels.add( json.payload?.fixel ) ) + this.jsons().forEach( json => fixels.add( json.payload?.fixel ) ) return fixels.size > 1 } @@ -63,11 +85,7 @@ namespace $.$$ { this.notify( 'Error: inconsistent datasets projection' ) } - return this.multi_jsons() - ? $mpds_visavis_plot_raw_from_json( this.multi_jsons()![0] ) - : this.json() - ? $mpds_visavis_plot_raw_from_json( this.json() ) - : null + return $mpds_visavis_plot_raw_from_jsons( this.jsons() ) } @ $mol_mem diff --git a/plot/raw/raw.ts b/plot/raw/raw.ts index 03903ca..c382837 100644 --- a/plot/raw/raw.ts +++ b/plot/raw/raw.ts @@ -3,14 +3,14 @@ namespace $ { interface Plot_raw { id: string type: 'matrix' | 'plot3d' | 'pd' | 'bar' | 'discovery' | 'eigenplot' | 'pie' | 'scatter' | 'customscatter' | 'heatmap' | 'graph' - json: unknown + jsons: any[] } - export function $mpds_visavis_plot_raw_from_json( json: any, id?: string ){ + export function $mpds_visavis_plot_raw_from_jsons( jsons: any[], id?: string ){ return new $mpds_visavis_plot_raw({ id: id || $mol_guid(), - type: json.use_visavis_type ?? 'unknown', - json, + type: jsons[0].use_visavis_type ?? 'unknown', + jsons, }) } @@ -24,8 +24,8 @@ namespace $ { return this.value('type') } - json() { - return this.value('json') + jsons() { + return this.value('jsons') } } diff --git a/plot/scatter/scatter.view.ts b/plot/scatter/scatter.view.ts index 4edb62d..1a2d660 100644 --- a/plot/scatter/scatter.view.ts +++ b/plot/scatter/scatter.view.ts @@ -46,7 +46,7 @@ namespace $.$$ { json() { // notify('Cannot get plot data, please, try again'); - return $mpds_visavis_plot_scatter_json( this.plot_raw().json() as any ) + return $mpds_visavis_plot_scatter_json( this.plot_raw().jsons()[0] ) } @ $mol_mem From 3045a96667f94d0d14fb42d492e8f38314549fd9 Mon Sep 17 00:00:00 2001 From: stan-donarise Date: Mon, 24 Feb 2025 18:02:15 +0300 Subject: [PATCH 3/4] Update plot.view.tree --- plot/plot.view.tree | 2 -- 1 file changed, 2 deletions(-) diff --git a/plot/plot.view.tree b/plot/plot.view.tree index a2c3de1..04b8bd9 100644 --- a/plot/plot.view.tree +++ b/plot/plot.view.tree @@ -8,8 +8,6 @@ $mpds_visavis_plot $mol_view json_request? null json_cmp_request? null multi_requests? /string - \https://api.mpds.io/v0/visavis/cube?q=%7B%22elements%22%3A%22Li-O%22%2C%22search_type%22%3A0%7D - \https://api.mpds.io/v0/visavis/cube?q=%7B%22props%22%3A%22crystal%20structure%22%2C%22classes%22%3A%22non-disordered%22%2C%22years%22%3A%222000-2020%22%7D multi_jsons null plot_raw null show_setup false From e5fd8d263de81a2f04a0f4957a2870a9f06d2c1d Mon Sep 17 00:00:00 2001 From: stan-donarise Date: Mon, 24 Feb 2025 19:14:00 +0300 Subject: [PATCH 4/4] reset method added --- plot/plot.view.tree | 3 ++- plot/plot.view.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plot/plot.view.tree b/plot/plot.view.tree index 04b8bd9..bffcc8a 100644 --- a/plot/plot.view.tree +++ b/plot/plot.view.tree @@ -13,7 +13,8 @@ $mpds_visavis_plot $mol_view show_setup false notify? null show_demo_warn? false - sub / + reset null + 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 diff --git a/plot/plot.view.ts b/plot/plot.view.ts index 2cacceb..6864f34 100644 --- a/plot/plot.view.ts +++ b/plot/plot.view.ts @@ -155,6 +155,14 @@ namespace $.$$ { alert( msg ) } + @ $mol_action + reset() { + const sub = [ ...this.sub() ] + this.sub( [] ) + + setTimeout( ()=> this.sub( sub ), 0 ) + } + } $mol_view_component( $mpds_visavis_plot )