-
-
Notifications
You must be signed in to change notification settings - Fork 17
Home
Main class. Represents a single menu.
PopupMenu(String title, String subtitle, Array items, Number itemLimit)
Stats(Array stats)
— adds statistics to the bottom of a menu. Array consists of MenuStatItem
Slider(String name, String units, Number initalValue)
— adds a fullwidth bar to the bottom of a menu. Inital value is in range from 0 to 100
ColorPicker(String name, Array colors)
— adds a color selector to the bottom of a menu. Array consists of hex color strings
XYGrid(Number initalX, Number initalY, String top, String bottom, String left, String right)
— adds a xy grid control to the bottom of a menu. InitalX and InitalY in a range from 0.0 to 1.0
currentItem()
— returns selected item
getStatByIndex(Number index)
— returns statistics data with specified index
getStatByName(String name
— returns statistics data with specified name
nextColorItem()
prevColorItem()
— changes current selected item in colorpicker block
nextSelectionItem()
prevSelectionItem()
— changes current item in selection control
setGridXY(Number x, Number y)
— sets x,y position of point in xy grid block. x and y should be in range of 0.0 - 1.0
getGridXY()
— returns {x,y} object with current position of point in xy grid block
var menuInfo = new PopupMenu('Vinewood Hills, 234', 'buy house', [
MenuItem('Cost', '$10000'),
MenuItem('Rooms', 3),
MenuItem('Sleeping places', 1, 'Determines how many people can live in this house'),
MenuItem('Select style', ['Modern', 'Victorian', 'Vagabond']).SelectionChanged(function(index, name) { console.log(index + ': ' + name); }),
MenuItem('Owner', 'no'),
MenuItem('Buy').Style('green button').Submenu(submenuInfo),
MenuItem('Sell').Style('red button'),
MenuItem('Close menu').Style('gray'),
], 5).Stats([
MenuStatItem('Engine speed what', 25, 5),
MenuStatItem('This', 50)
]).Slider('Opacity', null, 50).ColorPicker('Colors', [
'40BAE3', '6840E3', '30BF7F', '9FF23A',
'3AF2EF', 'F2713A', 'F2463A', 'F2F07E',
'F255AE', '999095', '40BAE3', '6840E3',
'30BF7F', '9FF23A', '3AF2EF', 'F2713A',
'F2463A', 'F2F07E', 'F255AE', '999095',
]).XYGrid(0, 0);
Represents menu item.
MenuItem(String name, String/Array value, String help)
If value is an array then a menu item becomes selection item
Click(function callback)
— For click event
SelectionChanged(function callback)
— Only for selection item. Fires when selection item changes it's index
Back()
— When item clicked a menu returns to previous menu
Style(String style)
— Adds additional classes to menu item
Submenu(PopupMenu menu)
— When item is clicked it opens submenu
Represents item for statistics block
MenuStatItem(String name, Number value, Number levels, Number width)
value
is in range from 0 to 100
levels
is how many lines will be in bar (min: 1)
width
is width of the bar in pixels (default: 160)