automatization of svg embedding
added shadows in SVG
This commit is contained in:
parent
20ab0175d3
commit
61f205d6de
1
.gitignore
vendored
1
.gitignore
vendored
@ -183,3 +183,4 @@ local.properties
|
||||
*.js.map
|
||||
/.local/
|
||||
/simulator/www/simulator.css
|
||||
*.svg.ts
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 130 KiB |
@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd src
|
||||
node embed.js
|
||||
../node_modules/typescript/bin/tsc
|
||||
node purify.js
|
||||
|
@ -37,8 +37,12 @@ input[type=number] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
svg g {
|
||||
filter: drop-shadow( 4px 4px 3px rgba(0, 0, 0, .7));
|
||||
}
|
||||
|
||||
.climate-zone:hover {
|
||||
opacity: 0.5 !important;
|
||||
filter: brightness(1.2);
|
||||
}
|
||||
|
||||
svg text {
|
||||
|
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
Normal file
22
simulator/src/embed.js
Normal file
@ -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(/"/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…
Reference in New Issue
Block a user