Class: InkModelOperation
InkModelOperation()
Ink Model structure update descriptor
Constructor
new InkModelOperation()
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
data | InkModelOperation.Descriptor | Ink model operation data | |
strokes | JSON.<InkModelOperation.StrokeID, Stroke> | <optional> | Strokes subset, related with the operation (Not available for transition operation only) |
order | JSON.<InkModelOperation.StrokeID, InkModelOperation.StrokeID> | <optional> | Describes strokes order,where key is an affected strokeID and value is a strokeID of the previous stroke in the ink model (Applicable for addition and removal operations) |
addition | Array.<InkModelOperation.StrokeID> | Added strokes | |
removal | Array.<InkModelOperation.StrokeID> | Removed strokes | |
updates | Array.<InkModelOperation.UpdateDescriptor> | Updated strokes props | |
splits | Array.<InkModelOperation.SplitDescriptor> | Split strokes data | |
unions | Array.<InkModelOperation.UnionDescriptor> | Union strokes data | |
transformation | InkModelOperation.TransformationDescriptor | Points transformation descriptor | |
transition | InkModel.InkModel | Refers transition to a new ink model |
Methods
add(stroke, previous, indexopt)
Register chunk for operation ADDITION
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
stroke | Stroke | Add operation target | ||
previous | Stroke|InkModelOperation.StrokeID | Defines stroke position, when there is no previous, stroke is first in the ink model | ||
index | int | <optional> | last element | Ink model strokes index |
close()
Close transaction
invert() → InkModelOperation
Inverts ink model operation
Returns:
Inverted operation
Type
open(current)
Define transactional operation
Parameters:
Name | Type | Description |
---|---|---|
current | InkModel |
remove(stroke, index)
Register chunk for operation REMOVAL
Parameters:
Name | Type | Description |
---|---|---|
stroke | Stroke | Remove operation target |
index | int | Ink model strokes index |
split(stroke, strokes)
Register chunk for operation SPLIT
Parameters:
Name | Type | Description |
---|---|---|
stroke | Stroke | Split operation target |
strokes | Array.<Stroke> | Data to be replaced in model |
transform(strokes, matrix, pipelinePathsopt, boundsopt) → InkModelOperation.CompleteTransform
Register TRANSFORMATION operation
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
strokes | Array.<Stroke> | Transform operation target | |
matrix | Common.Matrix | Transform matrix | |
pipelinePaths | Array.<PathBuilding.PipelineData> | <optional> | Path builded strokes rendering paths |
bounds | Common.Rect | <optional> | Bounds of transformation |
Returns:
After rendering path re-build this callback should be called to complete Transform operation definition
Type
InkModelOperation.CompleteTransform
transit(before, after)
Register TRANSITION operation
Parameters:
Name | Type | Description |
---|---|---|
before | InkModel | |
after | InkModel |
union(strokes, stroke)
Register chunk for operation UNION
Parameters:
Name | Type | Description |
---|---|---|
strokes | Array.<Stroke> | Union operation target |
stroke | Stroke | Data to be replaced in model |
update(stroke, descriptor)
Register chunk for operation UPDATE
Parameters:
Name | Type | Description |
---|---|---|
stroke | Stroke | Update operation target |
descriptor | InkModelOperation.StrokeUpdateDescriptor |
Type Definitions
CompleteTransform()
A delegate that completes transform operation definition
Descriptor
Describes whole operation with registered chunks
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
strokes | JSON.<InkModelOperation.StrokeID, Stroke> | <optional> | Strokes subset, related with the operation (Not available for transition operation only) |
order | JSON.<InkModelOperation.StrokeID, InkModelOperation.StrokeID> | <optional> | Describes strokes order, where key is affected stroke ID and value is a stroke ID of the previous stroke in the ink model (Applicable for addition and removal operations) |
addition | Array.<InkModelOperation.StrokeID> | <optional> | Added strokes |
removal | Array.<InkModelOperation.StrokeID> | <optional> | Removed strokes |
updates | Array.<InkModelOperation.UpdateDescriptor> | <optional> | Updated strokes props |
splits | Array.<InkModelOperation.SplitDescriptor> | <optional> | Split strokes data |
unions | Array.<InkModelOperation.UnionDescriptor> | <optional> | Union strokes data |
transformation | InkModelOperation.TransformationDescriptor | <optional> | Points transformation descriptor |
transition | InkModel.InkModel | <optional> | Refers transition to a new ink model |
SplitDescriptor
Properties:
Name | Type | Description |
---|---|---|
stroke | InkModelOperation.StrokeID | |
strokes | Array.<InkModelOperation.StrokeID> |
StrokeID
Stroke identifier
Type:
- string
TransformationDescriptor
Properties:
Name | Type | Description |
---|---|---|
matrix | Common.Matrix | |
strokes | Array.<InkModelOperation.StrokeID> | Affected strokes |
bounds | Common.Rect | Affected area in model coordinate system |
pipelinePaths | JSON.<InkModelOperation.StrokeID, PathBuilding.PipelineData> |
UnionDescriptor
Properties:
Name | Type | Description |
---|---|---|
strokes | Array.<InkModelOperation.StrokeID> | |
stroke | InkModelOperation.StrokeID |
UpdateDescriptor
Properties:
Name | Type | Description |
---|---|---|
stroke | InkModelOperation.StrokeID | |
descriptor | JSON.<InkModelOperation.UpdateType, InkModelOperation.UpdateValue> |
UpdateType
Update identifier. For example: color, blendMode, etc.
Type:
- string
UpdateValue
Update value. For example: If type is color, value is instance of Color.
Type:
- any