Object Property Updates
Overview
Use updateObjectProperty for single-path updates, or updateObjectProperties to apply multiple changes in one call. Batched updates are recorded as a single history entry.
API
updateObjectProperty
editor.updateObjectProperty(objectId, 'style.fill', '#ff0000')
updateObjectProperties
editor.updateObjectProperties(objectId, {
'style.fill': '#ff0000',
'style.stroke': '#000000',
})
Behavior
- Unknown object IDs are ignored.
updateObjectPropertiesgroups the changes into one undo step.
Get Objects by ID
const objects = editor.getObjects([rect.id, circle.id])
- Missing IDs are skipped.
- Returned order matches the ID array order.
Example
const rect = editor.addShape('rect', {
x: 60,
y: 60,
width: 120,
height: 90,
fill: '#0a0a0a',
})
editor.updateObjectProperties(rect.id, {
'style.fill': '#1a1a1a',
'style.stroke': '#ffffff',
})