Skip to content

Commit 3602aa3

Browse files
committed
exportToSVG
1 parent 8dda20a commit 3602aa3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/quantum-circuit.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6112,9 +6112,17 @@ QuantumCircuit.prototype.exportBraket = function(comment, decompose, exportAsGat
61126112
}
61136113

61146114
QuantumCircuit.prototype.exportSVG = function(embedded, options) {
6115+
var newOptions = options || {};
6116+
newOptions.embedded = !!embedded;
6117+
6118+
return exportToSVG(newOptions);
6119+
};
6120+
6121+
QuantumCircuit.prototype.exportToSVG = function(options) {
61156122
var self = this;
61166123
var options = options || {};
61176124

6125+
options.embedded = options.embedded || false;
61186126
options.cellWidth = options.cellWidth || 40;
61196127
options.cellHeight = options.cellHeight || 40;
61206128
options.hSpacing = options.hSpacing || 28;
@@ -6652,7 +6660,7 @@ QuantumCircuit.prototype.exportSVG = function(embedded, options) {
66526660
uniq.push(uniqStr);
66536661

66546662
var svg = "";
6655-
if(!embedded) {
6663+
if(!options.embedded) {
66566664
svg += "<?xml version=\"1.0\"?>";
66576665
svg +="<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">";
66586666
}
@@ -6671,7 +6679,7 @@ QuantumCircuit.prototype.exportSVG = function(embedded, options) {
66716679

66726680
// special item: dot
66736681
var svg = "";
6674-
if(!embedded) {
6682+
if(!options.embedded) {
66756683
svg += "<?xml version=\"1.0\"?>";
66766684
svg +="<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">";
66776685
}
@@ -6691,7 +6699,7 @@ QuantumCircuit.prototype.exportSVG = function(embedded, options) {
66916699
if(options.customGateGallery) {
66926700
for(var gateName in this.customGates) {
66936701
var svg = "";
6694-
if(!embedded) {
6702+
if(!options.embedded) {
66956703
svg += "<?xml version=\"1.0\"?>";
66966704
svg +="<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">";
66976705
}
@@ -6705,7 +6713,7 @@ QuantumCircuit.prototype.exportSVG = function(embedded, options) {
67056713
return gateList;
67066714
} else {
67076715
var svg = "";
6708-
if(!embedded) {
6716+
if(!options.embedded) {
67096717
svg += "<?xml version=\"1.0\"?>";
67106718
svg +="<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">";
67116719
}

0 commit comments

Comments
 (0)