UNPKG

algomin

Version:

Algomin - Viszualizing Distributed Algorithms

89 lines (77 loc) 1.94 kB
export class Controller { constructor(model) { this._model = model; } get model(){ return this._model; } /** * Sets the current runtime with the passed value * @param value Integer */ setGlobalTime(value){ this.model.setTime(value); } /** * Sets the running state to the current opposite */ handlePlayButtonClick(){ this.model.running = !this.model.running } /** * Sets the current runtime with the passed value and stops the animation * @param value Integer */ handleSliderInput(value){ this.model.running = false; this.setGlobalTime(value); } /** * Sets the x value of a shape with given value * @param shape Shape object * @param value Integer */ setShapeX(shape, value){ shape.x = value; } /** * Sets the y value of a shape with given value * @param shape Shape object * @param value Integer */ setShapeY(shape, value){ shape.y = value; } /** * Sets the w value of a shape with given value * @param shape Shape object * @param value Integer */ setShapeW(shape, value){ shape.w = value; } /** * Sets the h value of a shape with given value * @param shape Shape object * @param value Integer */ setShapeH(shape, value){ shape.h = value; } /** * Sets the x value of a message with given value * @param message Message object * @param value Integer */ setMessageX(message, value){ message.x = value; } /** * Sets the y value of a message with given value * @param message Message object * @param value Integer */ setMessageY(message, value){ message.y = value; } }