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

  • bringToFront(): void
  • Bring active object to front of canvas.

    Returns void

delete

  • delete(): void
  • Delete currently active object.

    Returns void

deselect

  • deselect(): void
  • Deselect active object.

    Returns void

duplicate

  • duplicate(): void
  • Duplicate active object.

    Returns void

flipHorizontal

  • flipHorizontal(): void
  • Flip active object horizontally.

    Returns void

get

  • get(): Object
  • Get currently active object.

    Returns Object

getId

  • getId(): any
  • Get ID for currently active object.

    Returns any

getValue

  • getValue(name: keyof IObjectOptions): any
  • Get value for specified object option.

    Parameters

    • name: keyof IObjectOptions

    Returns any

isEditing

  • isEditing(): boolean
  • Check if active object (like text) is currently being edited by user.

    Returns boolean

move

  • move(direction: "top" | "right" | "bottom" | "left", amount: number): void
  • Move currently active object on canvas in specified direction.

    Parameters

    • direction: "top" | "right" | "bottom" | "left"
    • amount: number

    Returns void

on

  • on(eventName: string, handler: function): void
  • Listen to specified object event.

    Parameters

    • eventName: string
    • handler: function
        • (e: IEvent): void
        • Parameters

          • e: IEvent

          Returns void

    Returns void

select

  • select(obj: Object): void
  • Set specified object as new active object.

    Parameters

    • obj: Object

    Returns void

sendToBack

  • sendToBack(): void
  • Send active object to the back of canvas.

    Returns void

setValues

  • setValues(values: ITextOptions): void
  • Set specified options on currently active object.

    Parameters

    • values: ITextOptions

    Returns void