Skip to content

Commit 9cdd447

Browse files
committed
Fixed the bug for spinner not stopping #709
2 parents 031a887 + c43812e commit 9cdd447

File tree

5 files changed

+106
-211
lines changed

5 files changed

+106
-211
lines changed

app/js/app-cy.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -461,30 +461,25 @@ module.exports = function (chiseInstance) {
461461
cy.viewUtilities({
462462
highlightStyles: [
463463
{
464-
node: { 'border-width': function (ele) { return Math.max(parseFloat(ele.data('border-width')) + 2, 3); }, 'border-color': '#0B9BCD' },
465-
edge: {
466-
'width': function (ele) { return Math.max(parseFloat(ele.data('width')) + 2, 3); },
467-
'line-color': '#0B9BCD',
468-
'color': '#0B9BCD',
469-
'text-border-color': '#0B9BCD',
470-
'source-arrow-color': '#0B9BCD',
471-
'target-arrow-color': '#0B9BCD'
472-
}
464+
node: { 'overlay-color': '#0B9BCD', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
465+
edge: { 'overlay-color': '#0B9BCD', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
466+
},
467+
{
468+
node: { 'overlay-color': '#bf0603', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
469+
edge: { 'overlay-color': '#bf0603', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
470+
},
471+
{
472+
node: { 'overlay-color': '#d67614', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
473+
edge: { 'overlay-color': '#d67614', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
474+
},
475+
{
476+
node: { 'overlay-color': '#04F06A', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
477+
edge: { 'overlay-color': '#04F06A', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
473478
},
474-
{ node: { 'border-color': '#bf0603', 'border-width': 3 }, edge: {'line-color': '#bf0603', 'source-arrow-color': '#bf0603', 'target-arrow-color': '#bf0603', 'width' : 3} },
475-
{ node: { 'border-color': '#d67614', 'border-width': 3 }, edge: {'line-color': '#d67614', 'source-arrow-color': '#d67614', 'target-arrow-color': '#d67614', 'width' : 3} },
476479
],
477480
selectStyles: {
478-
node: {
479-
'border-color': '#d67614', 'background-color': function (ele) { return ele.data('background-color'); }
480-
},
481-
edge: {
482-
'line-color': '#d67614',
483-
'color': '#d67614',
484-
'text-border-color': '#d67614',
485-
'source-arrow-color': '#d67614',
486-
'target-arrow-color': '#d67614',
487-
}
481+
node: { 'overlay-color': '#89898a', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
482+
edge: { 'overlay-color': '#89898a', 'overlay-opacity': 0.2, 'overlay-padding': 5 },
488483
},
489484
neighbor: function(ele){ //select and return process-based neighbors
490485
if (ele.isNode()) {
@@ -1390,8 +1385,15 @@ module.exports = function (chiseInstance) {
13901385
'background-position-x', 'background-position-y', 'background-height', 'background-width'];
13911386

13921387
var opt = {};
1393-
keys.forEach(function(key){
1394-
opt[key] = node.data(key);
1388+
keys.forEach(function(key) {
1389+
var value = node.data(key);
1390+
var isSpecialClass = node.data('class') === 'unspecified entity' || node.data('class') === 'perturbing agent';
1391+
1392+
if (isNaN(value) && key !== 'background-image' && !isSpecialClass) {
1393+
opt[key] = undefined;
1394+
} else {
1395+
opt[key] = value;
1396+
}
13951397
});
13961398

13971399
node.style(opt);
@@ -1435,4 +1437,4 @@ module.exports = function (chiseInstance) {
14351437
}
14361438
}
14371439
}
1438-
};
1440+
};

app/js/app-undo-actions-factory.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -361,18 +361,11 @@ module.exports = function (cy) {
361361
var highlightColor = $('#highlight-color').val();
362362
var extraHighlightThickness = Number($('#highlight-thickness').val());
363363

364-
viewUtilities.changeHighlightStyle(0, {
365-
'border-width' : function (ele) {
366-
return Math.max(parseFloat(ele.data('border-width')) + extraHighlightThickness, 3);
367-
}, 'border-color': highlightColor
368-
}, {
369-
'width': function (ele) { return Math.max(parseFloat(ele.data('width')) + extraHighlightThickness, 3); },
370-
'line-color': highlightColor,
371-
'color': highlightColor,
372-
'text-border-color': highlightColor,
373-
'source-arrow-color': highlightColor,
374-
'target-arrow-color': highlightColor
375-
});
364+
viewUtilities.changeHighlightStyle(
365+
0,
366+
{ 'overlay-color': highlightColor, 'overlay-opacity': 0.2, 'overlay-padding': 3+extraHighlightThickness },
367+
{ 'overlay-color': highlightColor, 'overlay-opacity': 0.2, 'overlay-padding': 3+extraHighlightThickness/2.0}
368+
);
376369
}
377370

378371
return result;

app/js/app-utilities.js

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,20 +2489,24 @@ appUtilities.getActionsToApplyMapColorScheme = function(newColorScheme, scheme_t
24892489

24902490
// first clear the background images of already present elements
24912491
actions.push({name: "changeData", param: {eles: eles, name: 'background-image', valueMap: mapIdToValue(eles, '')}});
2492+
actions.push({name: "changeData", param: {eles: eles, name: 'background-fit', valueMap: mapIdToValue(eles, '')}});
2493+
actions.push({name: "changeData", param: {eles: eles, name: 'background-position-x', valueMap: mapIdToValue(eles, '')}});
2494+
actions.push({name: "changeData", param: {eles: eles, name: 'background-position-y', valueMap: mapIdToValue(eles, '')}});
2495+
actions.push({name: "changeData", param: {eles: eles, name: 'background-width', valueMap: mapIdToValue(eles, '')}});
2496+
actions.push({name: "changeData", param: {eles: eles, name: 'background-height', valueMap: mapIdToValue(eles, '')}});
2497+
actions.push({name: "changeData", param: {eles: eles, name: 'background-image-opacity', valueMap: mapIdToValue(eles, '')}});
24922498

24932499
// edit style of the current map elements, in solid scheme just change background-color
24942500
actions.push({name: "changeData", param: {eles: eles, name: 'background-color', valueMap: idMap}});
24952501

24962502
// first clear the background images of already present collapsed elements
24972503
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-image', valueMap: mapIdToValue(collapsedChildren, '')}});
2498-
2499-
// collapsed nodes' style should also be changed, special edge case
2500-
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-color', valueMap: collapsedIdMap}});
2501-
2502-
// if background-image isn't deleted from css, it is shown as soon as the node is expanded until the end of animation
2503-
actions.push({name: "changeCss", param: {eles: collapsedChildren, name: 'background-image', valueMap: ""}});
2504-
2505-
actions.push({name: "refreshColorSchemeMenu", param: {value: newColorScheme, self: self, scheme_type: scheme_type}});
2504+
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-fit', valueMap: mapIdToValue(collapsedChildren, '')}});
2505+
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-position-x', valueMap: mapIdToValue(collapsedChildren, '')}});
2506+
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-position-y', valueMap: mapIdToValue(collapsedChildren, '')}});
2507+
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-width', valueMap: mapIdToValue(collapsedChildren, '')}});
2508+
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-height', valueMap: mapIdToValue(collapsedChildren, '')}});
2509+
actions.push({name: "changeDataDirty", param: {eles: collapsedChildren, name: 'background-image-opacity', valueMap: mapIdToValue(collapsedChildren, '')}});
25062510

25072511
// set to be the default as well
25082512
for(var nodeClass in mapColorSchemes[newColorScheme]['values']){
@@ -2947,18 +2951,11 @@ appUtilities.setMapProperties = function(mapProperties, _chiseInstance) {
29472951
var highlightColor = currentGeneralProperties.highlightColor[0];
29482952
var extraHighlightThickness = currentGeneralProperties.extraHighlightThickness;
29492953

2950-
viewUtilities.changeHighlightStyle(0, {
2951-
'border-width': function (ele) {
2952-
return Math.max(parseFloat(ele.data('border-width')) + extraHighlightThickness, 3);
2953-
}, 'border-color': highlightColor
2954-
}, {
2955-
'width': function (ele) { return Math.max(parseFloat(ele.data('width')) + extraHighlightThickness, 3); },
2956-
'line-color': highlightColor,
2957-
'color': highlightColor,
2958-
'text-border-color': highlightColor,
2959-
'source-arrow-color': highlightColor,
2960-
'target-arrow-color': highlightColor
2961-
});
2954+
viewUtilities.changeHighlightStyle(
2955+
0,
2956+
{ 'overlay-color': highlightColor, 'overlay-opacity': 0.2, 'overlay-padding': 3+extraHighlightThickness },
2957+
{ 'overlay-color': highlightColor, 'overlay-opacity': 0.2, 'overlay-padding': 3+extraHighlightThickness/2.0}
2958+
);
29622959
}
29632960

29642961

0 commit comments

Comments
 (0)