class HandRadialLayer
This class represents a single layer in the HandRadialMenu. Each item in the layer is displayed around the radial menu’s circle.
Instance Fields and Properties
float backAngle | What’s the angle pointing towards the back button on this menu? If there is a back button. This is used to orient the back button towards the direction the finger just came from. |
HandMenuItem[] items | A list of menu items to display in this menu layer. |
string layerName | Name of the layer, this is used for layer traversal, so make sure you get the spelling right! Perhaps use const strings for these. |
HandRadialLayer Parent | The layer above this layer, will be null if this is the root layer. |
float startAngle | An angle offset for the layer, if you want a specific orientation for the menu’s contents. Note this may not behave as expected if you’re setting this manually and using the backAngle as well. |
Instance Methods
HandRadialLayer | Creates a menu layer, this overload will calculate a backAngle if there are any back actions present in the item list. |
AddChild | This adds a menu layer as a child item of this layer. |
AddItem | This appends a new menu item to the end of the menu’s list. |
FindChild | Find a child menu layer by name. |
FindItem | Find a menu item by name. |
RemoveChild | Finds the layer in the list of child layers, and removes it, if it exists. |
RemoveItem | Finds the item in the list, and removes it, if it exists. |
Examples
Basic layered hand menu
The HandMenuRadial is an IStepper
, so it should be registered with
StereoKitApp.AddStepper
so it can run by itself! It’s recommended to
keep track of it anyway, so you can remove it when you’re done with it
via StereoKitApp.RemoveStepper
The constructor uses a params style argument list that makes it easy and clean to provide lists of items! This means you can assemble the whole menu on a single ‘line’. You can still pass arrays instead if you prefer that!
handMenu = SK.AddStepper(new HandMenuRadial(
new HandRadialLayer("Root",
new HandMenuItem("File", null, null, "File"),
new HandMenuItem("Search", null, null, "Edit"),
new HandMenuItem("About", Sprite.FromFile("search.png"), () => Log.Info(SK.VersionName)),
new HandMenuItem("Cancel", null, null)),
new HandRadialLayer("File",
new HandMenuItem("New", null, () => Log.Info("New")),
new HandMenuItem("Open", null, () => Log.Info("Open")),
new HandMenuItem("Close", null, () => Log.Info("Close")),
new HandMenuItem("Back", null, null, HandMenuAction.Back)),
new HandRadialLayer("Edit",
new HandMenuItem("Copy", null, () => Log.Info("Copy")),
new HandMenuItem("Paste", null, () => Log.Info("Paste")),
new HandMenuItem("Back", null, null, HandMenuAction.Back))));
SK.RemoveStepper(handMenu);
Found an issue with these docs, or have some additional questions? Create an Issue on Github!