From dc205ba6ab2351550730b4b381ca25969de99d14 Mon Sep 17 00:00:00 2001 From: Chenxin Wang Date: Wed, 23 Oct 2024 15:02:04 -0500 Subject: [PATCH] fix design audit --- .../cluster-scatterplot.component.html | 8 +++--- .../cluster-scatterplot.component.scss | 6 ++--- .../cluster-scatterplot.component.ts | 18 ++++++++++++- .../molecule2d/molecule2d.component.scss | 6 ----- .../molli/molecule2d/molecule2d.component.ts | 9 ++++--- .../molli/results/results.component.html | 10 ++++---- .../molli/results/results.component.scss | 7 +++--- .../molli/results/results.component.ts | 25 ++++++++++++++++--- 8 files changed, 60 insertions(+), 29 deletions(-) diff --git a/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.html b/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.html index 68b66cd..345d480 100644 --- a/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.html +++ b/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.html @@ -2,14 +2,16 @@
- + + View All
- + +
{{ cluster.index }}
@@ -56,7 +58,7 @@
- +
diff --git a/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.scss b/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.scss index 34e0213..b8b5d11 100644 --- a/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.scss +++ b/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.scss @@ -86,7 +86,7 @@ svg { .filler { background-color: #f7f8f9; - height: 130px; + height: 120px; .focus_restricted { height: 20px; @@ -102,19 +102,17 @@ svg { .focus_item { width: 408px; - height: 130px; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 6px; .focus_content { - padding: 6px 12px 0 12px; + padding: 12px; } .focus_point_container { width: 247px; - height: 79px; } .foucs_info_item { diff --git a/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.ts b/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.ts index 8e2b093..35d7e66 100644 --- a/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.ts +++ b/src/app/components/molli/cluster-scatterplot/cluster-scatterplot.component.ts @@ -30,16 +30,21 @@ export class ClusterScatterplotComponent implements OnChanges { mode: 'tsne'|'pca'; highlightedClusterIndex: number|null = null; + @Input() highlightedPointName: string|null = null; @Output() highlightedPointNameChange = new EventEmitter(); + // check if the point/examplar is restricted to select/unselect by additional filters @Input() checkRestrict: (name: string) => Boolean; + @Input() handleScroll: (name: string, navigate?: boolean) => void; + lastClickedPointName: string|null = null; + viewBox = { height: 400, width: 400 @@ -187,7 +192,7 @@ export class ClusterScatterplotComponent implements OnChanges { toggleAllCluster() { this.allClusterSelected = this.allClusterSelected == 1 ? 0 : 1; this.clusters.forEach(cluster => cluster.isSelected = this.allClusterSelected); - this.points.forEach(point => point.isSelected = !!this.allClusterSelected); + this.points.forEach(point => point.isSelected = !!this.allClusterSelected); this.onPointsChange(); } @@ -210,6 +215,17 @@ export class ClusterScatterplotComponent implements OnChanges { if (this.checkRestrict(point.name)) { return; } + + // if it's the first time the point is clicked, just scoll to it + if (point.isSelected && this.lastClickedPointName != point.name) { + this.lastClickedPointName = point.name; + setTimeout(() => { + this.handleScroll(point.name, true); + }); + return + } + + // not the first time, toggle point point.isSelected = !point.isSelected; if (point.cluster.isSelected == 2) { const selectedPointsCntInCluster = this.getSelectedPointsCntInCluster(point.cluster); diff --git a/src/app/components/molli/molecule2d/molecule2d.component.scss b/src/app/components/molli/molecule2d/molecule2d.component.scss index 9d18b4e..e69de29 100644 --- a/src/app/components/molli/molecule2d/molecule2d.component.scss +++ b/src/app/components/molli/molecule2d/molecule2d.component.scss @@ -1,6 +0,0 @@ -.svg_container { - ::ng-deep svg { - display: block; - margin: auto; - } -} diff --git a/src/app/components/molli/molecule2d/molecule2d.component.ts b/src/app/components/molli/molecule2d/molecule2d.component.ts index 6813b45..a1961a1 100644 --- a/src/app/components/molli/molecule2d/molecule2d.component.ts +++ b/src/app/components/molli/molecule2d/molecule2d.component.ts @@ -23,15 +23,18 @@ export class Molecule2dComponent implements OnChanges { ngOnChanges(changes: SimpleChanges) { let workingSvg = this.svg; - if (this.height !== null) { + if (this.height != null) { // replacing just the first instance of height, and for now we assume all heights are originally 200px // TODO improve this logic workingSvg = workingSvg.replace('height="200px"', 'height="' + this.height + 'px"'); + if (this.height < 200) { + workingSvg = workingSvg.replace('viewBox="0 0 100 100"', 'viewBox="0 25 100 50"') + } } - if (this.width !== null) { + if (this.width != null) { // replacing just the first instance of width, and for now we assume all widths are originally 200px // TODO improve this logic - workingSvg = workingSvg.replace('width="200px"', 'width="' + this.height + 'px"'); + workingSvg = workingSvg.replace('width="200px"', 'width="' + this.width + 'px"'); } this.scaledSvg = this.sanitizer.bypassSecurityTrustHtml(workingSvg); } diff --git a/src/app/components/molli/results/results.component.html b/src/app/components/molli/results/results.component.html index fb8bb52..89035c1 100644 --- a/src/app/components/molli/results/results.component.html +++ b/src/app/components/molli/results/results.component.html @@ -56,16 +56,16 @@

Data clustering

Molecules

Cores:

-

Substituents:

-

Other filters:

- +
@@ -76,7 +76,7 @@

Other filters:

@@ -131,7 +131,7 @@

Other filters:

{{row.cluster}} {{row.name}} -
+
{{row.core}}
{{subst.label}} ({{subst.count}})
diff --git a/src/app/components/molli/results/results.component.scss b/src/app/components/molli/results/results.component.scss index e88bb9a..82f0f81 100644 --- a/src/app/components/molli/results/results.component.scss +++ b/src/app/components/molli/results/results.component.scss @@ -261,10 +261,11 @@ tr.highlighted { } td { - vertical-align: middle; - padding: 7px 16px !important; + vertical-align: top; + padding: 5px !important; - &.structure_2d { + .structure_2d { + margin-top: 6px; &:hover { cursor: pointer; diff --git a/src/app/components/molli/results/results.component.ts b/src/app/components/molli/results/results.component.ts index 0854722..6e2f500 100644 --- a/src/app/components/molli/results/results.component.ts +++ b/src/app/components/molli/results/results.component.ts @@ -33,6 +33,8 @@ export class ResultsComponent { allRows: GeneratedStructureViewModel[] = []; filteredRows: GeneratedStructureViewModel[] = []; + // number showed on filter button + filterLenth: number = 0; clusteringMethodOptions = [ { name: 't-SNE(Default)', key: 'tsne' }, @@ -229,7 +231,7 @@ export class ResultsComponent { this.selectedCores = []; this.selectedSubstituents = []; this.isShowSavedMoleculesOnly = false; - this.filterTable(); + this.filterTable(true); } resetTable() { @@ -237,7 +239,7 @@ export class ResultsComponent { this.selectedSubstituents = []; this.isShowSavedMoleculesOnly = false; this.selectedPoints = this.allRows.map(row => row.name); - this.filterTable(); + this.filterTable(true); } applyAdditionalFilters(row: GeneratedStructureViewModel) { @@ -253,8 +255,23 @@ export class ResultsComponent { return coreLookup.has(row.core) && row.substituents.some(subst => substituentLookup.has(subst.label)) && saveMoleculesLookup(row); } - filterTable() { - this.filteredRows = this.allRows.filter(row => this.selectedPoints.includes(row.name) && this.applyAdditionalFilters(row)); + filterTable(isApplyAdditionalFilters = false) { + let additionalFilterResultLen = 0; + this.filteredRows = this.allRows.filter(row => { + if (this.applyAdditionalFilters(row)) { + if (this.selectedCores.length || this.selectedSubstituents.length) { + additionalFilterResultLen++; + } + if (this.selectedPoints.includes(row.name)) { + return true; + } + } + return false; + }) + this.filterLenth = Math.min(additionalFilterResultLen, this.filteredRows.length); + if (isApplyAdditionalFilters) { + this.table.first = 0; + } } isPointRestrictedByFilters(pointName: string) {