Class: openspace

openspace


new openspace(setting)

OpenSpace WebSocket related communication method

Parameters:
Name Type Description
setting object

The configuration object

Properties:
Name Type Description
config object

The configuration object stored from the parameter

robot library

The robotjs library

ws library

The WebSocket use to connect OpenSpace backend

Source:

Methods


init()

Function to initial mouse control related (robotjs) variable

Properties:
Name Type Description
mouse array-number

The user's mouse x and y position

altY array-number

How many y pixels should mouse increase/decrease while holding right key (zoom in/zoom out)

latY array-number

How many y pixels should mouse increase/decrease while holding left key (rotate up/rotate down)

latX array-number

How many x pixels should mouse increase/decrease while holding left key (rotate left/rotate right)

Source:

clear(type)

Function to clear mouse control

Parameters:
Name Type Description
type string

'alt' / 'lat' / 'all'

Source:

moveAltitude(type, value)

Function to move altitude (zoom in or zoom out)

Parameters:
Name Type Description
type string

1 (zoom out) / 1 (zoom in)

value string

How many pixels should be moved

Source:

moveGeo(msg)

Function to move latitude and longitude (rotation)

Parameters:
Name Type Description
msg array-number

A array includes {angle,distance}

Properties:
Name Type Description
msg.angle object

What is angle triggered on joystick.

msg.distance library

What is distance triggered on joystick.

Source:

screenshot(setting)

Function to screenshot OpenSpace, then send the screenshot to client's device

Parameters:
Name Type Description
setting object

The configuration object

Source:

changePlanet(planet)

Function to change OpenSpace current focus planet

Parameters:
Name Type Description
planet string

The number of planet

Source:

trigger(event)

Function to trigger the api script

Parameters:
Name Type Description
event object

The api event

Source:

set(event)

Function to set the api value

Parameters:
Name Type Description
event object

The api event

Source:

lua(script)

Function to run lua script

Parameters:
Name Type Description
script object

The lua script

Source: