Skip to content

Commit 9aabbda

Browse files
Makes non native keyboard touch enabled (#655)
* Makes non native keyboard touch enabled, as described in https://localjoost.github.io/Using-the-non-native-keyboard-in-touch-scenarios-in-MRTK3/ * First round of code review changes * Code review changes part 2 * Fix for code review item #655 (comment) * Updated changelogs * Added a another changelog * Updated packages.json versions * Added two unit tests * Update package versions to the current state of main Update MRTK.SpatialManipulation.Editor.asmdef * Update tests to more consistently pass I was seeing the TestTouchKey test fail when run together with other tests, as the time between creating the keyboard and trying to press it was less than ReClickDelayTime. This didn't happen when running the test on its own. I added a two second wait to avoid this scenario. * Update test to release the button as well * Refactor key touch adapter color handling Now uses Button's targetGraphic and CrossFadeColor for state transitions * Aligned MonoBehaviour methods Also updated event registration to use hoverEntered instead of firstHoverEntered, since the first hover could be something like the gaze interactor, and we'd then miss any subsequent touch hovers * Add touch key tests and update click timing logic Added new unit tests for touch key interactions, including quick succession presses, hand hiding, and symbol layout. This revealed that lastClickTime wasn't being reset on click, so I fixed that as well. * Add initializeToViewCenter to RadialView * Genericize to initializeToTrackedCenter and use SolverHandler.TransformTarget --------- Signed-off-by: Kurtis <[email protected]> Co-authored-by: Kurtis <[email protected]> Co-authored-by: Kurtis <[email protected]>
1 parent cccdbec commit 9aabbda

File tree

16 files changed

+567
-17
lines changed

16 files changed

+567
-17
lines changed

UnityProjects/MRTKDevTemplate/Packages/packages-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@
381381
"depth": 0,
382382
"source": "local",
383383
"dependencies": {
384-
"org.mixedrealitytoolkit.core": "3.1.0",
385-
"org.mixedrealitytoolkit.uxcore": "3.0.0",
384+
"org.mixedrealitytoolkit.core": "3.2.0",
385+
"org.mixedrealitytoolkit.uxcore": "3.3.0",
386386
"com.unity.inputsystem": "1.6.1",
387387
"com.unity.xr.interaction.toolkit": "2.3.0"
388388
}
@@ -409,8 +409,8 @@
409409
"source": "local",
410410
"dependencies": {
411411
"com.microsoft.mrtk.graphicstools.unity": "0.5.12",
412-
"org.mixedrealitytoolkit.uxcore": "3.2.0",
413-
"org.mixedrealitytoolkit.spatialmanipulation": "3.0.0",
412+
"org.mixedrealitytoolkit.uxcore": "3.3.0",
413+
"org.mixedrealitytoolkit.spatialmanipulation": "3.4.0",
414414
"org.mixedrealitytoolkit.standardassets": "3.1.0",
415415
"com.unity.xr.interaction.toolkit": "2.3.0"
416416
}

org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
77
### Added
88

99
* Added different types of maintaining scale for bounds handles. [PR #976](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/976)
10+
* Added InitializeToTargetForward field/property to RadialView to position a GameObject in front of its target (like at the center of the view) when it becomes enabled. [PR #655](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/655)
1011

1112
### Fixed
1213

org.mixedrealitytoolkit.spatialmanipulation/Editor/MRTK.SpatialManipulation.Editor.asmdef

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"references": [
55
"MixedReality.Toolkit.Core",
66
"MixedReality.Toolkit.Core.Editor",
7-
"MixedReality.Toolkit.Input",
8-
"MixedReality.Toolkit.Input.Editor",
97
"MixedReality.Toolkit.SpatialManipulation",
108
"Unity.XR.Interaction.Toolkit",
119
"Unity.XR.Interaction.Toolkit.Editor"

org.mixedrealitytoolkit.spatialmanipulation/Solvers/RadialView.cs

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,37 @@ public float FixedVerticalPosition
146146
}
147147

148148
[SerializeField]
149-
[Tooltip("If true, element will orient to ReferenceDirection, otherwise it will orient to ref position.")]
149+
[Tooltip("If true, the element will orient to ReferenceDirection, otherwise it will orient to ref position.")]
150150
private bool orientToReferenceDirection = false;
151151

152152
/// <summary>
153-
/// If true, element will orient to ReferenceDirection, otherwise it will orient to ref position.
153+
/// If true, the element will orient to ReferenceDirection, otherwise it will orient to ref position.
154154
/// </summary>
155155
public bool OrientToReferenceDirection
156156
{
157157
get => orientToReferenceDirection;
158158
set => orientToReferenceDirection = value;
159159
}
160160

161+
[SerializeField]
162+
[Tooltip("If true, the element will position itself in front of the target transform when it becomes enabled," +
163+
" maintaining a distance equal to the average of its MinDistance and MaxDistance.")]
164+
private bool initializeToTargetForward = false;
165+
166+
/// <summary>
167+
/// If true, the element will position itself in front of the target transform when it becomes enabled,
168+
/// maintaining a distance equal to the average of its MinDistance and MaxDistance.
169+
/// </summary>
170+
/// <remarks>
171+
/// This prevents the object from rapidly approaching the viewer and
172+
/// ensures it appears upright. Only has effect when the solver becomes enabled.
173+
/// </remarks>
174+
public bool InitializeToTargetForward
175+
{
176+
get => initializeToTargetForward;
177+
set => initializeToTargetForward = value;
178+
}
179+
161180
/// <summary>
162181
/// Position to the view direction, or the movement direction, or the direction of the view cone.
163182
/// </summary>
@@ -184,10 +203,23 @@ private Vector3 UpReference
184203

185204
private Vector3 ReferencePoint => SolverHandler.TransformTarget != null ? SolverHandler.TransformTarget.position : Vector3.zero;
186205

206+
/// <inheritdoc/>
207+
protected override void OnEnable()
208+
{
209+
base.OnEnable();
210+
211+
if (initializeToTargetForward && SolverHandler.TransformTarget != null)
212+
{
213+
float distance = (MinDistance + MaxDistance) / 2.0f;
214+
WorkingPosition = SolverHandler.TransformTarget.position +
215+
SolverHandler.TransformTarget.forward.normalized * distance;
216+
}
217+
}
218+
187219
private static readonly ProfilerMarker SolverUpdatePerfMarker =
188220
new ProfilerMarker("[MRTK] RadialView.SolverUpdate");
189221

190-
/// <inheritdoc />
222+
/// <inheritdoc/>
191223
public override void SolverUpdate()
192224
{
193225
using (SolverUpdatePerfMarker.Auto())

org.mixedrealitytoolkit.spatialmanipulation/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"unityRelease": "26f1",
1818
"documentationUrl": "https://www.mixedrealitytoolkit.org",
1919
"dependencies": {
20-
"org.mixedrealitytoolkit.core": "3.1.0",
21-
"org.mixedrealitytoolkit.uxcore": "3.0.0",
20+
"org.mixedrealitytoolkit.core": "3.2.0",
21+
"org.mixedrealitytoolkit.uxcore": "3.3.0",
2222
"com.unity.inputsystem": "1.6.1",
2323
"com.unity.xr.interaction.toolkit": "2.3.0"
2424
},

org.mixedrealitytoolkit.uxcomponents/CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
44

5-
## [3.3.0-development] - 2024-04-26
5+
## Unreleased
6+
7+
### Added
8+
9+
* Added touch support for the NonNativeKeyboard. [PR #655](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/655)
10+
11+
### Fixed
12+
13+
* Changed PressableButton_Custom_Cylinder using Default-Material to MRTK_Standard_White instead. [PR #740](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/740)
14+
15+
## [3.3.0] - 2024-06-13
616

717
### Added
818

@@ -12,7 +22,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1222
### Fixed
1323

1424
* Reduced package description to support for UPM package publishing in the Unity Asset Store.
15-
* Changed PressableButton_Custom_Cylinder using Default-Material to MRTK_Standard_White instead. [PR #740](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/740)
1625

1726
## [3.2.0] - 2024-03-20
1827

@@ -27,4 +36,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
2736

2837
* Fixed support for UPM package publishing in the Unity Asset Store. [PR #519](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/519)
2938
* Fixed Bug #643 - Experimental SimpleEmptyButton and SimpleActionButton prefabs have missing "See It Say It Label" GameObject reference [PR #646](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/646)
30-
* Auto disable button's colliders when `StatefulInteractable` is disabled [PR #626](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/626)
39+
* Auto disable button's colliders when `StatefulInteractable` is disabled [PR #626](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/626)
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1001 &6492709475619478042
4+
PrefabInstance:
5+
m_ObjectHideFlags: 0
6+
serializedVersion: 2
7+
m_Modification:
8+
m_TransformParent: {fileID: 0}
9+
m_Modifications:
10+
- target: {fileID: 146120, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
11+
propertyPath: m_Name
12+
value: TouchableNonNativeKeyboard
13+
objectReference: {fileID: 0}
14+
- target: {fileID: 11499414, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
15+
propertyPath: m_PresetInfoIsWorld
16+
value: 0
17+
objectReference: {fileID: 0}
18+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
19+
propertyPath: m_Pivot.x
20+
value: 0.5
21+
objectReference: {fileID: 0}
22+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
23+
propertyPath: m_Pivot.y
24+
value: 0.5
25+
objectReference: {fileID: 0}
26+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
27+
propertyPath: m_AnchorMax.x
28+
value: 0
29+
objectReference: {fileID: 0}
30+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
31+
propertyPath: m_AnchorMax.y
32+
value: 0
33+
objectReference: {fileID: 0}
34+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
35+
propertyPath: m_AnchorMin.x
36+
value: 0
37+
objectReference: {fileID: 0}
38+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
39+
propertyPath: m_AnchorMin.y
40+
value: 0
41+
objectReference: {fileID: 0}
42+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
43+
propertyPath: m_SizeDelta.x
44+
value: 1250
45+
objectReference: {fileID: 0}
46+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
47+
propertyPath: m_SizeDelta.y
48+
value: 480
49+
objectReference: {fileID: 0}
50+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
51+
propertyPath: m_LocalScale.x
52+
value: 0.0004
53+
objectReference: {fileID: 0}
54+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
55+
propertyPath: m_LocalScale.y
56+
value: 0.0004
57+
objectReference: {fileID: 0}
58+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
59+
propertyPath: m_LocalScale.z
60+
value: 0.0004
61+
objectReference: {fileID: 0}
62+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
63+
propertyPath: m_LocalPosition.x
64+
value: 0
65+
objectReference: {fileID: 0}
66+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
67+
propertyPath: m_LocalPosition.y
68+
value: 0
69+
objectReference: {fileID: 0}
70+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
71+
propertyPath: m_LocalPosition.z
72+
value: 0
73+
objectReference: {fileID: 0}
74+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
75+
propertyPath: m_LocalRotation.w
76+
value: 1
77+
objectReference: {fileID: 0}
78+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
79+
propertyPath: m_LocalRotation.x
80+
value: 0
81+
objectReference: {fileID: 0}
82+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
83+
propertyPath: m_LocalRotation.y
84+
value: 0
85+
objectReference: {fileID: 0}
86+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
87+
propertyPath: m_LocalRotation.z
88+
value: 0
89+
objectReference: {fileID: 0}
90+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
91+
propertyPath: m_AnchoredPosition.x
92+
value: 0
93+
objectReference: {fileID: 0}
94+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
95+
propertyPath: m_AnchoredPosition.y
96+
value: 0
97+
objectReference: {fileID: 0}
98+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
99+
propertyPath: m_LocalEulerAnglesHint.x
100+
value: 0
101+
objectReference: {fileID: 0}
102+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
103+
propertyPath: m_LocalEulerAnglesHint.y
104+
value: 0
105+
objectReference: {fileID: 0}
106+
- target: {fileID: 22458684, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
107+
propertyPath: m_LocalEulerAnglesHint.z
108+
value: 0
109+
objectReference: {fileID: 0}
110+
- target: {fileID: 9023373078052804819, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
111+
propertyPath: m_Enabled
112+
value: 1
113+
objectReference: {fileID: 0}
114+
m_RemovedComponents: []
115+
m_SourcePrefab: {fileID: 100100000, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
116+
--- !u!1 &6492709475619610834 stripped
117+
GameObject:
118+
m_CorrespondingSourceObject: {fileID: 146120, guid: 74b589d1efab94a4cb70e4b5c22783f8, type: 3}
119+
m_PrefabInstance: {fileID: 6492709475619478042}
120+
m_PrefabAsset: {fileID: 0}
121+
--- !u!114 &4419896904837032465
122+
MonoBehaviour:
123+
m_ObjectHideFlags: 0
124+
m_CorrespondingSourceObject: {fileID: 0}
125+
m_PrefabInstance: {fileID: 0}
126+
m_PrefabAsset: {fileID: 0}
127+
m_GameObject: {fileID: 6492709475619610834}
128+
m_Enabled: 1
129+
m_EditorHideFlags: 0
130+
m_Script: {fileID: 11500000, guid: 4c8a10bdd6850674590a7d931a87adb3, type: 3}
131+
m_Name:
132+
m_EditorClassIdentifier:
133+
updateLinkedTransform: 0
134+
moveLerpTime: 0.1
135+
rotateLerpTime: 0.1
136+
scaleLerpTime: 0
137+
maintainScaleOnInitialization: 1
138+
smoothing: 1
139+
lifetime: 0
140+
referenceDirection: 1
141+
minDistance: 0.3
142+
maxDistance: 0.6
143+
minViewDegrees: 0
144+
maxViewDegrees: 30
145+
aspectV: 1
146+
ignoreAngleClamp: 0
147+
ignoreDistanceClamp: 0
148+
useFixedVerticalPosition: 0
149+
fixedVerticalPosition: -0.4
150+
orientToReferenceDirection: 0
151+
initializeToTargetForward: 1
152+
--- !u!114 &6914410306487292552
153+
MonoBehaviour:
154+
m_ObjectHideFlags: 0
155+
m_CorrespondingSourceObject: {fileID: 0}
156+
m_PrefabInstance: {fileID: 0}
157+
m_PrefabAsset: {fileID: 0}
158+
m_GameObject: {fileID: 6492709475619610834}
159+
m_Enabled: 1
160+
m_EditorHideFlags: 0
161+
m_Script: {fileID: 11500000, guid: 825e8142aab83ff49a9bb5f00a24e91b, type: 3}
162+
m_Name:
163+
m_EditorClassIdentifier:

org.mixedrealitytoolkit.uxcomponents/Experimental/NonNativeKeyboard/TouchableNonNativeKeyboard.prefab.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)