PERGOLA LOGO

pergola.Doc

System events: YES.

User events and functions: NO.

System component. An instance of this class is a component object and cannot be an orphan object. Its basic function is to embed transformable content of any type (artwork, maps, etc.) and external SVG documents and fragments. It is enabled to create layers, and the default content layer is referenced by the transformable property, which is the target of transformation tools (including scroll bars and container resizing). pergola.Window and pergola.ComboBox instantiate this class. You don't normally need to instantiate this class explicitly, but it's quite common in applications to query its properties and invoke its methods from external scopes.

Listed: class properties/methods; prototype properties and methods; instance properties. Prototype properties and methods inherited by the Class superclass are not listed.

class

None

prototype

PROPERTIES

parent

null. Must be overridden.

scaleFactor

1 – number.

maxScale

64 – number.

minScale

0.03125 – number.

autoscrollValue

6 – number.

METHODS

append(object)

object.newDoc (required) specifies the document or fragment to be appended; new content is appended to object.container, if specified, or to this transformable; if object.resetScale is specified, this transformable scale will be reset to 1; if object.merge is specified, new content will be added to existing content, otherwise existing content (nodes and references) will be deleted. See also pergola.loadSVG, which invokes this method.

centerCanvas()

Forces centering of this canvas.

dblclick(evt)

Handles double click for map zoom. Do not invoke explicitly.

flush(layer)

Remove all contents of specified layer node.

getOffset()

Returns an object with x and y number properties representing the absolute x,y position of this transformable.

getVisibleCenter()

Returns an object with x and y number properties representing the visible horizontal and vertical center respectively, computed from to sliders' position.

height()

Returns a number relative to this owner layout geometry.

horScrollSliderSync()

System. Synchronization of horizontal scrollbar slider. Invoked on user activity and content updates. Do not invoke explicitly.

hRatio()

Returns a number representing the ratio between this scaledH and this owner.vScrollBar.range (vertical ScrollBar).

matrixTransformApply()

Sets the "transform" attribute of this transformable to this ctm.

mousewheel(evt)

Handles scaling or scrolling with the mouse wheel depending on the value of this owner.mousewheel string property, which can get the values "zoom", "scroll", or "" (empty string). You don't normally need to invoke this method explicitly.

overflow(v[, min, max])

Overflow test for zooming by input. v is the input value. If min is specified, it represents the value of the Input object's min property; if not specified, the value of this minScale is used. If max is specified, it represents the value of the Input object's max property; if not specified, the value of this maxScale is used.

resizeButtonDisplay()

Resize button synchronization. Do not invoke explicitly.

scale(point)

point is an object with x and y number properties (typically pointer's x,y). If point is not specified, point gets the return value of this zoomPointIsCenter(). Applies scaling about point. You don't normally need to invoke this method explicitly.

scrollBarsDisplay()

Scrollbars synchronization. Do not invoke explicitly.

scrollRange()

Returns an object with minX and minY properties representing minimal values for this autoScroll().

setBackground()

If this docBgResizable, sets the "width" and "height" attributes of this transformable to values relative to this transformable bounding box if this scaledW and this scaledH are greater than this visibleW and this visibleH, or to computed values that cover the visible region. This method is strictly for internal use. Do not invoke explicitly.

transformUpdate()

Invoked on mutations and transformations of this transformable and/or of this owner container.

updateOnMutation()

Updates internal geometry.

updatePreview()

Updates the clone of this transformable for window tab preview. Do not invoke explicitly.

vertScrollSliderSync()

System. Synchronization of vertical scrollbar slider. Invoked on user activity and content updates. Do not invoke explicitly.

width()

Returns a number relative to this owner layout geometry.

wRatio()

Returns a number representing the ratio between this scaledW and this owner.hScrollBar.range (horizontal ScrollBar).

zoomPointIsCenter()

Returns an object with x and y number properties representing the compensated horizontal center of this visibleW and this this visibleH respectively.

zoomPointIsMouse(point)

point is the return value of pergola.mousePoint(). Returns an object with x and y number properties representing the offsets in relation to this owner x and y respectively.

zoomFromValue(v)

v specifies percentage in the range 3.13–6400.

handleEvent(evt)

build([object])

this inherits the properties specified in object; prototype properties specified in object are overridden. Creates elements and instance properties. Returns this.

instance

name

String. If not passed to the constructor, gets a generated XML name (Class).

id

String. The return value of this name.toXML(). This container ID. Used as prefix where other elements' IDs are attributed.

owner

Must be specified in the initialization object. Designates the owner object.

canvas

Object with width and height number (user space units) properties representing this transformable bounding box width and height, respectively. Do not override (dynamically updated).

docBgResizable

This boolean determines whether this background should be resized on transformations. Must be specified in the initialization object if this owner is resizable. The pergola.Window resizable and docBgResizable prototype properties are set to true. This property therefore is either inherited from this owner, or resolves to false.

scaledW

Number (user space units). This canvas.width multiplied by this scaleFactor. Do not override (dynamically updated).

scaledH

Number (user space units). This canvas.height multiplied by this scaleFactor. Do not override (dynamically updated).

visibleW

Number (user space units). The value returned by this width(). Do not override (dynamically updated).

visibleH

Number (user space units). The value returned by this height(). Do not override (dynamically updated).

ctm

Object representing the Transformation Matrix of this transformable. Initial:

 {
    a: 1,
    b: 0,
    c: 0,
    d: 1,
    e: 0,
    f: 0
  }

The properties are dynamically updated, and their values are dependable, for example, where this.ctm.f returns the same value across the implementations, this.transformable.getCTM().f does not. If you need to set any of the properties, the appropriate transformations must be applied by calls to this scale (if a and/or d are set), or to this matrixTransformApply, horScrollSliderSync, and this vertScrollSliderSync (if e and/or f are set). Note however that transformations are best left to the user, with the implemented transformation tools.

selection

Array. Storage for selected objects in editing applications.

container

<svg> element.

transformable

<g> element. Default layer for appended content.

background

<rect> element. This element is created to ensure that this container always has an event.target for the registered events, independently of loaded or manually appended content. The <rect> is subject to transformations if this docBgResizable is true.

currentTool

Reference to selected tool.