Active object service contains a number of useful methods for programmatically interacting with currently active canvas object (sticker, text, shape etc.)
var pixie = new Pixie({
onLoad: function() {
var activeObject = pixie.get('activeObject');
activeObject.setValues({
backgroundColor: 'blue',
opacity: 0.5
});
}
});
Methods
bringToFront
-
Returns void
delete
-
Delete currently active object.
Returns void
deselect
-
Deselect active object.
Returns void
duplicate
-
Duplicate active object.
Returns void
flipHorizontal
-
Flip active object horizontally.
Returns void
get
-
Get currently active object.
Returns Object
getId
-
Get ID for currently active object.
Returns any
getValue
-
Get value for specified object option.
Parameters
-
name: keyof IObjectOptions
Returns any
-
isEditing
-
Check if active object (like text) is currently being edited by user.
Returns boolean
move
-
Move currently active object on canvas in specified direction.
Parameters
-
direction: "top" | "right" | "bottom" | "left"
-
amount: number
Returns void
-
on
-
Listen to specified object event.
Parameters
-
eventName: string
-
handler: function
-
-
Parameters
-
e: IEvent
Returns void
-
-
-
Returns void
-
select
-
Set specified object as new active object.
Parameters
-
obj: Object
Returns void
-
sendToBack
-
Send active object to the back of canvas.
Returns void
setValues
-
Set specified options on currently active object.
Parameters
-
values: ITextOptions
Returns void
-
Bring active object to front of canvas.