Commit da13d53a by gutkaBinit Committed by nixonrodrigues

ATLAS-3213 UI : Png export not working in Safari Browser.

parent 37b489ff
...@@ -603,10 +603,13 @@ define(['require', ...@@ -603,10 +603,13 @@ define(['require',
} }
}); });
} }
getImageData({ if (_.keys(imageObject).indexOf(imageIconPath) === -1) {
"imagePath": imagePath, getImageData({
"imageIconPath": imageIconPath "imagePath": imagePath,
}); "imageIconPath": imageIconPath
});
}
if (_.isUndefined(imageObject[imageIconPath])) { if (_.isUndefined(imageObject[imageIconPath])) {
// before img success // before img success
imageObject[imageIconPath] = [d3.select(that)]; imageObject[imageIconPath] = [d3.select(that)];
...@@ -755,6 +758,7 @@ define(['require', ...@@ -755,6 +758,7 @@ define(['require',
return; return;
} }
that.$('svg').removeClass('hover'); that.$('svg').removeClass('hover');
that.$('svg').removeClass('hover-active');
LineageUtils.onHoverFade({ LineageUtils.onHoverFade({
opacity: 1, opacity: 1,
selectedNode: d, selectedNode: d,
...@@ -825,39 +829,17 @@ define(['require', ...@@ -825,39 +829,17 @@ define(['require',
} }
}).init(); }).init();
zoom.event(svg); zoom.event(svg);
// console.log(this.$('svg')[0].getBBox())
//svg.attr('height', this.g.graph().height * initialScale + 40);
if (platform.name === "IE") { if (platform.name === "IE") {
LineageUtils.refreshGraphForIE({ LineageUtils.refreshGraphForIE({
edgeEl: this.$('svg .edgePath') edgeEl: this.$('svg .edgePath')
}); });
// this.$('svg .edgePath').each(function(argument) {
// var childNode = $(this).find('marker');
// console.log(childNode);
// $(this).find('marker').remove();
// var eleRef = this;
// ++that.IEGraphRenderDone;
// setTimeout(function(argument) {
// $(eleRef).find('defs').append(childNode);
// --that.IEGraphRenderDone;
// if (that.IEGraphRenderDone === 0) {
// this.$('.fontLoader').hide();
// this.$('svg').fadeTo(1000, 1)
// }
// }, 1000);
// });
} }
// console.log(platform.name)
// if (platform.name !== "IE") {
LineageUtils.DragNode({ LineageUtils.DragNode({
svg: this.svg, svg: this.svg,
g: this.g, g: this.g,
guid: this.guid, guid: this.guid,
edgeEl: this.$('svg .edgePath') edgeEl: this.$('svg .edgePath')
}).init(); }).init();
// }
}, },
renderLineageTypeSearch: function() { renderLineageTypeSearch: function() {
var that = this, var that = this,
...@@ -987,7 +969,7 @@ define(['require', ...@@ -987,7 +969,7 @@ define(['require',
scaleFactor = 1, scaleFactor = 1,
svgWidth = that.$('svg').width(), svgWidth = that.$('svg').width(),
svgHeight = that.$('svg').height(); svgHeight = that.$('svg').height();
if (platform.name != "Chrome") { if (platform.name === "Firefox") {
svgClone.setAttribute('width', svgWidth); svgClone.setAttribute('width', svgWidth);
svgClone.setAttribute('height', svgHeight); svgClone.setAttribute('height', svgHeight);
} }
...@@ -1020,6 +1002,9 @@ define(['require', ...@@ -1020,6 +1002,9 @@ define(['require',
var img = new Image(canvas.width, canvas.height); var img = new Image(canvas.width, canvas.height);
var svgBlob = new Blob([data], { type: 'image/svg+xml;base64' }); var svgBlob = new Blob([data], { type: 'image/svg+xml;base64' });
if (platform.name === "Safari") {
svgBlob = new Blob([data], { type: 'image/svg+xml' });
}
var url = DOMURL.createObjectURL(svgBlob); var url = DOMURL.createObjectURL(svgBlob);
img.onload = function() { img.onload = function() {
...@@ -1045,6 +1030,11 @@ define(['require', ...@@ -1045,6 +1030,11 @@ define(['require',
} }
a.click(); a.click();
that.toggleLoader(loaderTargetDiv); that.toggleLoader(loaderTargetDiv);
if (platform.name === 'Safari') {
LineageUtils.refreshGraphForSafari({
edgeEl: that.$('svg g.node')
});
}
}, 'image/png'); }, 'image/png');
$('.hidden-svg').html(''); $('.hidden-svg').html('');
createCanvas.remove(); createCanvas.remove();
......
...@@ -63,7 +63,6 @@ define(['require', ''], function(require) { ...@@ -63,7 +63,6 @@ define(['require', ''], function(require) {
nodeDrag.call(svg.selectAll("g.node")); nodeDrag.call(svg.selectAll("g.node"));
edgeDrag.call(svg.selectAll("g.edgePath")); edgeDrag.call(svg.selectAll("g.edgePath"));
// this.refreshGraphForIE();
}, },
dragstart: function(d) { dragstart: function(d) {
d3.event.sourceEvent.stopPropagation(); d3.event.sourceEvent.stopPropagation();
...@@ -159,9 +158,18 @@ define(['require', ''], function(require) { ...@@ -159,9 +158,18 @@ define(['require', ''], function(require) {
}, },
} }
} }
LinegaeUtils.refreshGraphForSafari = function(options) {
var edgePathEl = options.edgeEl,
IEGraphRenderDone = 0;
edgePathEl.each(function(argument) {
var eleRef = this,
childNode = $(this).find('pattern');
setTimeout(function(argument) {
$(eleRef).find('defs').append(childNode);
}, 500);
});
}
LinegaeUtils.refreshGraphForIE = function(options) { LinegaeUtils.refreshGraphForIE = function(options) {
var edgePathEl = options.edgeEl, var edgePathEl = options.edgeEl,
IEGraphRenderDone = 0; IEGraphRenderDone = 0;
edgePathEl.each(function(argument) { edgePathEl.each(function(argument) {
......
...@@ -318,7 +318,7 @@ define(['require', ...@@ -318,7 +318,7 @@ define(['require',
var that = this, var that = this,
notifyObj = { notifyObj = {
modal: true, modal: true,
text: "It looks like you have been edited something. If you leave before saving, your changes will be lost.", text: "It looks like you have edited something. If you leave before saving, your changes will be lost.",
ok: function(argument) { ok: function(argument) {
that.viewType = that.ui.editPropagationType.is(":checked") ? "flow" : "table"; that.viewType = that.ui.editPropagationType.is(":checked") ? "flow" : "table";
that.ui.editPropagationType.prop("checked", that.viewType === "flow" ? false : true).trigger("change"); that.ui.editPropagationType.prop("checked", that.viewType === "flow" ? false : true).trigger("change");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment