Description

Sets position to the window. If no parameter is assigned, the method returns the current position of the element in an object : {x: , y:}

Usage

Parameters

  • x {String|Integer} optional

    (optional) Position X. If the parameter is a string, the window is positioned at a specific location :

    • middle : The window is centered
    • bottom : The position of window is in bottom with 3% margin
    • top : The position of window is in top with 3% margin
    • bottom-X : The position of window is in bottom with X margin (px) (eq: "bottom-20")
    • top+X : The position of window is in top with X margin (px) (eq: "top+20")

  • y {Integer} optional

    (optional) Position Y

Returns

CanvasEngine.Window

Example

In ready method

var _window = canvas.Window.new(this, 230, 200, "border");

_window.position(50, 100);
_window.position(); // returns {x: 50, y: 100}
_window.position("middle"); // Center of the window

_window.open(stage);

Discussion