From c4493452f9e6258d3e44cf8e76e37e707c5a5eae Mon Sep 17 00:00:00 2001 From: MaxymGorn Date: Sat, 4 Nov 2023 15:02:03 +0200 Subject: [PATCH] fix UI / UI for crop page --- .../Client/Components/Docs/CodeInline.razor | 3 +- .../Client/Pages/Crop/CropPage.razor | 30 +++++++++---------- .../Client/Styles/components/docspage.scss | 4 +++ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/Cropper.Blazor/Client/Components/Docs/CodeInline.razor b/src/Cropper.Blazor/Client/Components/Docs/CodeInline.razor index 6087bb4a..d9bbdd54 100644 --- a/src/Cropper.Blazor/Client/Components/Docs/CodeInline.razor +++ b/src/Cropper.Blazor/Client/Components/Docs/CodeInline.razor @@ -1,4 +1,4 @@ - + @if (Tag) {<}@Code@ChildContent@if (Tag) {>} @@ -7,6 +7,7 @@ [Parameter] public RenderFragment? ChildContent { get; set; } = null; [Parameter] public string? Code { get; set; } = null; + [Parameter] public string Style { get; set; } = string.Empty; [Parameter] public bool SecondaryColor { get; set; } diff --git a/src/Cropper.Blazor/Client/Pages/Crop/CropPage.razor b/src/Cropper.Blazor/Client/Pages/Crop/CropPage.razor index d9fab66b..8f1fa816 100644 --- a/src/Cropper.Blazor/Client/Pages/Crop/CropPage.razor +++ b/src/Cropper.Blazor/Client/Pages/Crop/CropPage.razor @@ -58,31 +58,31 @@ CancellationToken (not required) - used to propagate notifications that the operation should be canceled. -
- This GetCroppedCanvasAsync method returns CroppedCanvas. - Use JSRuntimeObjectRef in the - CroppedCanvas which represents a reference to a JavaScript cropped canvas object. - After then, you can display the canvas as an image directly, or use HTMLCanvasElement.toDataURL to get a Data URL, or use HTMLCanvasElement.toBlob to get a blob and upload it to server with FormData if the browser supports these APIs. -

- In Blazor framework we can invoke JavaScript functions and read a returned value through JSRuntimeExtensions.InvokeAsync. -
- Example invoking function for get a canvas drawn in URL format from the cropped image with reference to a JavaScript cropped canvas object: await croppedCanvas!.JSRuntimeObjectRef.InvokeAsync<string>("toDataURL", "image/png", 1); Note: The aspect ratio of the output canvas will be fitted to the aspect ratio of the crop box automatically. Note: If you intend to get a JPEG image from the output canvas, you should set the fillColor option first, if not, the transparent part in the JPEG image will become black by default. - +
+ This GetCroppedCanvasAsync method returns CroppedCanvas. + Use JSRuntimeObjectRef in the + CroppedCanvas which represents a reference to a JavaScript cropped canvas object. + After then, you can display the canvas as an image directly, or use HTMLCanvasElement.toDataURL to get a Data URL, or use HTMLCanvasElement.toBlob to get a blob and upload it to server with FormData if the browser supports these APIs. +

+ In Blazor framework we can invoke JavaScript functions and read a returned value through JSRuntimeExtensions.InvokeAsync. +
+ Example invoking function for get a canvas drawn in URL format from the cropped image with reference to a JavaScript cropped canvas object: await croppedCanvas!.JSRuntimeObjectRef.InvokeAsync<string>("toDataURL", "image/png", 1); + Note: If you gathering get a Data URL using CroppedCanvas by JSRuntimeObjectRef property. - Don't use HTMLCanvasElement.toDataURL without arguments default method and HTMLCanvasElement.toDataURL(type) method due to image quality was little lost through - default value encoderOptions. + Don't use HTMLCanvasElement.toDataURL without arguments default method and HTMLCanvasElement.toDataURL(type) method due to image quality was little lost through + default value encoderOptions. In addition, different browsers have different image encoder compression, usually it is 92 or 80 percent of the full image quality. - + Note: if you gathering to get a blob using CroppedCanvas by JSRuntimeObjectRef property. - Don't use HTMLCanvasElement.toBlob(callback) and HTMLCanvasElement.toBlob(callback, type) without encoderOptions argument due to image quality was little lost through - default value encoderOptions. + Don't use HTMLCanvasElement.toBlob(callback) and HTMLCanvasElement.toBlob(callback, type) without encoderOptions argument due to image quality was little lost through + default value encoderOptions. In addition, different browsers have different image encoder compression, usually it is 92 or 80 percent of the full image quality. diff --git a/src/Cropper.Blazor/Client/Styles/components/docspage.scss b/src/Cropper.Blazor/Client/Styles/components/docspage.scss index 520a3133..2b43cb98 100644 --- a/src/Cropper.Blazor/Client/Styles/components/docspage.scss +++ b/src/Cropper.Blazor/Client/Styles/components/docspage.scss @@ -88,3 +88,7 @@ } } } + +.text-anywhere-wrap { + overflow-wrap: anywhere; +}