Skip to content

Commit

Permalink
Implement 'Clear()' Method in Bindable Profile to reduce bloat in Fro…
Browse files Browse the repository at this point in the history
…mSerializable()
  • Loading branch information
Mrcubix committed Oct 10, 2024
1 parent 5998a44 commit c35ee07
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Touch-Gestures.Lib/Entities/BindableProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public void Remove(Gesture gesture)
}
}

public void Clear()
{
TapGestures.Clear();
HoldGestures.Clear();
SwipeGestures.Clear();
PanGestures.Clear();
PinchGestures.Clear();
RotateGestures.Clear();
}

public void Update(SerializableProfile profile, SharedTabletReference tablet, Dictionary<int, TypeInfo> identifierToPlugin)
{
FromSerializable(profile, identifierToPlugin, tablet, this);
Expand Down Expand Up @@ -177,14 +187,7 @@ public static BindableProfile FromSerializable(SerializableProfile profile, Dict
result.IsMultiTouch = profile.IsMultiTouch;

if (existingProfile != null)
{
result.TapGestures.Clear();
result.HoldGestures.Clear();
result.SwipeGestures.Clear();
result.PanGestures.Clear();
result.PinchGestures.Clear();
result.RotateGestures.Clear();
}
result.Clear();

foreach (var gesture in profile.TapGestures)
{
Expand Down

0 comments on commit c35ee07

Please sign in to comment.