-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to load SVG file if IconSpec created using IconSpecUtilities.createWebComponentIconSpec #421
Comments
Hi, I emailed to let you know that I can't reproduce this problem in our test app and asking for a link to the code that exhibits the problem. Can you help? |
Sent the email with the files that reproduce the issue. |
@raplemie any updates on this? |
Nope, sadly investigation will need to be picked up by someone else. |
From the description given in #521, the svg you are using are not loaded with svg-loader, which is what this method is describing to support: https://github.com/iTwin/itwinjs-core/blob/21becd3c475d9fa7ff208aec36fc373b2018d015/ui/appui-abstract/src/appui-abstract/utils/IconSpecUtilities.ts#L24-L29 |
Apparently, the expected input is a string, which is not what function toDataBase64(dataRaw: string) {
const dataParts = dataRaw.split(",");
const b64 = btoa(dataParts[1]);
return `${dataParts[0]};base64,${b64}`;
} I'll look to incorporate this variant of the data url support if we can validate that this is indeed the issue you are having. |
Hi @ShoaibEhsan1, @kckst8, a fix for this have been released in 4.6.2, |
Describe the bug
Unable to load svg icon from the file using the IconSpecUtilities.createWebComponentIconSpec and ToolbarItemUtilities.createActionItem
To Reproduce
Steps to reproduce the behavior:
export class ExportTextTool extends Tool {
public static override iconSpec = IconSpecUtilities.createWebComponentIconSpec(Exportsvg);
public static override toolId = "ExportTextTool";
// public static override iconSpec = "icon-info";
public static override namespace = "MyExportTextToolNamespace";
public override async run(): Promise {
const imodel = UiFramework.getIModelConnection();
if (!imodel) throw Error("export button loaded but no iModel connection found!");
UiFramework.dialogs.modal.open();
return super.run();
}
}
3. Create a ToolbarItem as
const toolbarItem = ToolbarItemUtilities.createActionItem(
ExportTextTool.toolId,
0,
ExportTextTool.iconSpec,
ExportTextTool.description,
async () => {
await IModelApp.tools.run(ExportTextTool.toolId);
}
);
5. The new tool is loaded in the viewer but instead of icon, some weird text appears (see )
6. The weird text can be different for different svg
Expected behavior
Image in the SVG should be shown
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the applicable information):
The text was updated successfully, but these errors were encountered: