Skip to main content

Class: InkModelOperation

InkModelOperation()

Ink Model structure update descriptor

Constructor

new InkModelOperation()

Properties:
NameTypeAttributesDescription
dataInkModelOperation.DescriptorInk model operation data
strokesJSON.<InkModelOperation.StrokeID, Stroke><optional>Strokes subset, related with the operation (Not available for transition operation only)
orderJSON.<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)
additionArray.<InkModelOperation.StrokeID>Added strokes
removalArray.<InkModelOperation.StrokeID>Removed strokes
updatesArray.<InkModelOperation.UpdateDescriptor>Updated strokes props
splitsArray.<InkModelOperation.SplitDescriptor>Split strokes data
unionsArray.<InkModelOperation.UnionDescriptor>Union strokes data
transformationInkModelOperation.TransformationDescriptorPoints transformation descriptor
transitionInkModel.InkModelRefers transition to a new ink model

Methods

add(stroke, previous, indexopt)

Register chunk for operation ADDITION

Parameters:
NameTypeAttributesDefaultDescription
strokeStrokeAdd operation target
previousStroke|InkModelOperation.StrokeIDDefines stroke position, when there is no previous, stroke is first in the ink model
indexint<optional>last elementInk model strokes index

close()

Close transaction

invert() → InkModelOperation

Inverts ink model operation

Returns:

Inverted operation

Type

InkModelOperation

open(current)

Define transactional operation

Parameters:
NameTypeDescription
currentInkModel

remove(stroke, index)

Register chunk for operation REMOVAL

Parameters:
NameTypeDescription
strokeStrokeRemove operation target
indexintInk model strokes index

split(stroke, strokes)

Register chunk for operation SPLIT

Parameters:
NameTypeDescription
strokeStrokeSplit operation target
strokesArray.<Stroke>Data to be replaced in model

transform(strokes, matrix, pipelinePathsopt, boundsopt) → InkModelOperation.CompleteTransform

Register TRANSFORMATION operation

Parameters:
NameTypeAttributesDescription
strokesArray.<Stroke>Transform operation target
matrixCommon.MatrixTransform matrix
pipelinePathsArray.<PathBuilding.PipelineData><optional>Path builded strokes rendering paths
boundsCommon.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:
NameTypeDescription
beforeInkModel
afterInkModel

union(strokes, stroke)

Register chunk for operation UNION

Parameters:
NameTypeDescription
strokesArray.<Stroke>Union operation target
strokeStrokeData to be replaced in model

update(stroke, descriptor)

Register chunk for operation UPDATE

Parameters:
NameTypeDescription
strokeStrokeUpdate operation target
descriptorInkModelOperation.StrokeUpdateDescriptor

Type Definitions

CompleteTransform()

A delegate that completes transform operation definition

Descriptor

Describes whole operation with registered chunks

Properties:
NameTypeAttributesDescription
strokesJSON.<InkModelOperation.StrokeID, Stroke><optional>Strokes subset, related with the operation (Not available for transition operation only)
orderJSON.<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)
additionArray.<InkModelOperation.StrokeID><optional>Added strokes
removalArray.<InkModelOperation.StrokeID><optional>Removed strokes
updatesArray.<InkModelOperation.UpdateDescriptor><optional>Updated strokes props
splitsArray.<InkModelOperation.SplitDescriptor><optional>Split strokes data
unionsArray.<InkModelOperation.UnionDescriptor><optional>Union strokes data
transformationInkModelOperation.TransformationDescriptor<optional>Points transformation descriptor
transitionInkModel.InkModel<optional>Refers transition to a new ink model

SplitDescriptor

Properties:
NameTypeDescription
strokeInkModelOperation.StrokeID
strokesArray.<InkModelOperation.StrokeID>

StrokeID

Stroke identifier

Type:
  • string

TransformationDescriptor

Properties:
NameTypeDescription
matrixCommon.Matrix
strokesArray.<InkModelOperation.StrokeID>Affected strokes
boundsCommon.RectAffected area in model coordinate system
pipelinePathsJSON.<InkModelOperation.StrokeID, PathBuilding.PipelineData>

UnionDescriptor

Properties:
NameTypeDescription
strokesArray.<InkModelOperation.StrokeID>
strokeInkModelOperation.StrokeID

UpdateDescriptor

Properties:
NameTypeDescription
strokeInkModelOperation.StrokeID
descriptorJSON.<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

Home