mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-24 01:15:25 +01:00
Make SVG icons work
This commit is contained in:
parent
c2ea2006b8
commit
300ed5805b
1 changed files with 9 additions and 2 deletions
|
|
@ -6,12 +6,19 @@ export function roundValueForPresentation(value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function operationIconToActionIcon(icon, appearance) {
|
export function operationIconToActionIcon(icon, appearance) {
|
||||||
|
//console.log(icon);
|
||||||
if (typeof icon === 'string') {
|
if (typeof icon === 'string') {
|
||||||
appearance.icon32 = icon + '32.png';
|
if (icon.startsWith("<svg")){
|
||||||
appearance.icon96 = icon + '96.png';
|
appearance.icon32 = "data:image/svg+xml;base64,"+btoa(icon);
|
||||||
|
appearance.icon96 = "data:image/svg+xml;base64,"+btoa(icon);
|
||||||
|
}else{
|
||||||
|
appearance.icon32 = icon + '32.png';
|
||||||
|
appearance.icon96 = icon + '96.png';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
appearance.icon = resolveIcon(icon);
|
appearance.icon = resolveIcon(icon);
|
||||||
}
|
}
|
||||||
|
console.log(icon, appearance)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveAppearance<R>(op: Operation<R>, params: R) {
|
export function resolveAppearance<R>(op: Operation<R>, params: R) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue