@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
21 lines • 719 B
JavaScript
/**
* Sets the priority attribute on a menu element, determining its position in the menu.
* Lower priority elements appear on the left, higher priority on the right.
*/
export function setElementPriority(button, priority) {
button.setAttribute("priority", String(priority));
}
/**
* Gets the priority attribute from a menu element.
* @returns The priority value, or undefined if not set or not a valid number.
*/
export function getElementPriority(button) {
const priority = button.getAttribute("priority");
if (priority) {
const val = Number.parseFloat(priority);
if (!Number.isNaN(val))
return val;
}
return undefined;
}
//# sourceMappingURL=menu-priority.js.map