Makes transformation that shifts, rotates and flips the defined rectangle.

The goal of this transformation is to simplify drawing in the area so after the transformation shifting, rotating and flipping is executed by the transformation.

The goal of this transformation is to simplify drawing in the area so after the transformation shifting, rotating and flipping is executed by the transformation.

Empty **prepareDrawRect**(Object **mMap**)

mMap | (Object) Object of the PmMap type that contains the following properties specify the transformation process:
x
(mandatory) - X position of the left upper corner of the rectangle (in pixels)y
(mandatory) - Y position of the left upper corner of the rectangle (in pixels)dx
(mandatory) - Rectangle width (in pixels)dy
(mandatory) - Rectangle height (in pixels)rotateAngle
(optional) - Image rotation angle in degrees (rotation centre is in the middle of the defined rectangle). Examples:
0
(default) - no rotation90 - rotate by angle 90°
45 - rotate by angle 45°
-45 = 270 - rotate by angle 270°
10.125 - rotate by angle 10.125° flip (optional) - Flip drawing.
0
(default) - no flip1 - flip to vertical axis |
---|

Calling this method defines a rectangle of the drawing area in the mMap object, using the properties x, y, dx, dy. Then it is possible to define the desired action in the mMap object: rotateAngle and flip. The method executes the transformation of coordinates in order to move the left upper corner to (0,0) and then the rotation and flipping. Then the transformation adds the properties drawDx and drawDy into the mMap object. If you then draw into the rectangle with upper left corner located at (0,0) and with dimesions mMap.drawDx and mMap.drawDy, then you do not have to pay attention to shifting, rotating and flipping.

Rotation in square is quite simple (the rotate transformation can be used for example), but rotation in rectangle is done in this method so if the rotation angle is 90° then the image is**deformed** (longer or shorter).

This method is just a special case of the transform method. In case the designer wanted to make this transformation by the transform method, it would be very difficult - the computations related to deformation rotation are quite mathematicaly complex.

This method is also functional in Web panels.

Rotation in square is quite simple (the rotate transformation can be used for example), but rotation in rectangle is done in this method so if the rotation angle is 90° then the image is

This method is just a special case of the transform method. In case the designer wanted to make this transformation by the transform method, it would be very difficult - the computations related to deformation rotation are quite mathematicaly complex.

This method is also functional in Web panels.

Allocate the drawing area where the image will be rotated 45° clockwise and flipped vertically

The ctx variable represents the drawing canvas (CanvasCtx). The setup is done on the "Draw" tab at the beginning of the script of drawing event onDraw as follows:
var ctx = pEvent.GetCtx(1);

JavaScriptSelect and copy to clipboard

```
```

var ctx = pEvent.GetCtx(0);

// ...

var mMap = Pm.CreatePmMap();

mMap.x = 10;

mMap.y = 10;

mMap.dx = 90;

mMap.dy = 90;

mMap.rotateAngle = 45;

mMap.flip = 1;

pEvent.CtxExt.prepareDrawRect(mMap);

// detect new coordinates of the area dx and dy after transformation

var dx = mMap.drawDx;

var dy = mMap.drawDy;

// ...anything that will be drawn in the area 0 - dx and 0 - dy, will be shifted, flipped and rotated in the resulting drawing.

Send page remarkContact responsible person