I am unable to use the web SDK to setup and control the radial menus and/or button mappings. This doesn't even work with the supplied samples. These all have some code similar to this:
Code: Select all
this.on3dmouseCreated = function () {
const self = this;
const actionTree = new _3Dconnexion.ActionTree();
const actionImages = new _3Dconnexion.ImageCache();
// set ourselves as the timing source for the animation frames
self.spaceMouse.update3dcontroller({
frame: { timingSource: 1 },
});
actionImages.onload = function () {
self.spaceMouse.update3dcontroller({
images: actionImages.images,
});
};
// An actionset can also be considered to be a buttonbank, a menubar, or a set of toolbars
// Define a unique string for the action set to be able to specify the active action set
// Because we only have one action set use the 'Default' action set id to not display the label
const buttonBank = actionTree.push(
new _3Dconnexion.ActionSet("Default", "Custom action set")
);
getApplicationCommands(buttonBank, actionImages);
// Expose the commands to 3Dxware and specify the active buttonbank / action set
self.spaceMouse.update3dcontroller({
commands: { activeSet: "Default", tree: actionTree },
});
};
function getApplicationCommands(buttonBank, images) {
// Add a couple of categories / menus / tabs to the buttonbank/menubar/toolbar
// Use the categories to group actions so that the user can find them easily
const fileNode = buttonBank.push(
new _3Dconnexion.Category("CAT_ID_FILE", "File")
);
const editNode = buttonBank.push(
new _3Dconnexion.Category("CAT_ID_EDIT", "Edit")
);
// Add menu items / actions
fileNode.push(new _3Dconnexion.Action("ID_OPEN", "Open", "Open file"));
fileNode.push(
new _3Dconnexion.Action("ID_CLOSE", "Close", "Close file")
);
fileNode.push(
new _3Dconnexion.Action("ID_EXIT", "Exit", "Exit program")
);
// Add menu items / actions
editNode.push(
new _3Dconnexion.Action("ID_UNDO", "Undo", "Shortcut is Ctrl + Z")
);
editNode.push(
new _3Dconnexion.Action("ID_REDO", "Redo", "Shortcut is Ctrl + Y")
);
editNode.push(
new _3Dconnexion.Action("ID_CUT", "Cut", "Shortcut is Ctrl + X")
);
editNode.push(
new _3Dconnexion.Action("ID_COPY", "Copy", "Shortcut is Ctrl + C")
);
editNode.push(
new _3Dconnexion.Action("ID_PASTE", "Paste", "Shortcut is Ctrl + V")
);
// Now add the images to the cache and associate it with the menu item by using the same id as the menu item / action
// These images will be shown in the 3Dconnexion properties editor and in the UI elements which display the
// active button configuration of the 3dmouse
images.push(
_3Dconnexion.ImageItem.fromURL("images/open.png", "ID_OPEN")
);
images.push(
_3Dconnexion.ImageItem.fromURL("images/close.png", "ID_CLOSE")
);
images.push(
_3Dconnexion.ImageItem.fromURL("images/exit.png", "ID_EXIT")
);
images.push(
_3Dconnexion.ImageItem.fromURL("images/Macro_Cut.png", "ID_CUT")
);
images.push(
_3Dconnexion.ImageItem.fromURL("images/Macro_Copy.png", "ID_COPY")
);
images.push(
_3Dconnexion.ImageItem.fromURL("images/Macro_Paste.png", "ID_PASTE")
);
images.push(
_3Dconnexion.ImageItem.fromURL("images/Macro_Undo.png", "ID_UNDO")
);
images.push(
_3Dconnexion.ImageItem.fromURL("images/Macro_Redo.png", "ID_REDO")
);
}
