Skip to content

Commit

Permalink
Version 1.0.7 (#18)
Browse files Browse the repository at this point in the history
Check Change logs.
  • Loading branch information
Ddemon26 authored Sep 13, 2024
1 parent 38d9358 commit 16df7a6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [1.0.7] - 2024-09-12
- Added `VisualElement` extensions:
- `RemoveFrom` extension method to remove a child `VisualElement` from a parent.
- `RemoveClass` extension method to remove CSS classes from a `VisualElement`.

## [1.0.6] - 2024-09-08
### Add RichText Extensions
- Added more extensions methods in:
Expand Down
17 changes: 17 additions & 0 deletions UnityUtils/Scripts/Extensions/VisualElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public static T AddTo<T>(this T child, VisualElement parent) where T : VisualEle
parent.Add(child);
return child;
}

/// <remarks>
/// See <see cref="AddTo{T}(T, VisualElement)"/> for adding a child to a parent.
/// </remarks>
public static void RemoveFrom<T>(this T child, VisualElement parent)
where T : VisualElement => parent.Remove(child);

/// <summary>
/// Adds the specified CSS classes to the VisualElement.
Expand All @@ -56,6 +62,17 @@ public static T AddClass<T>(this T visualElement, params string[] classes) where
}
return visualElement;
}

/// <remarks>
/// See <see cref="AddClass{T}(T, string[])"/> for adding classes.
/// </remarks>
public static void RemoveClass<T>(this T visualElement, params string[] classes) where T : VisualElement {
foreach (string cls in classes) {
if (!string.IsNullOrEmpty(cls)) {
visualElement.RemoveFromClassList(cls);
}
}
}

/// <summary>
/// Adds a manipulator to the VisualElement.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.gitamend.unityutils",
"displayName": "Unity Utility Library",
"description": "Unity Utility Library, a growing collection of handy extension methods, helpers, attributes, and other utilities designed to enhance and simplify your Unity development workflow. Whether you're a seasoned developer or just starting, this library aims to provide tools that will help streamline your coding process and add efficiency to your projects.",
"version": "1.0.6",
"version": "1.0.7",
"keywords": [
"extension",
"attribute",
Expand Down

0 comments on commit 16df7a6

Please sign in to comment.