# Class: AdjustEvent

## AdjustEvent

#### new AdjustEvent(dom_attach, x, y, obj_name, ExitFunction, scale)

Creates the adjusting event

##### Parameters:

Name | Type | Description
--- | --- | ---
`dom_attach` | string | The html element where the polygon lives
`x` | array | The x coordinates for the polygon points
`y` | array | The y coordinates for the polygon points
`obj_name` | string | The name of the adjusted_polygon
`ExitFunction` | function | the_function to execute once adjusting is done
`scale` | float | Scaling factor for polygon points

Source:
  - adjust_event.js, line 14

### Methods

#### CenterOfMass()

Compute center of mass for a polygon given array of points (x,y):

Source:
  - adjust_event.js, line 451

#### MoveCenterOfMass(event)

This function is called when the middle grab point is being moved

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | event | Indicates the middle grab point is moving It modifies the control points to be consistent with the polygon shift

Source:
  - adjust_event.js, line 379

#### MoveControlPoint(event)

This function is called when one control point is being moved

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | event | Indicates a point is being moved and the index of such point

Source:
  - adjust_event.js, line 308

#### MoveScalingPoint(event)

This function is called when one scaling point is being moved It computes the position of the scaling point in relation to the polygon's center of mass and resizes the polygon accordingly

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | event | Indicates a point is being moved and the index of such point

Source:
  - adjust_event.js, line 221

#### RemoveCenterOfMass()

This function removes the middle grab point for a polygon

Source:
  - adjust_event.js, line 190

#### RemoveControlPoints()

This function removes the displayed control points for a polygon

Source:
  - adjust_event.js, line 165

#### RemoveScalingPoints()

This function removes the displayed scaling points for a polygon

Source:
  - adjust_event.js, line 143

#### ShowCenterOfMass()

This function shows the middle grab point for a polygon.

Source:
  - adjust_event.js, line 173

#### ShowControlPoints()

This function shows the control points for a polygon

Source:
  - adjust_event.js, line 151

#### ShowScalingPoints()

This function shows the scaling points for a polygon

Source:
  - adjust_event.js, line 131

#### StartEvent()

This function starts the adjusting event:

Source:
  - adjust_event.js, line 71

#### StartMoveCenterOfMass()

This function is called when the middle grab point is clicked It prepares the polygon for moving.

Source:
  - adjust_event.js, line 358

#### StartMoveControlPoint(i)

This function is called when one control point is clicked

##### Parameters:

Name | Type | Description
--- | --- | ---
`i` | int | the index of the control point being modified

Source:
  - adjust_event.js, line 287

#### StartMoveScalingPoint(i)

This function is called when one scaling point is clicked It prepares the polygon for scaling.

##### Parameters:

Name | Type | Description
--- | --- | ---
`i` | int | the index of the scaling point being modified

Source:
  - adjust_event.js, line 202

#### StopAdjustEvent()

This function stops the adjusting event and calls the ExitFunction:

Source:
  - adjust_event.js, line 113

#### StopMoveCenterOfMass(event)

This function is called when the middle grab point stops being moved It updates the xml with the new coordinates of the polygon.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | event | Indicates the middle grab point is being moved and the index of such point

Source:
  - adjust_event.js, line 420

#### StopMoveControlPoint(event)

This function is called when one control point stops being moved It updates the xml with the new coordinates of the polygon.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | event | Indicates a point is being moved and the index of such point

Source:
  - adjust_event.js, line 335

#### StopMoveScalingPoint(event)

This function is called when one scaling point stops being moved It updates the xml with the new coordinates of the polygon.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | event | Indicates a point is being moved and the index of such point

Source:
  - adjust_event.js, line 264