Commit 5e20eff8 authored by Adrian Wuillemet's avatar Adrian Wuillemet
Browse files

#53 Fix css for svg export

parent 80a8cdd0
......@@ -18,22 +18,27 @@ function download(data, filename, type) {
}
}
function GetGlobalCSSRules() {
//document.styleSheets[0].cssRules[0].cssText
let text = "";
function graphCSSRules() {
let style = "@import url('https://fonts.googleapis.com/css?family=Oswald:200'); * {font-family: 'Oswald', Courier, monospace;} ";
for(let x = 0; x != document.styleSheets.length; x++) {
let sheet : any = document.styleSheets[x];
for(let y = 0; y != sheet.cssRules.length; y++) {
let rule : any = sheet.cssRules[y];
text += rule.cssText;
if(/svg|\.state|\.transition/g.test(rule.selectorText)) {
let css: string = rule.cssText;
let cutoff: string = '#graph-container';
style += css.slice(css.lastIndexOf(cutoff) + cutoff.length);
}
}
}
return text;
return style;
}
function saveSVG() {
let svg : any = document.querySelector("svg").cloneNode(true);
let allstyle = GetGlobalCSSRules();
let styles = graphCSSRules();
let svgcode = `<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
......@@ -63,7 +68,7 @@ function saveSVG() {
inkscape:window-width="2560"
inkscape:window-height="1330"
inkscape:window-maximized="1" />
<style>${allstyle}</style>
<style type="text/css">${styles}</style>
<metadata id="metadata54">
<rdf:RDF>
<cc:Work rdf:about="">
......
......@@ -53,7 +53,6 @@ class ToggleOption extends OPT<boolean>{
}
public getValue(): string {
console.log(this.content.classList.contains('selected'));
return `${this.content.classList.contains('selected')}`;
}
......@@ -63,7 +62,6 @@ class ToggleOption extends OPT<boolean>{
let circle = this.create('div', {'classList': 'button'});
this.content = this.create('button', {'content': [circle, line], 'classList': this.selected ? 'selected' : ''});
this.content.addEventListener('click', () => this.handleClick());
console.log(this.content);
}
private handleClick(): void {
......
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