New online demos available.  

Command: setBackground

Allows for replacing a background image of a design opened in the editor. The image can be either taken from a specified URL or Customer's Canvas public gallery (in this case, the syntax is public:folder/filename.jpg).

NOTE: You should take care that the background has a correct DPI and dimensions, otherwise it may distort the design size.

Params

  • url - a URL to the image or a path in Customer's Canvas gallery with the public: prefix as explained in Customer's Canvas docs.
  • surfaceIndex - index of a surface which should be modified (current surface if omitted).
  • toTile - if true, the background image will tile the entire design. It is useful for pattern backgrounds. If false (default), the background size will become the product size.

Example

{
    "type": "gallery",
    "name": "bg",
    "params": {
        "items": [...]
    }
},
{
    "type": "canvas", 
    "name": "cc",
    "params": {
        "inital": { ... }, 
        "setBackground": {
            "url": "{{ $['bg']._.url }}"
        }
     }
}