mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
Fixed UiControls allowing for non-selectable or non-mouseable elements to be marked as selected or moused
This commit is contained in:
parent
cd32372994
commit
2c90ca9b89
2 changed files with 11 additions and 2 deletions
|
@ -54,6 +54,7 @@ Fixes
|
||||||
- Fixed paragraph links having incorrect hover locations when using special text alignments
|
- Fixed paragraph links having incorrect hover locations when using special text alignments
|
||||||
- Fixed the graphics device's viewport being ignored for mouse and touch queries
|
- Fixed the graphics device's viewport being ignored for mouse and touch queries
|
||||||
- Fixed auto-navigating panels not scrolling to the center of elements properly
|
- Fixed auto-navigating panels not scrolling to the center of elements properly
|
||||||
|
- Fixed UiControls allowing for non-selectable or non-mouseable elements to be marked as selected or moused
|
||||||
|
|
||||||
Removals
|
Removals
|
||||||
- Marked StyleProp equality members as obsolete
|
- Marked StyleProp equality members as obsolete
|
||||||
|
|
|
@ -259,7 +259,9 @@ namespace MLEM.Ui {
|
||||||
/// <param name="element">The element to select, or null to deselect the selected element.</param>
|
/// <param name="element">The element to select, or null to deselect the selected element.</param>
|
||||||
/// <param name="autoNav">Whether automatic navigation should be forced on</param>
|
/// <param name="autoNav">Whether automatic navigation should be forced on</param>
|
||||||
public void SelectElement(RootElement root, Element element, bool? autoNav = null) {
|
public void SelectElement(RootElement root, Element element, bool? autoNav = null) {
|
||||||
if (root == null)
|
if (root == null || !root.CanSelectContent)
|
||||||
|
return;
|
||||||
|
if (element != null && !element.CanBeSelected)
|
||||||
return;
|
return;
|
||||||
var selected = this.GetSelectedElement(root);
|
var selected = this.GetSelectedElement(root);
|
||||||
if (selected == element)
|
if (selected == element)
|
||||||
|
@ -284,6 +286,8 @@ namespace MLEM.Ui {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="element">The element to set as moused</param>
|
/// <param name="element">The element to set as moused</param>
|
||||||
public void SetMousedElement(Element element) {
|
public void SetMousedElement(Element element) {
|
||||||
|
if (element != null && !element.CanBeMoused)
|
||||||
|
return;
|
||||||
if (element != this.MousedElement) {
|
if (element != this.MousedElement) {
|
||||||
if (this.MousedElement != null)
|
if (this.MousedElement != null)
|
||||||
this.System.InvokeOnElementMouseExit(this.MousedElement);
|
this.System.InvokeOnElementMouseExit(this.MousedElement);
|
||||||
|
@ -299,6 +303,8 @@ namespace MLEM.Ui {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="element">The element to set as touched</param>
|
/// <param name="element">The element to set as touched</param>
|
||||||
public void SetTouchedElement(Element element) {
|
public void SetTouchedElement(Element element) {
|
||||||
|
if (element != null && !element.CanBeMoused)
|
||||||
|
return;
|
||||||
if (element != this.TouchedElement) {
|
if (element != this.TouchedElement) {
|
||||||
if (this.TouchedElement != null)
|
if (this.TouchedElement != null)
|
||||||
this.System.InvokeOnElementTouchExit(this.TouchedElement);
|
this.System.InvokeOnElementTouchExit(this.TouchedElement);
|
||||||
|
@ -316,9 +322,11 @@ namespace MLEM.Ui {
|
||||||
/// <param name="root">The root element whose selected element to return</param>
|
/// <param name="root">The root element whose selected element to return</param>
|
||||||
/// <returns>The given root's selected element, or null if the root doesn't exist, or if there is no selected element for that root.</returns>
|
/// <returns>The given root's selected element, or null if the root doesn't exist, or if there is no selected element for that root.</returns>
|
||||||
public Element GetSelectedElement(RootElement root) {
|
public Element GetSelectedElement(RootElement root) {
|
||||||
if (root == null)
|
if (root == null || !root.CanSelectContent)
|
||||||
return null;
|
return null;
|
||||||
this.selectedElements.TryGetValue(root.Name, out var element);
|
this.selectedElements.TryGetValue(root.Name, out var element);
|
||||||
|
if (element != null && !element.CanBeSelected)
|
||||||
|
return null;
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue