From c35ee074682235a63f7cea9b9304588870c47550 Mon Sep 17 00:00:00 2001 From: Gess1t Date: Thu, 10 Oct 2024 02:28:52 +0200 Subject: [PATCH] Implement 'Clear()' Method in Bindable Profile to reduce bloat in FromSerializable() --- .../Entities/BindableProfile.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Touch-Gestures.Lib/Entities/BindableProfile.cs b/Touch-Gestures.Lib/Entities/BindableProfile.cs index 77dd549..8541c8e 100644 --- a/Touch-Gestures.Lib/Entities/BindableProfile.cs +++ b/Touch-Gestures.Lib/Entities/BindableProfile.cs @@ -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 identifierToPlugin) { FromSerializable(profile, identifierToPlugin, tablet, this); @@ -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) {