feat: tweak icon position & size (14 => 13.2)

pull/6/head
Amio 2018-07-28 10:30:58 +08:00
rodzic f8de7b8f13
commit ec91efae27
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ module.exports = function ({subject, status, color, style, emoji, icon}) {
color = colorPresets[color] || color || colorPresets['blue'] color = colorPresets[color] || color || colorPresets['blue']
const stTextWidth = calcWidth(status, emoji) const stTextWidth = calcWidth(status, emoji)
const sbRectWidth = calcWidth(subject, emoji) + 10 + (icon ? 17 : 0) const sbRectWidth = calcWidth(subject, emoji) + 10 + (icon ? 15 : 0)
const stRectWidth = stTextWidth + 10 const stRectWidth = stTextWidth + 10
const width = sbRectWidth + stRectWidth const width = sbRectWidth + stRectWidth
@ -20,8 +20,8 @@ module.exports = function ({subject, status, color, style, emoji, icon}) {
<rect x="${sbRectWidth}" width="${stRectWidth}" height="20" fill="#${color}"/> <rect x="${sbRectWidth}" width="${stRectWidth}" height="20" fill="#${color}"/>
</g> </g>
<g fill="#fff" text-anchor="start" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11"> <g fill="#fff" text-anchor="start" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
<text x="${icon ? '23.2' : '6'}" y="14.8" fill="#000" opacity="0.1">${subject}</text> <text x="${icon ? '21.6' : '6'}" y="14.8" fill="#000" opacity="0.1">${subject}</text>
<text x="${icon ? '22.2' : '5'}" y="13.8">${subject}</text> <text x="${icon ? '20.6' : '5'}" y="13.8">${subject}</text>
<text x="${sbRectWidth + 5.5}" y="14.8" fill="#000" opacity="0.1" textLength="${stTextWidth}">${status}</text> <text x="${sbRectWidth + 5.5}" y="14.8" fill="#000" opacity="0.1" textLength="${stTextWidth}">${status}</text>
<text x="${sbRectWidth + 4.5}" y="13.8" textLength="${stTextWidth}">${status}</text> <text x="${sbRectWidth + 4.5}" y="13.8" textLength="${stTextWidth}">${status}</text>
</g>${icon ? genIconMarkup(icon) : ''} </g>${icon ? genIconMarkup(icon) : ''}
@ -42,8 +42,8 @@ module.exports = function ({subject, status, color, style, emoji, icon}) {
<rect width="${width}" height="20" fill="url(#a)"/> <rect width="${width}" height="20" fill="url(#a)"/>
</g> </g>
<g fill="#fff" text-anchor="start" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11"> <g fill="#fff" text-anchor="start" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
<text x="${icon ? '23.4' : '6.2'}" y="14.8" fill="#000" opacity="0.25">${subject}</text> <text x="${icon ? '21.6' : '6'}" y="14.8" fill="#000" opacity="0.25">${subject}</text>
<text x="${icon ? '22.4' : '5.2'}" y="13.8">${subject}</text> <text x="${icon ? '20.6' : '5'}" y="13.8">${subject}</text>
<text x="${sbRectWidth + 5.5}" y="14.8" fill="#000" opacity="0.25" textLength="${stTextWidth}">${status}</text> <text x="${sbRectWidth + 5.5}" y="14.8" fill="#000" opacity="0.25" textLength="${stTextWidth}">${status}</text>
<text x="${sbRectWidth + 4.5}" y="13.8" textLength="${stTextWidth}">${status}</text> <text x="${sbRectWidth + 4.5}" y="13.8" textLength="${stTextWidth}">${status}</text>
</g>${icon ? genIconMarkup(icon) : ''} </g>${icon ? genIconMarkup(icon) : ''}
@ -52,7 +52,7 @@ module.exports = function ({subject, status, color, style, emoji, icon}) {
} }
function genIconMarkup (iconB64) { function genIconMarkup (iconB64) {
return `<image x="4.8" y="3" width="14" height="14" xlink:href="${iconB64}"/>` return `<image x="3.8" y="3.4" width="13.2" height="13.2" xlink:href="${iconB64}"/>`
} }
function typeAssert (assertion, message) { function typeAssert (assertion, message) {