From 2408881d55d2ec97649a1d08393ef0b92edba0b2 Mon Sep 17 00:00:00 2001 From: okg21 Date: Thu, 20 Jun 2024 12:25:17 +0300 Subject: [PATCH] revert changes to fix Solid color scheme not loading #689 --- app/js/app-cy.js | 9 +-------- app/js/app-utilities.js | 9 ++++++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/js/app-cy.js b/app/js/app-cy.js index 8060c40e..e2b2d35e 100644 --- a/app/js/app-cy.js +++ b/app/js/app-cy.js @@ -1386,14 +1386,7 @@ module.exports = function (chiseInstance) { var opt = {}; keys.forEach(function(key) { - var value = node.data(key); - var isSpecialClass = node.data('class') === 'unspecified entity' || node.data('class') === 'perturbing agent'; - - if (isNaN(value) && key !== 'background-image' && !isSpecialClass) { - opt[key] = undefined; - } else { - opt[key] = value; - } + opt[key] = node.data(key); }); node.style(opt); diff --git a/app/js/app-utilities.js b/app/js/app-utilities.js index 5a7ba734..e863e07d 100644 --- a/app/js/app-utilities.js +++ b/app/js/app-utilities.js @@ -2479,7 +2479,6 @@ appUtilities.getActionsToApplyMapColorScheme = function(newColorScheme, scheme_t }; if(scheme_type == 'solid'){ - var idMap = appUtilities.mapEleClassToId(eles, mapColorSchemes[newColorScheme]['values']); var collapsedChildren = cy.expandCollapse('get').getAllCollapsedChildrenRecursively().filter("node"); var collapsedIdMap = appUtilities.mapEleClassToId(collapsedChildren, mapColorSchemes[newColorScheme]['values']); @@ -2498,6 +2497,14 @@ appUtilities.getActionsToApplyMapColorScheme = function(newColorScheme, scheme_t // edit style of the current map elements, in solid scheme just change background-color actions.push({name: "changeData", param: {eles: eles, name: 'background-color', valueMap: idMap}}); + + // collapsed nodes' style should also be changed, special edge case + actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-color', valueMap: collapsedIdMap}}); + + // if background-image isn't deleted from css, it is shown as soon as the node is expanded until the end of animation + actions.push({name: "changeCss", param: {eles: collapsedChildren, name: 'background-image', valueMap: ""}}); + + actions.push({name: "refreshColorSchemeMenu", param: {value: newColorScheme, self: self, scheme_type: scheme_type}}); // first clear the background images of already present collapsed elements actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-image', valueMap: mapIdToValue(collapsedChildren, '')}});