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:
Methods
CenterOfMass()
Compute center of mass for a polygon given array of points (x,y):
- Source:
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:
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:
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:
RemoveCenterOfMass()
This function removes the middle grab point for a polygon
- Source:
RemoveControlPoints()
This function removes the displayed control points for a polygon
- Source:
RemoveScalingPoints()
This function removes the displayed scaling points for a polygon
- Source:
ShowCenterOfMass()
This function shows the middle grab point for a polygon.
- Source:
ShowControlPoints()
This function shows the control points for a polygon
- Source:
ShowScalingPoints()
This function shows the scaling points for a polygon
- Source:
StartEvent()
This function starts the adjusting event:
- Source:
StartMoveCenterOfMass()
This function is called when the middle grab point is clicked
It prepares the polygon for moving.
- Source:
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:
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:
StopAdjustEvent()
This function stops the adjusting event and calls the ExitFunction:
- Source:
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:
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:
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: