1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 17:26:02 +08:00

Moved IsMac to NodeEditorUtilities

This commit is contained in:
Thor Brigsted 2019-07-24 10:25:29 +02:00
parent 891ecebc3f
commit bb847a3044
2 changed files with 12 additions and 12 deletions

View File

@ -299,7 +299,7 @@ namespace XNodeEditor {
case EventType.KeyDown:
if (EditorGUIUtility.editingTextField) break;
else if (e.keyCode == KeyCode.F) Home();
if (IsMac()) {
if (NodeEditorUtilities.IsMac()) {
if (e.keyCode == KeyCode.Return) RenameSelectedNode();
} else {
if (e.keyCode == KeyCode.F2) RenameSelectedNode();
@ -310,7 +310,7 @@ namespace XNodeEditor {
if (e.commandName == "SoftDelete") {
if (e.type == EventType.ExecuteCommand) RemoveSelectedNodes();
e.Use();
} else if (IsMac() && e.commandName == "Delete") {
} else if (NodeEditorUtilities.IsMac() && e.commandName == "Delete") {
if (e.type == EventType.ExecuteCommand) RemoveSelectedNodes();
e.Use();
} else if (e.commandName == "Duplicate") {
@ -335,14 +335,6 @@ namespace XNodeEditor {
}
}
public bool IsMac() {
#if UNITY_2017_1_OR_NEWER
return SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX;
#else
return SystemInfo.operatingSystem.StartsWith("Mac");
#endif
}
private void RecalculateDragOffsets(Event current) {
dragOffset = new Vector2[Selection.objects.Length + selectedReroutes.Count];
// Selected nodes

View File

@ -9,7 +9,7 @@ using UnityEngine;
using Object = UnityEngine.Object;
namespace XNodeEditor {
/// <summary> A set of editor-only utilities and extensions for UnityNodeEditorBase </summary>
/// <summary> A set of editor-only utilities and extensions for xNode </summary>
public static class NodeEditorUtilities {
/// <summary>C#'s Script Icon [The one MonoBhevaiour Scripts have].</summary>
@ -84,6 +84,14 @@ namespace XNodeEditor {
return true;
}
public static bool IsMac() {
#if UNITY_2017_1_OR_NEWER
return SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX;
#else
return SystemInfo.operatingSystem.StartsWith("Mac");
#endif
}
/// <summary> Returns true if this can be casted to <see cref="Type"/></summary>
public static bool IsCastableTo(this Type from, Type to) {
if (to.IsAssignableFrom(from)) return true;