Skip to content

Commit f8fa428

Browse files
committed
Better support for different point types in the Pointer Visualizer.
1 parent c4e9808 commit f8fa428

21 files changed

Lines changed: 1462 additions & 141 deletions

Source/Assets/TouchScript/Editor/Behaviors/Visualizer/TouchVisualizerEditor.cs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* @author Valentin Simonov / http://va.lent.in/
33
*/
44

@@ -14,26 +14,24 @@ namespace TouchScript.Editor.Behaviors.Visualizer
1414
internal sealed class TouchVisualizerEditor : UnityEditor.Editor
1515
{
1616

17-
public static readonly GUIContent TEXT_SETTINGS_HEADER = new GUIContent("Pointer settings", "General pointersettings.");
1817
public static readonly GUIContent TEXT_DPI_HEADER = new GUIContent("Use DPI", "Scale touch pointer based on DPI.");
1918
public static readonly GUIContent TEXT_ADVANCED_HEADER = new GUIContent("Advanced", "Advanced settings.");
20-
21-
public static readonly GUIContent TEXT_POINTER_ID = new GUIContent("Show Pointer Id", "Display pointer id.");
22-
public static readonly GUIContent TEXT_POINTER_FLAGS = new GUIContent("Show Pointer Flags", "Display pointer flags.");
2319
public static readonly GUIContent TEXT_POINTER_SIZE = new GUIContent("Pointer size (cm)", "Pointer size in cm based on current DPI.");
2420

25-
private SerializedProperty touchProxy, useDPI, touchSize, showTouchId, showFlags;
26-
private SerializedProperty generalProps, advancedProps;
21+
private SerializedProperty mousePointerProxy, touchPointerProxy, penPointerProxy, objectPointerProxy;
22+
private SerializedProperty useDPI, touchSize;
23+
private SerializedProperty advancedProps;
2724

2825
private void OnEnable()
2926
{
30-
showTouchId = serializedObject.FindProperty("showPointerId");
31-
showFlags = serializedObject.FindProperty("showFlags");
32-
touchProxy = serializedObject.FindProperty("pointerProxy");
27+
mousePointerProxy = serializedObject.FindProperty("mousePointerProxy");
28+
touchPointerProxy = serializedObject.FindProperty("touchPointerProxy");
29+
penPointerProxy = serializedObject.FindProperty("penPointerProxy");
30+
objectPointerProxy = serializedObject.FindProperty("objectPointerProxy");
31+
3332
useDPI = serializedObject.FindProperty("useDPI");
3433
touchSize = serializedObject.FindProperty("pointerSize");
3534

36-
generalProps = serializedObject.FindProperty("generalProps");
3735
advancedProps = serializedObject.FindProperty("advancedProps");
3836
}
3937

@@ -43,16 +41,7 @@ public override void OnInspectorGUI()
4341

4442
GUILayout.Space(5);
4543

46-
var display = GUIElements.Header(TEXT_SETTINGS_HEADER, generalProps);
47-
if (display)
48-
{
49-
EditorGUI.indentLevel++;
50-
EditorGUILayout.PropertyField(showTouchId, TEXT_POINTER_ID);
51-
EditorGUILayout.PropertyField(showFlags, TEXT_POINTER_FLAGS);
52-
EditorGUI.indentLevel--;
53-
}
54-
55-
display = GUIElements.Header(TEXT_DPI_HEADER, useDPI, useDPI);
44+
var display = GUIElements.Header(TEXT_DPI_HEADER, useDPI, useDPI);
5645
if (display)
5746
{
5847
EditorGUI.indentLevel++;
@@ -67,8 +56,11 @@ public override void OnInspectorGUI()
6756
if (display)
6857
{
6958
EditorGUI.indentLevel++;
70-
EditorGUILayout.PropertyField(touchProxy, new GUIContent("Pointer Proxy"));
71-
EditorGUI.indentLevel--;
59+
EditorGUILayout.PropertyField(mousePointerProxy, new GUIContent("Mouse Pointer Proxy"));
60+
EditorGUILayout.PropertyField(touchPointerProxy, new GUIContent("Touch Pointer Proxy"));
61+
EditorGUILayout.PropertyField(penPointerProxy, new GUIContent("Pen Pointer Proxy"));
62+
EditorGUILayout.PropertyField(objectPointerProxy, new GUIContent("Object Pointer Proxy"));
63+
EditorGUI.indentLevel--;
7264
}
7365

7466
serializedObject.ApplyModifiedProperties();

Source/Assets/TouchScript/Examples/Cube/Scripts/CustomPointerProxy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace TouchScript.Examples.Cube
88
{
99
public class CustomPointerProxy : Behaviors.Visualizer.PointerProxy
1010
{
11-
protected override void updateOnce(Pointer pointer) {
11+
protected override void updateOnce(IPointer pointer) {
1212
if (pointer.InputSource is RedirectInput) Hide();
1313

1414
base.updateOnce(pointer);

Source/Assets/TouchScript/Prefabs/Pointer Visualizer.prefab

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ MonoBehaviour:
4343
m_Script: {fileID: 11500000, guid: 75324aa372886435faa21a4145210f8e, type: 3}
4444
m_Name:
4545
m_EditorClassIdentifier:
46-
pointerProxy: {fileID: 11468960, guid: 4230502e1973f4c9e9ef6767dcc8c602, type: 2}
47-
showPointerId: 1
48-
showFlags: 1
46+
generalProps: 0
47+
advancedProps: 0
48+
mousePointerProxy: {fileID: 11416202, guid: a71503570adc6194b9bbc69bf19cc2de, type: 2}
49+
touchPointerProxy: {fileID: 11435582, guid: 7fd82b375cf1cdc45b55e2751d814207, type: 2}
50+
penPointerProxy: {fileID: 11486812, guid: 7af150e8b98b05449aaf9462bd6c7109, type: 2}
51+
objectPointerProxy: {fileID: 11468960, guid: 4230502e1973f4c9e9ef6767dcc8c602, type: 2}
4952
useDPI: 1
50-
pointerSize: 1
53+
pointerSize: 3
5154
--- !u!1002 &11400001
5255
EditorExtensionImpl:
5356
serializedVersion: 6
@@ -69,8 +72,10 @@ Canvas:
6972
m_ReceivesEvents: 1
7073
m_OverrideSorting: 0
7174
m_OverridePixelPerfect: 0
75+
m_SortingBucketNormalizedSize: 0
7276
m_SortingLayerID: 0
7377
m_SortingOrder: 9000
78+
m_TargetDisplay: 0
7479
--- !u!224 &22401058
7580
RectTransform:
7681
m_ObjectHideFlags: 1
@@ -80,6 +85,7 @@ RectTransform:
8085
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
8186
m_LocalPosition: {x: 0, y: 0, z: 0}
8287
m_LocalScale: {x: 0, y: 0, z: 0}
88+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
8389
m_Children: []
8490
m_Father: {fileID: 0}
8591
m_RootOrder: 0
@@ -98,8 +104,7 @@ Prefab:
98104
- target: {fileID: 0}
99105
propertyPath: pointerProxy
100106
value:
101-
objectReference: {fileID: 11468960, guid: 4230502e1973f4c9e9ef6767dcc8c602,
102-
type: 2}
107+
objectReference: {fileID: 0}
103108
m_RemovedComponents: []
104109
m_ParentPrefab: {fileID: 0}
105110
m_RootGameObject: {fileID: 100000}

0 commit comments

Comments
 (0)