LC.util.addImageOnload(image, callback)

Ensures callback is called when the image loads, without replacing any existing callbacks.

LC.util.classSet({className: bool})

Replaces React.addons.classSet.

LC.util.combineCanvases(a, b)

A canvas containing b rendered on top of a, sized to contain both a and b.[]


window.devicePixelRatio if it exists and is greater than 1; otherwise, returns 1.

  • rects – List of dicts with keys {x, y, width, height}.


The smallest rectangle that contains the given rectangles, in the form {x, y, width, height}.


a globally unique ID string

LC.util.last(array, n=null)

Get the last element of an array. Pass n to get a list of the last n elements.

LC.util.matchElementSize(elementToMatch, elementsToResize, scale, callback=null)
  • elementToMatch – DOM element whose size should be matched by elementsToResize

  • elementsToResize – Array of DOM elements to update

  • scale – Amount to scale width and height attributes if one of elementsToResize is a canvas element

  • callback – Function to be called after each resize event

Keep elementsToResize the same size as elementToMatch. If one of elementsToResize is a <canvas>, set its width and height properties to the element’s size multiplied by scale. (This is necessary for environments with devicePixelRatio != 1.)

LC.util.getDefaultImageRect(shapeBoundingRects, explicitSize={width: 0, height: 0}, margin={top: 0, right: 0, bottom: 0, left: 0})

Returns the effective bounds of the canvas. Mostly used as a convenient way to limit the scope of a potentially infinite tool. (For example, a paint bucket shouldn’t fill infinite pixels.)

LC.util.renderShapes(shapes, bounds, scale=1, canvas=null)

Deprecated since version 0.4.5.

Duplicate of LC.renderShapesToCanvas()