|  | @@ -19,19 +19,40 @@
 | 
	
		
			
				|  |  |   * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
 | 
	
		
			
				|  |  |   *************************************************************************/
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * The {@code UIObject} class represents a minimal structure for any GameObject that
 | 
	
		
			
				|  |  | + * hold an HTML interface element.
 | 
	
		
			
				|  |  | + * 
 | 
	
		
			
				|  |  | + * ! All GameObjects need to be inside the tree to do anything (can be added as a child
 | 
	
		
			
				|  |  | + * ! of another GameObject on the tree or as a root).
 | 
	
		
			
				|  |  | + * 
 | 
	
		
			
				|  |  | + * @author Pedro Schneider
 | 
	
		
			
				|  |  | + * 
 | 
	
		
			
				|  |  | + * @class
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  |  class UIObject extends GameObject
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @constructor
 | 
	
		
			
				|  |  | +     * Initializes an empty UIObject.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {String} name name for this UIObject. 
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      constructor(name)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          super(name);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        this.P5Element = null;
 | 
	
		
			
				|  |  | -        this.visible = true;
 | 
	
		
			
				|  |  | -        this.position = new Vector2(0, 0);
 | 
	
		
			
				|  |  | -        this.size = new Vector2(300, 100);
 | 
	
		
			
				|  |  | -        this.fontSize = STYLE.DEFAULT_FONT_SIZE;
 | 
	
		
			
				|  |  | +        this.P5Element = null; // This UIOBject's p5.Element (that holds an HTML element).
 | 
	
		
			
				|  |  | +        this.visible = true; // Is this UIObject visible at the moment?
 | 
	
		
			
				|  |  | +        this.position = new Vector2(0, 0); // This UIObject's position on the secondary buffer.
 | 
	
		
			
				|  |  | +        this.size = new Vector2(300, 100); // The UIObject's size on the secondary buffer.
 | 
	
		
			
				|  |  | +        this.fontSize = STYLE.DEFAULT_FONT_SIZE; // This UIObject's font style.
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Connects this UIObject's p5.Element's events to this GameObject's appropriate
 | 
	
		
			
				|  |  | +     * methods.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      connectCallbacks()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.P5Element.mousePressed(this.onMousePressed);
 | 
	
	
		
			
				|  | @@ -51,24 +72,45 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |          this.P5Element.pandoraObject = this;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // Setters
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets the position of this UIObject on the secondary buffer.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {number} x    pixel position on the X axis.
 | 
	
		
			
				|  |  | +     * @param {number} y    pixel position on the Y axis.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      setPosition(x, y)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.position.x = x;
 | 
	
		
			
				|  |  |          this.position.y = y;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets the size of this UIObject on the secondary buffer.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {number} w    pixel width of this UIObject. 
 | 
	
		
			
				|  |  | +     * @param {number} h    pixel height of this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      setSize(w, h)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.size.x = w;
 | 
	
		
			
				|  |  |          this.size.y = h;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets this UIObject's font size.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {number} fs   new font size.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      setFontSize(fs)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.fontSize = fs;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets the visibility of this UIObject's p5.Element's visibility.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {boolean} vis new value for the visibility of the UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      setVisibility(vis)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          if (vis) this.P5Element.show();
 | 
	
	
		
			
				|  | @@ -76,11 +118,22 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |          this.visible = !this.visible;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets the inner html value of this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {*} val   new inner HTML value for this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      setValue(val)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.P5Element.value(val)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets the CSS style of this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {Object} style    object containing the CSS style for this
 | 
	
		
			
				|  |  | +     *                          UIObject. 
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      setStyle(style)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          for (const [key, value] of Object.entries(style))
 | 
	
	
		
			
				|  | @@ -89,33 +142,61 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // Getters
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Returns this UIOBject's position on the secondary buffer.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @returns {Vector2} this UIObject's position on the secondary buffer.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      getPosition()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          return this.position;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Returns this Object's position on the secondary buffer.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @returns {Vector2}   this UIObject's size on the secondary buffer.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      getSize()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          return this.size;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Returns this UIObject's font size.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @returns {number}    this UIObject's font size.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      getFontSize()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          return this.fontSize;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Returns this UIObject's visibility flag.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @returns {boolean}   true if this UIObject is visible, false if not.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      getVisibility()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          return this.visible;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Return the inner HTML value of this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @returns {String}    inner HTML value of this UIObject's p5.Element. 
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      getValue()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          return this.P5Element.value();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // Methods
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets this UIObject's visibility flag to true, shows the p5.Element, and
 | 
	
		
			
				|  |  | +     * recursively calls the show() method on all of this GameObject's children 
 | 
	
		
			
				|  |  | +     * if they have it.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      show()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.visible = true;
 | 
	
	
		
			
				|  | @@ -128,6 +209,11 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Sets this UIObject's visibility flag to false, hides the p5.Element, and
 | 
	
		
			
				|  |  | +     * recursively calls the hide() method on all of this GameObject's children 
 | 
	
		
			
				|  |  | +     * if they have it.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      hide()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.visible = false;
 | 
	
	
		
			
				|  | @@ -140,15 +226,28 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @override
 | 
	
		
			
				|  |  | +     * Adds a GameObject as a child of this UIObject, and parents the child's p5.Element
 | 
	
		
			
				|  |  | +     * if they are a UIObject.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {GameObject} child 
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      addChild(child)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          child.parent = this;
 | 
	
		
			
				|  |  |          child.parented = true;
 | 
	
		
			
				|  |  |          this.children.push(child);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        child.P5Element.parent(this.P5Element);
 | 
	
		
			
				|  |  | +        if (child.P5Element)
 | 
	
		
			
				|  |  | +            child.P5Element.parent(this.P5Element);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @override
 | 
	
		
			
				|  |  | +     * Recursively marks this GameObject's and all of its children's
 | 
	
		
			
				|  |  | +     * memory for garbage collection. Also removes this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      destroy()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          for (let i = 0; i < this.children.length; i++)
 | 
	
	
		
			
				|  | @@ -161,76 +260,34 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |              this[prop] = null;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // Callbacks
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onMousePressed()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onDoubleClicked()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onMouseWheel()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onMouseReleased()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onMouseClicked()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onMouseMoved()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onMouseOver()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onMouseOut()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onTouchStarted()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onTouchMoved()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onTouchEnded()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onDragOver()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    _onDragLeave()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // -----------------------------------------------
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @override
 | 
	
		
			
				|  |  | +     * Defines default signals for UIObjects and serves as the caller to this UIObject's
 | 
	
		
			
				|  |  | +     * _initSignals() callbacks.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @signal mousePressed     emited once every time a mouse button is pressed over this
 | 
	
		
			
				|  |  | +     *                          UIObject.
 | 
	
		
			
				|  |  | +     * @signal doubleClicked    emited once every time a mouse button is pressed twice over
 | 
	
		
			
				|  |  | +     *                          this UIObject.
 | 
	
		
			
				|  |  | +     * @signal mouseWheel       emited once everty time a mouse wheel is scrolled over this
 | 
	
		
			
				|  |  | +     *                          UIObject. Passes one argument {event} that holds the deltaY
 | 
	
		
			
				|  |  | +     *                          property, that holds a number based on how much was vertically
 | 
	
		
			
				|  |  | +     *                          scrolled (up is positive) and the deltaX property, that holds a
 | 
	
		
			
				|  |  | +     *                          number based on how much was horizontaly scrolled (right is positive).
 | 
	
		
			
				|  |  | +     * @signal mouseReleased    emited once every time a mouse button is released over this
 | 
	
		
			
				|  |  | +     *                          UIObject.
 | 
	
		
			
				|  |  | +     * @signal mouseClicked     emited once every time a mouse button is pressed and released
 | 
	
		
			
				|  |  | +     *                          over this UIObject.
 | 
	
		
			
				|  |  | +     * @signal mouseMoved       emited once every time a mouse moves over this UIObject.
 | 
	
		
			
				|  |  | +     * @signal mouseOver        emited once every time a mouse moves onto this UIObject.
 | 
	
		
			
				|  |  | +     * @signal mouseOut         emited once every time a mouse moves out of this UIObject.
 | 
	
		
			
				|  |  | +     * @signal touchStarted     emited once every time a touch is regiestered over this UIObject.
 | 
	
		
			
				|  |  | +     * @signal touchMoved       emited once every time a touch move is regiestered over this
 | 
	
		
			
				|  |  | +     *                          UIObject.
 | 
	
		
			
				|  |  | +     * @signal touchEnded       emited once every time a touch is regiestered over this UIObject.
 | 
	
		
			
				|  |  | +     * @signal dragOver         emited once every time a file is dragged over this UIObject.
 | 
	
		
			
				|  |  | +     * @signal dragLeave        emited once every time a dragged file leaves this UIObject's area.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      initSignals()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.addSignal("mousePressed");
 | 
	
	
		
			
				|  | @@ -246,9 +303,21 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |          this.addSignal("touchEnded");
 | 
	
		
			
				|  |  |          this.addSignal("dragOver");
 | 
	
		
			
				|  |  |          this.addSignal("dragLeave");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          this._initSignals();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @override
 | 
	
		
			
				|  |  | +     * Updates this UIObject's p5.Element size, position and font size based
 | 
	
		
			
				|  |  | +     * on the secondary buffer's size on the actual window. This gives the
 | 
	
		
			
				|  |  | +     * impression that the HTML element is actually beeing drawn to the secondary
 | 
	
		
			
				|  |  | +     * buffer instead of the main one.
 | 
	
		
			
				|  |  | +     * ? is it possible to draw them directly to the secondary buffer?
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {number} delta 
 | 
	
		
			
				|  |  | +     * @param {p5.Graphics} db 
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      draw(delta, db)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          let ar = db.screenWidth / db.width;
 | 
	
	
		
			
				|  | @@ -267,81 +336,297 @@ class UIObject extends GameObject
 | 
	
		
			
				|  |  |              this.children[i].draw(delta, db);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button is pressed over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the mousePressed event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the mousePressed signal and calls the _onMousePressed()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onMousePressed()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("mousePressed");
 | 
	
		
			
				|  |  |          this.pandoraObject._onMousePressed();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button in pressed twice over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the doubleClicked event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the doubleClicked signal and calls the _onDoubleClicked()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onDoubleClicked()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("doubleClicked");
 | 
	
		
			
				|  |  |          this.pandoraObject._onDoubleClicked();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    onMouseWheel()
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -        this.pandoraObject.emitSignal("mouseWheel");
 | 
	
		
			
				|  |  | -        this.pandoraObject._onMouseWheel();
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a mouse wheel is scrolled over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the mouseWheel event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the mouseWheel signal and calls the _onMouseWheel()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {Object} event    contains data about the wheen scroll, with the deltaY
 | 
	
		
			
				|  |  | +     *                          and deltaX property, containing data about the vertical
 | 
	
		
			
				|  |  | +     *                          and horizontal scrolling, repsctively.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    onMouseWheel(event)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        this.pandoraObject.emitSignal("mouseWheel", event);
 | 
	
		
			
				|  |  | +        this.pandoraObject._onMouseWheel(event);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button is released over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the mouseReleased event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the mouseReleased signal and calls the _onMouseReleased()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onMouseReleased()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("mouseReleased");
 | 
	
		
			
				|  |  |          this.pandoraObject._onMouseReleased();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button is pressed and released over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the mouseClicked event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the mouseClicked signal and calls the _onMouseClicked()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onMouseClicked()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("mouseClicked");
 | 
	
		
			
				|  |  |          this.pandoraObject._onMouseClicked();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once everty time a mouse moves over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the mouseMoved event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the mouseMoved signal and calls the _onMouseMoved()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onMouseMoved()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("mouseMoved");
 | 
	
		
			
				|  |  |          this.pandoraObject._onMouseMoved();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a mouse moves onto this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the mouseOver event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the mouseOver signal and calls the _onMouseOver()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onMouseOver()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("mouseOver");
 | 
	
		
			
				|  |  |          this.pandoraObject._onMouseOver();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a mouse moves off the UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the mouseOut event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the mouseOut signal and calls the _onMouseOut()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onMouseOut()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("mouseOut");
 | 
	
		
			
				|  |  |          this.pandoraObject._onMouseOut();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a touch is registered over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the touchStarted event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the touchStarted signal and calls the _onTouchStarted()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onTouchStarted()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("touchStarted");
 | 
	
		
			
				|  |  |          this.pandoraObject._onTouchStarted();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a touch move is registered over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the touchMoved event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the touchMoved signal and calls the _onTouchMoved()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onTouchMoved()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("touchMoved");
 | 
	
		
			
				|  |  |          this.pandoraObject._onTouchMoved();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a touch is registered over this UIObject.
 | 
	
		
			
				|  |  | +     * Connected to the touchEnded event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the touchEnded signal and calls the _onTouchEnded()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onTouchEnded()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("touchEnded");
 | 
	
		
			
				|  |  |          this.pandoraObject._onTouchEnded();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a file is dragged over this UIObject's area.
 | 
	
		
			
				|  |  | +     * Connected to the dragOver event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the dragOver signal and calls the _onDragOver()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onDragOver()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("dragOver");
 | 
	
		
			
				|  |  |          this.pandoraObject._onDragOver();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * Called once every time a dragged file leaves tis UIObject's area.
 | 
	
		
			
				|  |  | +     * Connected to the dragLeave event from this UIObject's p5.Element.
 | 
	
		
			
				|  |  | +     * Serves as an emiter to the dragLeave signal and calls the _onDragLeave()
 | 
	
		
			
				|  |  | +     * callback.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      onDragLeave()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          this.pandoraObject.emitSignal("dragLeave");
 | 
	
		
			
				|  |  |          this.pandoraObject._onDragLeave();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button is pressed over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onMousePressed()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button in pressed twice over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onDoubleClicked()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a mouse wheel is scrolled over this UIObject.
 | 
	
		
			
				|  |  | +     * 
 | 
	
		
			
				|  |  | +     * @param {Object} event    contains data about the wheen scroll, with the deltaY
 | 
	
		
			
				|  |  | +     *                          and deltaX property, containing data about the vertical
 | 
	
		
			
				|  |  | +     *                          and horizontal scrolling, repsctively.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onMouseWheel(event)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button is released over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onMouseReleased()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a mouse button is pressed and released over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onMouseClicked()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once everty time a mouse moves over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onMouseMoved()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a mouse moves onto this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onMouseOver()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a mouse moves off the UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onMouseOut()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a touch is registered over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onTouchStarted()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a touch move is registered over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onTouchMoved()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a touch is registered over this UIObject.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onTouchEnded()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a file is dragged over this UIObject's area.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onDragOver()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @callback
 | 
	
		
			
				|  |  | +     * ! This function should be overriden, it provides no default functionality.
 | 
	
		
			
				|  |  | +     * Called once every time a dragged file leaves tis UIObject's area.
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    _onDragLeave()
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |