Page

Vecta.Page

new Vecta.Page(node)

Vecta page object.

In a Vecta application, each Vecta.Document can have multiple pages, where each page is represented by a Vecta.Page object.

NameTypeDescription
nodeSVGElement

The svg element for the page

Properties

.$jQuery

The jQuery wrapped node for the page.

NameTypeDescription
$jQuery

jQuery wrapper for page node.

Methods

.close()

Close a loaded page.

Closing differs from deleting, as closing is just unloading a page.

If invoked on current active page, an exception is thrown.

Examples:
var prev_id = Vecta.activePage.id(),
    page = Vecta.activeDoc.insertPage();

page.close(); // Current active page could not be removed.

Vecta.activeDoc.loadPage(prev_id).then(function() {
     // page is removed from DOM
     page.close();
});

.delete()

Delete a page.

.hitTest(x, y) Returns: Vecta.Shape|null

Get the shape at a given coordinate.

NameTypeDescription
xnumber|string

Coordinate point of x

ynumber|string

Coordinate point of y

Returns:

Returns Vecta.Shape if found, else return null

.index() Returns: number

Obtain the index of the page, read only.

Returns:

Returns page index.

Examples:
console.log(Vecta.activePage.index()); //0

.zoomTo(percent, [shape]) Returns: Vecta.Page

Set zoom level for the page and position the center of viewport to the given shape, if supplied.

The zoom level will be rounded to the nearest level permissible by Vecta, as listed at the bottom right of your editor.

NameTypeAttributesDescription
percentinteger|float|string

Zoom level (%)

shapeobjectoptional

The shape to where the viewport should be centered

Examples:
Vecta.activeDoc.zoomTo(50);
Vecta.activeDoc.zoomTo('50%');
Vecta.activeDoc.zoomTo('50%', shape);