Difference between revisions of "Board18Map6"
(→Function mapMouseEvent(event): added link to Board18Map5) |
(updated release notice) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
board18Map6.js contains all the functions that | {{ReleaseNoticeX|2.5|Design_Document_board18Map_Page}} | ||
The board18Map6.js file contains all the functions that | |||
respond to various onclick events on the game board in the | respond to various onclick events on the game board in the | ||
Map page and on the main and tray | Map page and on the main and tray menues. But events | ||
that cause a context menu to be displayed are handled | |||
by functions in the board18Map5.js file. | by functions in the board18Map5.js file. | ||
==Function | ==Function hideShow()== | ||
The | The hideShow function will use the | ||
BD18.gameBoard object methods to hide/show tiles | |||
the | and tokens on the map. | ||
==Function makeTrayItems()== | == Function updateMenu(menuType)== | ||
The updateMenu function will update the menu move specific options.<br> | |||
The input '''menuType''' must be either 'active' or 'no'.<br> | |||
If the '''menuType''' is 'active' then the menu will contain as its first | |||
two options 'Accept Move' and 'Cancel Move'.<br> | |||
If the '''menuType''' is 'no' then the menu will contain as its first | |||
two options 'Undo Move' and 'Redo Move'. | |||
==Function makeTrayItems() == | |||
The makeTrayItems function will use the | The makeTrayItems function will use the | ||
BD18.trays array to construct the items | BD18.trays array to construct the items | ||
to be displayed in the tray menu. | to be displayed in the tray menu. | ||
==Function registerTrayMenu()== | ==Function registerTrayMenu() == | ||
The registerTrayMenu function creates the | The registerTrayMenu function creates the | ||
tray menu on the board18Map page. It uses | tray menu on the board18Map page. It uses | ||
the | the makeTrayItems function. | ||
makeTrayItems function. | |||
==Function tilePos(event)== | ==Function leftMenuEvent(key) == | ||
This function handles the selection of the leftMenu(Tray) | |||
and displays the proper BD18.tray. | |||
==Function tilePos(event) == | |||
This function calculates the board coordinates of a map | This function calculates the board coordinates of a map | ||
tile given the raw coordinates of a mouse click event. | tile given the raw coordinates of a mouse click event. | ||
==Function traySelect(event)== | ==Function traySelect(event) == | ||
This function responds to onclick events in the trays canvas. | This function responds to onclick events in the trays canvas. | ||
It selects a item from those currently displayed and highlites | It selects a item from those currently displayed and highlites | ||
the selected item. | the selected item. | ||
==Function hexSelect(event)== | ==Function hexSelect(event) == | ||
This function responds to left mousedown events in the | This function responds to left mousedown events in the | ||
map canvas. It checks various conditions and executes | map canvas. It checks various conditions and executes | ||
Line 36: | Line 48: | ||
no relevant condition then it merely returns. | no relevant condition then it merely returns. | ||
==Function mapMouseEvent(event)== | ==Function mapMouseEvent(event) == | ||
This function responds to mousedown events on the map canvas. | This function responds to mousedown events on the map canvas. | ||
It uses event. | It uses event.which to determine which mouse button was pressed. | ||
If the left or center button was pressed then it calls the | If the left or center button was pressed then it calls the | ||
hexSelect functon. Otherwise it assumes that the right button | hexSelect functon. Otherwise it assumes that the right button | ||
was pressed and | was pressed and calls the ContextMenu function. | ||
== Function ContextMenu(event) == | |||
This function uses makeMenuItems to create a ContextMenu. | |||
The menu will be positioned so as not to overlap the | |||
bounderies of the document. The displayed menu will not scroll. | |||
==Function doit(mm)== | == Function doit(mm,e)== | ||
This function is called via onclick events coded into the | This function is called via onclick events coded into the | ||
main menu on the board18Map page. the passed parameter | main menu on the board18Map page. the passed parameter | ||
indicates the | indicates the menue choice to be acted upon. | ||
mm is the onclick action to be taken. |
Latest revision as of 07:36, 28 July 2017
This page has been updated to comply with Release 2.5.x of BOARD18. | Go Back |
The board18Map6.js file contains all the functions that respond to various onclick events on the game board in the Map page and on the main and tray menues. But events that cause a context menu to be displayed are handled by functions in the board18Map5.js file.
Function hideShow()
The hideShow function will use the BD18.gameBoard object methods to hide/show tiles and tokens on the map.
The updateMenu function will update the menu move specific options.
The input menuType must be either 'active' or 'no'.
If the menuType is 'active' then the menu will contain as its first
two options 'Accept Move' and 'Cancel Move'.
If the menuType is 'no' then the menu will contain as its first
two options 'Undo Move' and 'Redo Move'.
Function makeTrayItems()
The makeTrayItems function will use the BD18.trays array to construct the items to be displayed in the tray menu.
Function registerTrayMenu()
The registerTrayMenu function creates the tray menu on the board18Map page. It uses the makeTrayItems function.
Function leftMenuEvent(key)
This function handles the selection of the leftMenu(Tray) and displays the proper BD18.tray.
Function tilePos(event)
This function calculates the board coordinates of a map tile given the raw coordinates of a mouse click event.
Function traySelect(event)
This function responds to onclick events in the trays canvas. It selects a item from those currently displayed and highlites the selected item.
Function hexSelect(event)
This function responds to left mousedown events in the map canvas. It checks various conditions and executes the appropriate function based on them. If it can find no relevant condition then it merely returns.
Function mapMouseEvent(event)
This function responds to mousedown events on the map canvas. It uses event.which to determine which mouse button was pressed. If the left or center button was pressed then it calls the hexSelect functon. Otherwise it assumes that the right button was pressed and calls the ContextMenu function.
Function ContextMenu(event)
This function uses makeMenuItems to create a ContextMenu. The menu will be positioned so as not to overlap the bounderies of the document. The displayed menu will not scroll.
Function doit(mm,e)
This function is called via onclick events coded into the main menu on the board18Map page. the passed parameter indicates the menue choice to be acted upon. mm is the onclick action to be taken.