Recent Changes - Search:

Information

Installation

Documentation

 

Relative Position of 2D View Elements

A static relative position (i.e. a position that will not change during the execution of the simulation) a 2D drawable element in Ejs is specified using one of the predefined Ejs constants:

  • CENTERED. The shape is drawn with its center point on the element’s coordinates. (Equivalent integer: 0).
  • NORTH. The shape is drawn with its top middle point on the element’s coordinates. (Equivalent integer: 1).
  • SOUTH. The shape is drawn with its bottom middle point on the element’s coordinates.  (Equivalent integer: 2).
  • EAST. The shape is drawn with its middle right point on the element’s coordinates. (Equivalent integer: 3).
  • WEST. The shape is drawn with its middle left point on the element’s coordinates.(Equivalent integer: 4).
  • NORTH_EAST. The shape is drawn with its top right point on the element’s coordinates. (Equivalent integer: 5).
  • NORTH_WEST. The shape is drawn with its top left point on the element’s coordinates. (Equivalent integer: 6).
  • SOUTH_EAST. The shape is drawn with its bottom right point on the element’s coordinates. (Equivalent integer: 7).
  • SOUTH_WEST. The shape is drawn with its bottom left point on the element’s coordinates. (Equivalent integer: 8).

 

It could be easier to choose the position in the menu:

 

 

To specify a position that changes in run-time, you’ll need to declare a variable of type int, associate it to the corresponding element property, and then change the variable according to your program’s logic. The integer values equivalent to each relative position are specified in the list above.


Edit - History - Print - Recent Changes - Search
Page last modified on April 29, 2009, at 12:11 AM