Browse Source

automatization of svg embedding

added shadows in SVG
master
Youen Toupin 3 years ago
parent
commit
61f205d6de
  1. 1
      .gitignore
  2. 333
      assets/climate-zones-map.svg
  3. 2
      simulator/build.sh
  4. 6
      simulator/src/app.css
  5. 327
      simulator/src/climate-zones-map.svg
  6. 22
      simulator/src/embed.js

1
.gitignore vendored

@ -183,3 +183,4 @@ local.properties
*.js.map *.js.map
/.local/ /.local/
/simulator/www/simulator.css /simulator/www/simulator.css
*.svg.ts

333
assets/climate-zones-map.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 130 KiB

2
simulator/build.sh

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
cd src cd src
node embed.js
../node_modules/typescript/bin/tsc ../node_modules/typescript/bin/tsc
node purify.js node purify.js

6
simulator/src/app.css

@ -37,8 +37,12 @@ input[type=number] {
cursor: pointer; cursor: pointer;
} }
svg g {
filter: drop-shadow( 4px 4px 3px rgba(0, 0, 0, .7));
}
.climate-zone:hover { .climate-zone:hover {
opacity: 0.5 !important; filter: brightness(1.2);
} }
svg text { svg text {

327
simulator/src/climate-zones-map.svg.ts → simulator/src/climate-zones-map.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 128 KiB

22
simulator/src/embed.js

@ -0,0 +1,22 @@
let fs = require('fs')
function embedSvg(src, dst) {
fs.readFile(src, 'utf8', function(err, data) {
if(err) throw err;
data = data.replace(/<\?xml[^\?]*\?>[\r\n]*/g, '');
data = data.replace(/<svg[^>]*>[\r\n]*/g, '');
data = data.replace(/<\/svg>[\r\n]*/g, '');
data = data.replace(/>\s*<desc[^>]*>/g, ' ');
data = data.replace(/<\/desc>/g, '>');
data = data.replace(/&quot;/g, '"');
data = "(<any>window)['"+src+"'] = `" + data + "`;";
fs.writeFile(dst, data, function(err) {
if(err) throw err;
});
});
}
embedSvg('climate-zones-map.svg', 'climate-zones-map.svg.ts');
Loading…
Cancel
Save