Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toggleOnLabelClick does not exist in versions prior to Unity 6 #176

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public AnimationComponentView()
};
root.Add(foldout);
foldout.Add(new VisualElement() { style = { height = 5f } });
var foldoutCheck = foldout.Q("unity-checkmark");
var foldoutCheck = foldout.Q(className: Foldout.checkmarkUssClassName);
icon = new VisualElement
{
style = {
Expand All @@ -74,12 +74,18 @@ public AnimationComponentView()
foldoutCheck.parent.Add(icon);
enabledToggle = new Toggle
{
toggleOnLabelClick = false,
style = {
unityFontStyleAndWeight = FontStyle.Bold,
}
};
enabledToggle.Q("unity-checkmark").style.marginRight = 6f;
enabledToggle.Q(className: Toggle.checkmarkUssClassName).style.marginRight = 6f;
enabledToggle.schedule.Execute(() =>
{
enabledToggle.pickingMode = PickingMode.Ignore;
enabledToggle.Q(className: Toggle.inputUssClassName).pickingMode = PickingMode.Ignore;
enabledToggle.Q(className: Toggle.textUssClassName).pickingMode = PickingMode.Ignore;
enabledToggle.Q(className: Toggle.checkmarkUssClassName).pickingMode = PickingMode.Position;
});
foldoutCheck.parent.Add(enabledToggle);

progressBar = new ProgressBar
Expand All @@ -96,12 +102,12 @@ public AnimationComponentView()
alignSelf = Align.Stretch,
}
};
var background = progressBar.Q(null, "unity-progress-bar__background");
var background = progressBar.Q(className: AbstractProgressBar.backgroundUssClassName);
background.style.borderTopWidth = 0f;
background.style.borderBottomWidth = 0f;
background.style.borderLeftWidth = 0f;
background.style.borderRightWidth = 0f;
var progress = progressBar.Q(null, "unity-progress-bar__progress");
var progress = progressBar.Q(className: AbstractProgressBar.progressUssClassName);
progress.style.backgroundColor = Color.white;
progress.style.minWidth = 0f;
progressBar.schedule.Execute(() => progress.style.display = progressBar.value > progressBar.lowValue ? DisplayStyle.Flex : DisplayStyle.None).Every(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ AnimationComponentView CreateComponentGUI(SerializedProperty property)
view.Icon = (Texture2D)EditorGUIUtility.IconContent("Error").image;
view.EnabledToggle.value = true;
view.SetEnabled(true);
view.EnabledToggle.toggleOnLabelClick = false;
view.EnabledToggle.Q("unity-checkmark").style.visibility = Visibility.Hidden;
view.Add(new HelpBox("The type referenced in SerializeReference is missing. You may have renamed the type or moved it to a different namespace or assembly.", HelpBoxMessageType.Error));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
var foldout = new Foldout()
{
text = property.displayName,
toggleOnLabelClick = true
};

foldout.BindProperty(property);
Expand Down Expand Up @@ -131,7 +130,6 @@ void FoldoutGroup(VisualElement root, string label, SerializedProperty property,
{
text = label,
style = { marginBottom = 3f },
toggleOnLabelClick = true
};
group.BindProperty(property);
configure(group);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
var foldout = new Foldout
{
text = property.displayName,
toggleOnLabelClick = true,
};
foldout.BindProperty(property);

Expand Down