Skip to content

editor / freeShapeWithPoint

Function: freeShapeWithPoint() ​

freeShapeWithPoint(shape, index, point): FreeShape

Defined in: model/free-shape-with-point.ts:31

Free shape after one of its points is typed in the coordinates of the SVG (ADR-0033): its corners are kept as drawn, that point replaced, and its width and height become the box around the points, so that stretching it later stays without loss. On a turned shape the point typed is turned back into the straight shape, and the new box placed so that the other points stay where they are drawn (ADR-0035, DERIV-turned-shape step 5); the integer typed then holds in the drawing, within a rounding error.

Parameters ​

shape ​

FreeShape

valid free shape (isValidFreeShape)

index ​

number

number of the point, from 0

point ​

Point

its new place as drawn: each coordinate typed is an integer, one not typed keeps its drawn value

Returns ​

FreeShape

the free shape with the point moved, to check with isValidFreeShape (points with no width or no height between them are refused); an index out of range moves nothing but rebases the shape on its drawn corners

Kind ​

domain

See ​

docs/domain/interaction.md#_3-node-editing