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

feat: compound style, desciption new switch en/fr #386

Open
wants to merge 1 commit into
base: main
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
3 changes: 2 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
"layout": "Layout",
"title": "Settings",
"spacingFactor": "Spacing factor",
"zoomLimits": "Min & max zoom"
"zoomLimits": "Min & max zoom",
"collapse": "Compound nodes collapsed (Right click to open)"
},
"elementData": {
"dictKey": "Key",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
"layout": "Agencement",
"title": "Paramètres",
"spacingFactor": "Espacement",
"zoomLimits": "Zoom min/max"
"zoomLimits": "Zoom min/max",
"collapse": "Nœuds composés réduits (Clic droit up pour l'ouvrir)"
},
"elementData": {
"dictKey": "Clé",
Expand Down
2 changes: 2 additions & 0 deletions src/views/Instance/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const Instance = (props) => {
title: t('commoncomponents.cytoviz.settings.title', 'Settings'),
spacingFactor: t('commoncomponents.cytoviz.settings.spacingFactor', 'Spacing factor'),
zoomLimits: t('commoncomponents.cytoviz.settings.zoomLimits', 'Min & max zoom'),
collapse: t('commoncomponents.cytoviz.settings.collapse', 'Compound nodes collapsed (Right click to open)'),
},
elementData: {
dictKey: t('commoncomponents.cytoviz.elementData.dictKey', 'Key'),
Expand All @@ -118,6 +119,7 @@ const Instance = (props) => {
maxZoom: 1,
useCompactMode: true,
spacingFactor: 1,
collapseAllCompounds: true,
};

let cytoVizPlaceholderMessage = null;
Expand Down
10 changes: 10 additions & 0 deletions src/views/Instance/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
getDefaultSelectedEdgeStyle,
getDefaultSelectedNodeStyle,
getDefaultOutEdgeStyle,
getDefaultCompoundNodeStyle,
getDefaultCollapsedCompoundNodeStyle,
} from './styleCytoViz';
import { ORGANIZATION_ID, WORKSPACE_ID } from '../../config/GlobalConfiguration';
import instanceViewData from '../../config/InstanceVisualization.js';
Expand Down Expand Up @@ -70,6 +72,14 @@ const _processGraphNodes = (processedData, nodesParentsDict, datasetContent, nod
selector: `node.${nodesGroupName}:selected`,
style: { ...getDefaultSelectedNodeStyle(theme), ...nodesGroupMetadata.style },
});
processedData.stylesheet.push({
selector: `node.${nodesGroupName}:parent`,
style: { ...getDefaultCompoundNodeStyle(theme), ...nodesGroupMetadata.style },
});
processedData.stylesheet.push({
selector: `node.cy-expand-collapse-collapsed-node`,
style: { ...getDefaultCollapsedCompoundNodeStyle(theme) },
});
});
};

Expand Down
13 changes: 13 additions & 0 deletions src/views/Instance/styleCytoViz.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const EDGE_DEFAULT_COLOR = '#999999';
const EDGE_SELECTED_COLOR = '#5b5b5b';
const EDGE_SELECTED_WIDTH = 5;
const EDGE_WIDTH = 2;
// Compounds
const COMPOUND_DEFAULT_BORDER_COLOR = '#999999';

// Styles details
export const getDefaultEdgeStyle = (theme) => ({
Expand Down Expand Up @@ -52,3 +54,14 @@ export const getDefaultSelectedNodeStyle = (theme) => ({
height: NODE_SELECTED_ICON_SIZE,
'background-blacken': -NODE_SELECTED_BLACKEN_RATIO,
});

export const getDefaultCompoundNodeStyle = (theme) => ({
'border-style': 'dashed',
'border-color': COMPOUND_DEFAULT_BORDER_COLOR,
'border-width': 3,
});
export const getDefaultCollapsedCompoundNodeStyle = (theme) => ({
...getDefaultCompoundNodeStyle(theme),
shape: 'ellipse',
'border-style': 'solid',
});