new Vecta.Guide([node], [orient])
Vecta Guide object.
Name | Type | Attributes | Description |
---|---|---|---|
node | string|Element | optional | A valid string ID for the guide or the guide node or JQuery object. If null or undefined, will create a new guide. |
orient | boolean | optional | False or undefined for horizontal guides, and true for vertical guides |
Examples:
var guide = new Vecta.Guide(null, true); //creates a vertical guide
Properties
.$jQuery
The jQuery wrapped node for the guide.
Name | Type | Description |
---|---|---|
$ | jQuery | jQuery wrapper for guide node. |
Methods
.delete()
Delete a guide from the page.
.id() Returns: string
Get the guide id. Read only.
Returns:
Returns the guide ID.
.move([x], [y]) Returns: Object|Vecta.Guide
Get or set position of guide.
For get operations, both x and y must be undefined or not provided. If any one of the parameters is provided, then it is considered a set operation.
For set operations, if either x or y is not provided, then the current value is used in replacement. Both x and y can be numbers (px) or valid length strings, eg: 1in, 1 mm, 10 px.
If any of the provided parameters is an invalid length, then the operation fails with an error message in console.
Name | Type | Attributes | Description |
---|---|---|---|
x | number|string | optional | X coordinate of guide. |
y | number|string | optional | Y coordinate of guide. |
Returns:
Returns the x and y coordinates if get or Vecta.Guide if set.
For get operations, the returned object will be in the following format:
{x: number|string, y: number|string}
where the type for x and y coordinates may be in numbers (px) or valid length strings.
Examples:
var guide = new Vecta.Guide('#123');
guide.move(0, 10); //move the horizontal guide to 10px
console.log(guide.move()); //{x: 0, y: 10}
.page() Returns: Vecta.Page
Get the guide's containing page.
Returns:
Returns a Vecta.Page object containing the current guide.
Examples:
var guide = new Vecta.Guide('#123');
console.log(guide.page.id()); //displays the guide's containing page id