Skip to content

Latest commit

 

History

History
102 lines (66 loc) · 2.53 KB

MODULES.md

File metadata and controls

102 lines (66 loc) · 2.53 KB

ProjectCraft Code Documentation

Module guidelines

- Title [global object's name, for example: Map]
- Description
- Requires
- Functions
- Variables

InfoMenu [InfoMenu]

InfoMenu is the window on the right side of the screen, responsible for showing a list of all projects and their information.

Functions

- InfoMenu.open
- InfoMenu.close
- InfoMenu.createItemsByList(infoItem array)
- InfoMenu.addItem(infoItem)
- InfoMenu.openPageByIndex(PageIndex INT)
- InfoMenu.onItemClick(infoItem)                - HANDLER (has to be assigned)

{infoItem}

- title     STRING REQUIRED
- imageUrl  PATH_STRING
- onclick   FUNCTION(this)
- typeName  STRING

Variables

- InfoMenu.openState BOOLEAN
- InfoMenu.pageIndex INT

EXTENDERS

InfoMenu_mapJsExtender [InfoMenu] - EXTENDS InfoMenu

InfoMenu is the window on the right side of the screen, responsible for showing a list of all projects and their information.

Functions

- InfoMenu.openProjectPageByTitle(infoItem)
- InfoMenu.goThroughPortal(ProjectTitle STRING)

{infoItem}: Documentation at README.md

Map [Map]

map.js is the drawing engine behind the website.

Requires: nothing.

Functions

- Map.init(points, factor):
  Call Map.init with an array of points which need to be drawn and a displacement factor. (4 for overworld, 1 for nether)
  
- Map.drawLine(startX, startZ, endX, endZ, colour):
  Draw a line from some point to some point with a colour.

- Map.MCToDOM(x):
  Convert Minecraft coördinates to DOM coördinates

- Map.DOMToMC(x):
  Convert DOM coördinates to Minecraft coördinates

- Map.DOMPanTo({x: x, z: z}):
  Pan to specified DOM coördinates

- Map.panToItem(item):
  Pan to the position of the specified item.

- Map.handleClick(x, z):
  Handle a click on the map at the specified clicking positions
  
- Map.onItemClick(point): HANDLER
  This is a handler for page-specific code execution.

- Map.findClickbox(x, z):
  Check if there's a clickbox at the specified DOM coördinates

- Map.zoom(percentage):
  Zoom to the specified percentage

- Map.zoomIn():
  Call to zoom in.

- Map.zoomOut():
  Call to zoom out.

Variables

- Settings:
  Contains these settings:
    - Max zoom (as maxZoom)
    - Zoom step size (as zoomStepSize)
    - Animation speed (as animationSpeed)