Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
IStroke interface
- Package:
- @microsoft/live-share-canvas
Defines a stroke, i.e. a collection of points that can be rendered on a canvas.
Properties
| brush | The brush used to draw the stroke. |
| clientId | Optional. The id of the client the stroke was created on. |
| id | The id of the stroke. |
| length | The number of points in the stroke. |
| timeStamp | The timestamp when the stroke was created. |
Methods
| addPoints(IPointerPoint[]) | Adds points to the stroke. |
| deserialize(string) | Deserializes the specified stroke string and sets this stroke's brush, points and other proprties accordingly. |
| getAllPoints() | Gets a copy of all the points in the stroke. |
| getBoundingRect() | Computes the stroke's bounding rectangle. |
| getIntersectionPoints(ISegment) | Computes the intersection points between the stroke and the specified segment. |
| getPointAt(number) | Gets the point at the given index. |
| intersectsWithRectangle(IRect) | Determines if the stroke intersects with the specified rectangle. |
| pointErase(IRect) | Splits this stroke into several other ones by "erasing" the portions that are within the eraser rectangle. |
| serialize() | Serializes the stroke to a string. |
Property Details
brush
clientId
Optional. The id of the client the stroke was created on.
clientId?: string
Property Value
string
id
The id of the stroke.
id: string
Property Value
string
length
The number of points in the stroke.
length: number
Property Value
number
timeStamp
The timestamp when the stroke was created.
timeStamp: number
Property Value
number
Method Details
addPoints(IPointerPoint[])
Adds points to the stroke.
function addPoints(points: IPointerPoint[]): boolean
Parameters
- points
The points to add.
Returns
boolean
deserialize(string)
Deserializes the specified stroke string and sets this stroke's brush, points and other proprties accordingly.
function deserialize(serializedStroke: string)
Parameters
- serializedStroke
-
string
The serialized stroke.
getAllPoints()
Gets a copy of all the points in the stroke.
function getAllPoints(): IPointerPoint[]
Returns
getBoundingRect()
getIntersectionPoints(ISegment)
getPointAt(number)
Gets the point at the given index.
function getPointAt(index: number): IPointerPoint
Parameters
- index
-
number
The point index.
Returns
intersectsWithRectangle(IRect)
Determines if the stroke intersects with the specified rectangle.
function intersectsWithRectangle(rectangle: IRect): boolean
Parameters
- rectangle
- IRect
The rectangle to test against.
Returns
boolean
pointErase(IRect)
serialize()
Serializes the stroke to a string.
function serialize(): string
Returns
string
Feedback
Was this page helpful?
