From 49c1b9f8b9f3ef3e7a636981b6cfd6c2ff115055 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 30 Mar 2024 14:23:36 +0100 Subject: [PATCH] add eventcallback for imageLoaded --- BlazorSvgEditor.SvgEditor/SvgEditor.Main.cs | 2 ++ BlazorSvgEditor.SvgEditor/SvgEditor.PublicMethods.cs | 1 + BlazorSvgEditor.WasmTest/Pages/Preview.razor.cs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/BlazorSvgEditor.SvgEditor/SvgEditor.Main.cs b/BlazorSvgEditor.SvgEditor/SvgEditor.Main.cs index 503d13c..f866a6b 100644 --- a/BlazorSvgEditor.SvgEditor/SvgEditor.Main.cs +++ b/BlazorSvgEditor.SvgEditor/SvgEditor.Main.cs @@ -47,6 +47,8 @@ public partial class SvgEditor [Parameter] public EventCallback<(Coord translate, double scale)> TranslationChanged { get; set; } private async Task InvokeTranslationChanged() => await TranslationChanged.InvokeAsync((Translate, Scale)); + [Parameter] public EventCallback OnImageLoaded { get; set; } //Event for image loaded + //ReadOnly [Parameter] public bool ReadOnly { get; set; } = false; //Is the editor read only? diff --git a/BlazorSvgEditor.SvgEditor/SvgEditor.PublicMethods.cs b/BlazorSvgEditor.SvgEditor/SvgEditor.PublicMethods.cs index 2948ab3..7f5daf1 100644 --- a/BlazorSvgEditor.SvgEditor/SvgEditor.PublicMethods.cs +++ b/BlazorSvgEditor.SvgEditor/SvgEditor.PublicMethods.cs @@ -148,6 +148,7 @@ public async Task ReloadImage() } _imageSourceLoading = false; + await OnImageLoaded.InvokeAsync(); StateHasChanged(); } diff --git a/BlazorSvgEditor.WasmTest/Pages/Preview.razor.cs b/BlazorSvgEditor.WasmTest/Pages/Preview.razor.cs index cb3754a..02bbd16 100644 --- a/BlazorSvgEditor.WasmTest/Pages/Preview.razor.cs +++ b/BlazorSvgEditor.WasmTest/Pages/Preview.razor.cs @@ -9,7 +9,7 @@ public partial class Preview { private SvgEditor? svgEditor; private int SelectedShapeId { get; set; } - private bool ReadOnly { get; set; } = false; + private bool ReadOnly { get; set; } = true; private List Shapes = new();