Skip to content

Commit

Permalink
Merge pull request #4975 from GordonSmith/HPCC-9966
Browse files Browse the repository at this point in the history
HPCC-9966 Graph control disappears when switching HTML tabs

Reviewed-By: Miguel Vazquez <miguel.vazquez@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
  • Loading branch information
richardkchapman committed Oct 16, 2013
2 parents 427edaa + b8f4b26 commit 0859420
Showing 1 changed file with 32 additions and 34 deletions.
66 changes: 32 additions & 34 deletions esp/files/scripts/GraphWidget.js
Expand Up @@ -491,44 +491,42 @@ require([
},

watchStyleChange: function () {
// When chrome hides the plugin it destroys it. To prevent this it is just made very small.
if (has("chrome")) {
var watchList = [];
var context = this;
var domNode = this.domNode;
// Prevent control from being "hidden" as it gets destroyed on Chrome/FF/(Maybe IE11?)
var watchList = [];
var context = this;
var domNode = this.domNode;

// There are many places that may cause the plugin to be hidden, the possible places are calculated by walking the hierarchy upwards.
while (domNode) {
if (domNode.id) {
watchList[domNode.id] = false;
}
domNode = domNode.parentElement;
// There are many places that may cause the plugin to be hidden, the possible places are calculated by walking the hierarchy upwards.
while (domNode) {
if (domNode.id) {
watchList[domNode.id] = false;
}

// Hijack the dojo style class replacement call and monitor for elements in our watchList.
aspect.around(domClass, "replace", function (origFunc) {
return function (node, addStyle, removeStyle) {
if (node.firstChild && (node.firstChild.id in watchList)) {
if (addStyle == "dijitHidden") {
watchList[node.firstChild.id] = true;
dojo.style(node, "width", "1px");
dojo.style(node, "height", "1px");
dojo.style(node.firstChild, "width", "1px");
dojo.style(node.firstChild, "height", "1px");
return;
} else if (addStyle == "dijitVisible" && watchList[node.firstChild.id] == true) {
watchList[node.firstChild.id] = false;
dojo.style(node, "width", "100%");
dojo.style(node, "height", "100%");
dojo.style(node.firstChild, "width", "100%");
dojo.style(node.firstChild, "height", "100%");
return;
}
domNode = domNode.parentElement;
}

// Hijack the dojo style class replacement call and monitor for elements in our watchList.
aspect.around(domClass, "replace", function (origFunc) {
return function (node, addStyle, removeStyle) {
if (node.firstChild && (node.firstChild.id in watchList)) {
if (addStyle == "dijitHidden") {
watchList[node.firstChild.id] = true;
dojo.style(node, "width", "1px");
dojo.style(node, "height", "1px");
dojo.style(node.firstChild, "width", "1px");
dojo.style(node.firstChild, "height", "1px");
return;
} else if (addStyle == "dijitVisible" && watchList[node.firstChild.id] == true) {
watchList[node.firstChild.id] = false;
dojo.style(node, "width", "100%");
dojo.style(node, "height", "100%");
dojo.style(node.firstChild, "width", "100%");
dojo.style(node.firstChild, "height", "100%");
return;
}
return origFunc(node, addStyle, removeStyle);
}
});
}
return origFunc(node, addStyle, removeStyle);
}
});
},

getDotMetaAttributes: function () {
Expand Down

0 comments on commit 0859420

Please sign in to comment.