Canvas =========== Canvas (aka model panel) is the center stage. Model creation and visualization take place in the canvas. .. figure:: canvas.png :alt: canvas Figure 1: Canvas Virtual size +++++++++++++ Mekanimo employs a scrollable canvas window which provides a more flexible user interface than a fixed sized window. The limits of the scrollable area (virtual area) is determined by the virtual size of the canvas. The default virtual size is 40,000 pixels by 30,000 pixels. The virtual size can be manipulated by setting the *canvas.virtualSize* as shown below. .. code-block:: python >>> canvas.virtualSize = (120000, 30000) .. Note:: If you would like to change the virtual size Mekanimo uses when it starts up, you can add a line specifying the desired size to the :ref:`startup` file located in the installation directory. Coordinates ++++++++++++ Origin of the global coordinates is located at the center of the canvas' virtual area (defined by *canvas.virtualSize* as explained above) by default. For convenience Mekanimo scrolls the canvas so that the global coordinates system is displayed on the bottom left corner. The position of the mouse cursor (in global coordinates) is displayed in the status bar. It is possible to scroll the canvas by using the scroll bars or the arrow keys (you can also pan the canvas by dragging the mouse while holding the space key). In addition to the global coordinates there are two other pixel based coordinate system: Canvas coordinates and screen coordinates. .. seealso:: :ref:`coordinates-and-coordinate-systems` Scale ++++++ Objects displayed in the canvas can be scaled by using the zoom-in, zoom-out options or from the Python interpreter by specifying the scale factor as shown below. .. code-block:: python >>> canvas.setScale(.5) Grid and snap to grid +++++++++++++++++++++ Grid can be used to help aligning objects in the canvas. Grid and snap-to-grid options can be turned on/off from the menus, toolbar, or the Python interpreter as shown below: .. code-block:: python >>> canvas.showGrid = True >>> canvas.snapToGrid = True .. Note:: If you would like to change the default grid and snap-to-grid options Mekanimo uses when it starts up, you can add a line specifying the desired option in the :ref:`startup` file. Background color +++++++++++++++++ Canvas background color is white by default. Background color can be changed from ``Settings`` -> ``Background color`` menu or from the :term:`interpreter` as shown below. .. code-block:: python >>> canvas.setBackgroundColor(color.green) or >>> canvas.setBackgroundColor((150, 200, 100)) If you would like to change the default background color, you can add the line shown below with the color you desire to the :ref:`startup` file. .. code-block:: python canvas.setBackgroundColor(color.navyblue)