Skip to content

Commit

Permalink
feat: compound style, desciption new switch en/fr, new setting: colla…
Browse files Browse the repository at this point in the history
…pseAll
  • Loading branch information
Oskar Howe committed Aug 19, 2022
1 parent 845408b commit 9b10ac4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
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',
});

0 comments on commit 9b10ac4

Please sign in to comment.