TagCloudItem.CurrentPosition

Syntax

CurrentPosition: Object

Description

The CurrentPosition property determines the current position of tag cloud item.

Comments

The object contains following fields:

Use JSON or the setCurrentPosition method to set the property value and the getCurrentPosition method to get the property value.

Example

To execute the example, the page must contain the TagCloud component named tagCloud (see Example of Creating the TagCloud Component). The example must be placed in the <script> tag. Get current position and color of the first cloud label:

// Get current color of the first label
var currentColor = tagCloud.getItems()[0].getCurrentColor();
console.log("Current color of the first label: R = " + currentColor.R + ", G = " + currentColor.G + ", B = " + currentColor.B);
// Get current color of the first label in hexadecimal
console.log("Current color of the first label in hexadecimal: " + tagCloud.getItems()[0].getCurrentColorInHex());
// Get current coordinates of the first label
var currentXYZ = tagCloud.getItems()[0].getCurrentPosition().Position;
console.log("Current coordinate X: " + currentXYZ.getX());
console.log("Current coordinate Y: " + currentXYZ.getY());
console.log("Current coordinate Z: " + currentXYZ.getZ());

As a result, current coordinates of position and current color of the first label of the cloud are displayed in the console:

Current color of the first label: R = 255, G = 70, B = 44

Current color of the first label in hexadecimal: #ff462c

Current coordinate X: 150

Current coordinate Y: -112.5

Current coordinate Z: 0

See also:

TagCloudItem