Qunee for HTML5 - English : Other properties and methods

Other properties and methods

  • Invalid component, redraw canvas -invalidate()
  • set the maximum update rate - setMaxFPS(fps)
  • traverse visible element - forEachVisibleUI(call, scope)
  • Acquire element at mouse point position - getElementByMouseEvent(evt) → {Element}
  • Acquire element by name - getElementByName(name) → {Element}
  • Move element position - moveElements(elements, dx, dy)
  • Export canvas - exportImage(scale, clipBounds) → {Object}
  • Whether elements are visible - isVisible(item) → {Boolean} 

Example

Exports the canvas to images, and displays at new webpage 

function exportImage(graph, scale, clipBounds) {
    var imageInfo = graph.exportImage(scale, clipBounds);
    if (!imageInfo || !imageInfo.data) {
        return false;
    }
    var win = window.open();
    var doc = win.document;
    doc.title = "export image - " + imageInfo.width + " x " + imageInfo.height;
    var img = doc.createElement("img");
    img.src = imageInfo.data;
    doc.body.appendChild(img);
}