Browse Source

Issue #836: set external row title component for 1D viewer

cycle20 1 year ago
parent
commit
115fafe9cd

+ 2 - 2
src/TmFv3DApp/FeatureViewConfig.ts

@@ -76,7 +76,7 @@ export async function createFeatureViewerConfing(params: TmFvConfigParams) {
         } else {
             emptyFvConfigCallbacks(fvConfig);
         }
-        setExternalRowTitleComponent(fvConfig.rowConfig, structureRowClickHandler);
+        setExternalRowTitleComponent(fvConfig.rowConfig);
         setRegionColors(fvConfig.rowConfig);
     }));
 
@@ -153,7 +153,7 @@ function emptyFvConfigCallbacks(fvConfig: FeatureViewInterface<LoadMolstarInterf
 
 }
 
-function setExternalRowTitleComponent(rows: RcsbFvRowConfigInterface[], titleClick: (e: React.MouseEvent) => void) {
+export function setExternalRowTitleComponent(rows: RcsbFvRowConfigInterface[], titleClick: ((e: React.MouseEvent) => void) = (() => {})) {
     rows.forEach(track => {
         if (track.externalRowTitle && (track.externalRowTitle.rowTitleComponent as unknown) == "TmRowTitleComponent") {
             track.externalRowTitle.rowTitleComponent = TmRowTitleComponent;

+ 4 - 1
src/TmFv3DApp/tmdet-viewer/TmFv1DComponent.tsx

@@ -3,7 +3,8 @@ import { Root, createRoot } from 'react-dom/client';
 import { updateSiteColors } from '../tmdet-extension/tmdet-color-theme';
 import { RcsbFv, RcsbFvBoardConfigInterface } from '@rcsb/rcsb-saguaro';
 import { fetchDescriptor } from '../UniTmpHelper';
-import { setRegionColors } from '../FeatureViewConfig';
+import { setExternalRowTitleComponent, setRegionColors } from '../FeatureViewConfig';
+import { TmRowTitleComponent } from './TmRowTitleComponent';
 
 const defaultViewerWidth = 600;
 const defaultRowTitleWidth = 100;
@@ -146,6 +147,8 @@ export async function createRcsbFeatureViewer(params: {
     const rowConfig = blockConfig[0].featureViewConfig[0].rowConfig;
     setRegionColors(rowConfig);
 
+    setExternalRowTitleComponent(rowConfig);
+
     const pfv = new RcsbFv({
         boardConfigData: boardConfig,
         rowConfigData: rowConfig,