XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

[Bug] ClearOnFinish="True"/ drawingView.Lines.Clear() not working with latest stable version of DrawingView

Open monicapatawar opened this issue 3 years ago • 5 comments

Description

The ClearOnFinish property when set to "True", should clear the line drawn over the DrawingView after the line is drawn. It seems this is not functioning with the latest stable version of Xamarin.Community.toolkit(2.0.4). The DrawingView should get cleared after releasing the tap/click and a line is drawn. The functionality is working fine with the older version of Xamarin.Community.Toolkit(2.0.0). I am using Xamarin forms version 5.0.0.2291. Also if you try to clear the drawingview lines from the code behind using the DrawingView.Lines.Clear(), it will not work with this version of Xamarin Community Toolkit.

Stack Trace

Link to Reproduction Sample

Steps to Reproduce

  1. Set the ClearOnFinish property to TRUE for the DrawingView in xaml.
  2. Draw a line
  3. The line will be visible even after completion

Expected Behavior

The DrawingView should get cleared after releasing the tap/click and a line is drawn.

Actual Behavior

The DrawingView is not getting cleared after releasing the tap/click and a line is drawn.

Basic Information

  • Version with issue: 2.0.4
  • Last known good version: 2.0.0
  • IDE: Visual Studio
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP:
  • Android Support Library Version:
  • Nuget Packages: Xamarin.Community.Toolkit - 2.0.4
  • Affected Devices:

Workaround

For now, the functionality is working fine with Xamarin.Community.Toolkit version 2.0.0/1.3.2

Reproduction imagery

monicapatawar avatar Jul 29 '22 11:07 monicapatawar

Could you please attach a small sample?

VladislavAntonyuk avatar Jul 31 '22 05:07 VladislavAntonyuk

The issue seems to be happening on Android only, for ios the functionality is working fine.

monicapatawar avatar Aug 24 '22 09:08 monicapatawar

I have noticed this happening when the BackgroundColor is set to Transparent. The lines are not being removed, but they are being drawn over with the BackgroundColor. If it's transparent, nothing draws over them. This is not the case on 2.0.0

aidandobkins avatar Nov 18 '22 19:11 aidandobkins

After implementing a custom renderer, the error seems to be cleared up when readding "PorterDuff.Mode.Clear!" to the drawing of the background to the canvas in LoadLines() in the android renderer.

aidandobkins avatar Nov 22 '22 01:11 aidandobkins

@aidandobkins Could you please share your changes or create a PR?

VladislavAntonyuk avatar Dec 10 '22 06:12 VladislavAntonyuk