The type of the element.
The element's view type, if any.
The element's model type, if any.
The element's emitter type, if any.
The type of the element.
The element's view type, if any.
The element's model type, if any.
The element's emitter type, if any.
The element to attach to, plus the constrainer name, priority, active state, and activation callbacks.
ReadonlyconstrainerReadonlysolversReadonlycheckersReadonlymutatorsThe list of objects constrained by the constrainer. To manipulate, check GradumNodeList. Defaults to the children of the element the constrainer is attached to.
The list of objects that trigger the constrainer to resolve. Interacting with any of these objects would typically lead to the solving of the given constrainer. To manipulate, check GradumNodeList. Defaults to the objects in this.objectList.
Function
initialize
Initialization function that calls GradumSelector.makeConstrainer on this.element, sets
it up, and attaches all the defined solvers.
Function
getObjectData
The object to query.
The stored data object (or an empty object if none).
Function
setObjectData
The object to update.
Optionaldata: Record<string, any>
The new data object to associate with this object.
Itself, allowing for method chaining.
Function
addChecker
Configuration object, including the
checker callback to be executed, the name of the checker to access it later, the name of the attached
constrainer, and the priority of the checker.
Itself, allowing for method chaining.
Function
check
Optionalproperties: ConstrainerCallbackProperties
Context passed to each checker.
Whether the constrainer passes all checks.
Function
addMutator
Configuration object, including the
mutator callback to be executed, the name of the mutator to access it later, and the priority of the mutator.
Itself, allowing for method chaining.
Function
mutate
The type of the value to mutate
Optionalproperties: ConstrainerMutatorProperties<Type>
Context object, including the
mutation to execute, and the input value to mutate.
The mutated result.
Function
addSolver
Configuration object, including the
solver callback to be executed, the name of the solver to access it later, and the priority of the solver.
Itself, allowing for method chaining.
Function
solve
Optionalproperties: ConstrainerCallbackProperties = {}
Options object to configure the context.
Itself, allowing for method chaining.
ProtectedsetupProtectedsetupProtectedsetup
GradumConstrainer
Description
Keeps a set of objects satisfying a constraint. Attach one to an element and it watches a list of objects, and whenever a trigger object is interacted with it runs the solvers declared with
@solveruntil the constraint holds again — capped bymaxPassesso propagation cannot cycle forever. Checkers (@checker) report whether the constraint already holds; mutators (@mutator) adjust values as part of resolving.