PP.normalizeSize

Syntax

normalizeSize(size: PP.Point, basis: PP.Point, isAbsolute: Boolean);

Parameters

size. Initial size.

basis. Basis size.

isAbsolute. Indicates if size is normalized by specified basis. If this parameter is set to True the method returns initial size, if the parameter is False the method returns normalized size.

Description

The normalizeSize method normalizes the size by specified basis.

Comments

This method returns a PP.Point value.

Example

To execute the example, the HTML page must contain links to the PP.js and PP.GraphicsBase.js scenario files. Normalize the size (8, 6) by the basis (2, 3):

// Set source size
var sourcePoint = new PP.Point(8, 6);
console.log("Source length: " + sourcePoint.getX() + ", width: " + sourcePoint.getY());
// Set the size that is basis
var basisPoint = new PP.Point(2, 3);
console.log("Basis length: " + basisPoint.getX() + ", width: " + basisPoint.getY());
// Normalize source size by basis
var normalizePoint = PP.normalizeSize(sourcePoint, basisPoint, False);
console.log("Normalized length: " + normalizePoint.getX() + ", width: " + normalizePoint.getY());

After executing the example the browser console displays initial and normalized sizes, and the normalization basis:

Initial length: 8, width: 6
Basis length: 2, width: 3
Normalized length: 16, width: 18

See also:

PP