xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

Incorrect types for CameraControl keyMap

Open NiklasPor opened this issue 2 months ago • 1 comments

Describe the bug The TS types for keymap on CameraControl only support numbers, but actually the controls support way more options. As a dev this is confusing, because I first thought you could only map a single button to an action with xeokit, but you can actually assign an array and assign as many as you want to.

Current types:

set keyMap(arg: {
  [key: number]: number;
});

get keyMap(): {
  [key: number]: number;
};

Correct type would be:

type KeyMap = Record<number, string, number[], number[][]>

set keyMap(arg: KeyMap);

get keyMap(): KeyMap;
  • number -> single button
  • number[] -> multiple buttons which active the action alone
  • number[][] -> combination of multiple buttons which need to be pressed at the same time
  • string -> preset

NiklasPor avatar Nov 02 '25 16:11 NiklasPor