Class: Tooltip

caph.ui.base.component. Tooltip

new Tooltip(property)

A class which provides a tooltip box when component gains focus.

Parameters:
Name Type Description
property Object

An object which initializes this component. Refer to the details in caph.ui.base.Component constructor.

Tooltip Details
{String} text A string of HTML to set as the content of the tooltip.
{String} tailDirection (Optional) Determines the tooltip tail direction. Default value is "caph.ui.base.component.Tooltip.BOTTOM". The "tailDirection" property value is added to the text area in tooltip as class name.
{String} tailAlign (Optional) Determines the tooltip tail alignment. Default value is "caph.ui.base.component.Tooltip.CENTER".
{Number} timeout (Optional) A number Indicates how long the tooltip is shown. Default value is 5000ms. If timeout is 0, do not disappear tooltip before calling the hide method.
{String} textClassName (Optional) Determines the text area class name in tooltip. Default value is "caph-tooltip-text".
{String} tailClassPrefixName (Optional) Determines the tail area class prefix name in tooltip. Default value is "caph-tooltip-tail-". The class name concatenating the "tailClassPrefixName" and "tailDirection" property value is added to the tail area in tooltip.

Since:
  • 2.0.0
Example
var Tooltip = caph.ui.base.component.Tooltip;
 
 var tooltip = new Tooltip({
     text: 'Tooltip Test',
     tailDirection: Tooltip.BOTTOM,
     tailAlign: Tooltip.CENTER,
     timeout: 2000,
     size: [200, 50],
     position: [10, 10, 0]
 });
 

Extends

Members

<static> BOTTOM

A string indicates that tooltip tail alignment is center.

Since:
  • 2.0.0
Example
var Tooltip = caph.ui.base.component.Tooltip;
 
 var tooltip = new Tooltip({
     text: 'Tooltip Test',
     tailDirection: Tooltip.BOTTOM,
     tailAlign: Tooltip.CENTER,
     size: [200, 50]
 });

<static> BOTTOM

A string indicates that tooltip tail direction or alignment is bottom.

Since:
  • 2.0.0
Example
var Tooltip = caph.ui.base.component.Tooltip;
 
 var tooltip = new Tooltip({
     text: 'Tooltip Test',
     tailDirection: Tooltip.BOTTOM,
     tailAlign: Tooltip.RIGHT,
     size: [200, 50]
 });

<static> LEFT

A string indicates that tooltip tail direction or alignment is left.

Since:
  • 2.0.0
Example
var Tooltip = caph.ui.base.component.Tooltip;
 
 var tooltip = new Tooltip({
     text: 'Tooltip Test',
     tailDirection: Tooltip.LEFT,
     tailAlign: Tooltip.TOP,
     size: [200, 50]
 });

<static> RIGHT

A string indicates that tooltip tail direction or alignment is right.

Since:
  • 2.0.0
Example
var Tooltip = caph.ui.base.component.Tooltip;
 
 var tooltip = new Tooltip({
     text: 'Tooltip Test',
     tailDirection: Tooltip.RIGHT,
     tailAlign: Tooltip.BOTTOM,
     size: [200, 50]
 });

<static> TOP

A string indicates that tooltip tail direction or alignment is top.

Since:
  • 2.0.0
Example
var Tooltip = caph.ui.base.component.Tooltip;
 
 var tooltip = new Tooltip({
     text: 'Tooltip Test',
     tailDirection: Tooltip.TOP,
     tailAlign: Tooltip.LEFT,
     size: [200, 50]
 });

Methods

_offset(x, y, z) → {caph.module.renderer.View|Object}

Set or get offset position from root view.

Parameters:
Name Type Description
x Number

The number is offset position about x axis. (from root view)

y Number

The number is offset position about y axis. (from root view)

z Number

The number is offset position about z axis. (from root view)

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an offset position from root view.

Type
caph.module.renderer.View | Object
Example
var View = caph.module.renderer.View;
 var view1 = new View();
 var view2 = new View();

 view1.position(100, 200).mount();
 view2.position(50, 100).addTo(view1);
 view2._offset(view1_offset());

addChild(node) → {caph.module.renderer.VDom}

Adds the given node or array of nodes to this node's children.

Parameters:
Name Type Description
node caph.module.renderer.VDom | Array.<VDom>

VDom node to add.

Since:
  • 2.0.0
Inherited From:
See:
  • collection.TreeNode.addChild
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var vdom1 = new VDom(), vdom2 = new VDom();
vdom1.addChild(vdom2);

addClass(className) → {caph.module.renderer.VDom}

Adds a class to this object's list of classes. If class already exists in the list, it will not be added.

Parameters:
Name Type Description
className String

A string variable representing a class name or space-delimited class names.

Since:
  • 2.0.0
Inherited From:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var vdom = new VDom();
vdom.addClass('class1');
vdom.addClass('class2 class3 class4');

destroy()

Destroys itself and all its children, which makes them available for garbage collection and means they can't be reused.

Since:
  • 2.0.0
Inherited From:
Example
var VDom = caph.require('module.renderer.VDom');
var vdom = new VDom();
vdom.destroy();

getARIA() → {Object}

Get values about accessibility.

Since:
  • 2.0.0
Inherited From:
Returns:
Type
Object
Example
//Set uiComponent's accessibility value
uiComponent.setARIA({
     role : 'button',
     title : 'button'
});

// return object like this :
//   { role : button, title : button }
uiComponent.getARIA();

getProperty(attributeName) → {String|Number}

Gets the current value of the given attribute name.

Parameters:
Name Type Description
attributeName String

An attribute name to correspond to the one in Element in Web API Interfaces. (@link https://developer.mozilla.org/en-US/docs/Web/API/element#Properties)

Since:
  • 2.0.0
Inherited From:
Returns:

The value of the given attribute name.

Type
String | Number
Example
var VDom = caph.require('module.renderer.VDom');
var id, vdom = new VDom();
vdom.setProperty({ id : 'test' });
id = vdom.getProperty('id');

getStyle(styleName) → {String|Number}

Gets the current value of the given style name.

Parameters:
Name Type Description
styleName String

A style name to correspond to the one of ElementCSSInlineStyle. (@link http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle)

Since:
  • 2.0.0
Inherited From:
Returns:

The value of the given style name.

Type
String | Number
Example
var VDom = caph.require('module.renderer.VDom');
var bgColor, vdom = new VDom();
vdom.setStyle({ backgroundColor : 'blue' });
bgColor = vdom.getStyle('backgroundColor');

hasClass(className) → {Boolean}

Checks if this object's list of classes contains a specific class.

Parameters:
Name Type Description
className String

A string variable representing a class name or space-delimited class names.

Since:
  • 2.0.0
Inherited From:
Returns:
Type
Boolean
Example
var VDom = caph.require('module.renderer.VDom');
var result, vdom = new VDom();
vdom.addClass('class1 class2 class3 class4');
result = vdom.hasClass('class1');
result =  vdom.hasClass('class3 class4');

hide() → {caph.ui.base.component.Tooltip}

Hides the tooltip. The "show" class name is removed from the tooltip.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.hide();

innerHTML(HTML) → {String}

Sets innerHTML of component or gets innerHTML of component

Parameters:
Name Type Description
HTML String

String

Since:
  • 2.0.0
Inherited From:
Returns:

HTML String

Type
String
Example
var HTMLComponent = caph.require('ui.base.component.Html');
var uiComponent = new HTMLComponent();
uiComponent.innerHtml('<div>hellow world</div>);

isEnable() → {boolean}

Get state for enabled.

Since:
  • 2.0.0
Inherited From:
Returns:
Type
boolean
Example
//enabled flag change to false.
uiComponent.setEnable(false);

//return false
uiComponent.isEnable();

//enabled flag change to true
uiComponent.setEnable(true);

//return true
uiComponent.isEnable();

mount(target) → {caph.module.renderer.VDom}

Gets a vdom mounted in a HTML element. Currently this function can be called only once.

Parameters:
Name Type Argument Description
target String | HTMLElement | function <optional>

A HTML element where the given root node mounts, a function returning a HTML element, or else, a string describing element's id. If not defined, document.body is set as default.

Since:
  • 2.1.0
Inherited From:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var node = new VDom();
node.mount(document.body);

off(type)

Removes user message handlers which handle the matched message type.

Parameters:
Name Type Description
type Array.<String> | String

An array of message type or a message type to be removed. The value is always treated as lowercase.

Since:
  • 2.0.0
Inherited From:
Example
uiComponent.off(['click', 'keydown']);
 uiComponent.off('click');

on(handler)

Adds user message handlers which handle the matched message type. The message type must be a lowercase string. If you add a message handler to the corresponding type, the handler name will have "_on" prefix. For example if you add a "click" message handler, the handler name will become "_onclick". By default, the corresponding event handler functions of which name have "on" prefix calls these "_on" functions. So if you override the event handler functions when you inherit "caph.ui.base.Component", should be aware of this mechanism.

Parameters:
Name Type Description
handler Object

A set of key/value pairs that handles the matched message type.

Details
{String} type The name of message type. This string must be lowercase.
{Function} handler A function to execute when the message is received.

Since:
  • 2.0.0
Inherited From:
See:
Example
uiComponent.on({
 	'click': function(message) { // adds user message handler as "_onclick". by default, this handler will be called by corresponding event handler "onclick". 
 		console.log(message);
 	},
 	'keydown': function(message) { // add user message handler as "_onkeydown". by default, this handler will be called by corresponding event handler "onkeydown". 
 		console.log(message);
 	}
 });
 

opacity(value) → {caph.module.renderer.View|Number}

sets or gets this opacity

Parameters:
Name Type Description
value Number

The number is opacity value of view.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns a opacity value.

Type
caph.module.renderer.View | Number
Example
var View = caph.module.renderer.View;
 var view = new View();
 var curOpacity = view.opacity();
 view.opacity(curOpacity - 0.2);

position(x, y, z) → {caph.module.renderer.View|Array}

Set position property or get position property.

Parameters:
Name Type Description
x Number

The number is position about x axis. (centered position)

y Number

The number is position about y axis. (centered position)

z Number

The number is position about z axis. (centered position)

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an array including three unit-less pixel values, which means x, y and z position.

Type
caph.module.renderer.View | Array
Example
var View = caph.module.renderer.View;
 var view = new View();
 var curPosition = view.position();
 view.position(curPosition[0] + 100, curPosition[1] + 100, null);

positionOrigin(x, y) → {caph.module.renderer.View|Array}

Set the position origin or get the position origin.

Parameters:
Name Type Description
x Number

The number is x-position about position origin. The position origin value range is from 0 to 1.

y Number

The number is y-position about position origin. The position origin value range is from 0 to 1.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an array including two unit-less pixel values, which means x and y position origin.

Type
caph.module.renderer.View | Array
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.positionOrigin(0.5, 0.5);
 view.position(300, 300);

removeChild(node, option) → {caph.module.renderer.VDom}

Removes the given node in case that it is this node's child. The removed node will still be reusable unless the destroy option is truthy.

Parameters:
Name Type Argument Description
node caph.module.renderer.VDom | Array.<VDom>

VDom node to remove.

option Object <optional>

Option

Properties
Name Type Argument Description
destroy Boolean <optional>

Determines whether or not to destroy the given node. Once the given node and its children is destroyed, it can be included in garbage collection.

Since:
  • 2.0.0
Inherited From:
See:
  • collection.TreeNode.removeChild
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var vdom1 = new VDom(), vdom2 = new VDom();
vdom1.addChild(vdom2);
vdom1.removeChild(vdom2);

removeClass(className) → {caph.module.renderer.VDom}

Removes a class from this object's list of classes.

Parameters:
Name Type Description
className String

A string variable representing a class name or space-delimited class names.

Since:
  • 2.0.0
Inherited From:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var vdom = new VDom();
vdom.addClass('class1 class2 class3 class4');
vdom.removeClass('class1');
vdom.removeClass('class3 class4');

requestPostRender(callback) → {caph.module.renderer.VDom}

Requests calling the given callback function just after this object has been rendered with its properties Once this is called, the given callback will be called by renderer in its 'post-render' sequence.

Parameters:
Name Type Description
callback function

[optional] the function named '_postRender' will be called in case that the given callback is undefined.

Since:
  • 2.0.0
Inherited From:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.module.renderer.VDom;
 var view = new VDom();
 view.requestPostRender(function() {
     alert('PostRender');
 });
 view.position(10, 10);

requestPreRender(callback) → {caph.module.renderer.VDom}

Requests calling the given callback function just before this object is rendered. Once this is called, the given callback will be called by renderer in its 'pre-render' sequence.

Parameters:
Name Type Description
callback function

[optional] the function named '_preRender' will be called in case the given callback is undefined.

Since:
  • 2.0.0
Inherited From:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.module.renderer.VDom;
 var view = new VDom();
 view.requestPreRender(function() {
     alert('PreRender');
 });
 view.position(10, 10);

rotate(degx, degy, degz) → {caph.module.renderer.View|Array}

Set rotation of component or get rotation of component.

Parameters:
Name Type Description
degx Number

The number is rotate degree about x axis. (centered position)

degy Number

The number is rotate degree about y axis. (centered position)

degz Number

The number is rotate degree about z axis. (centered position)

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an array including three unit-less degree values, which means x, y and z rotation.

Type
caph.module.renderer.View | Array
Example
var View = caph.module.renderer.View;
 var view = new View();
 var curRotate = view.rotate();
 view.rotate(curRotate[0] + 30, curRotate[1] + 30, curRotate[2] + 30);

rotateX(value) → {caph.module.renderer.View|Number}

Set x rotate degree or get x rotate degree.

Parameters:
Name Type Description
value Number

The number is rotate degree.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns a x rotation value.

Type
caph.module.renderer.View | Number
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.rotateX(view.rotateX() + 30);

rotateY(value) → {caph.module.renderer.View|Number}

Set y rotate degree or get y rotate degree.

Parameters:
Name Type Description
value Number

The number is rotate degree.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns a y rotation value.

Type
caph.module.renderer.View | Number
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.rotateY(view.rotateY() + 30);

rotateZ(value) → {caph.module.renderer.View|Number}

Set z rotate degree or get z rotate degree.

Parameters:
Name Type Description
value Number

The number is rotate degree.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns a z rotation value.

Type
caph.module.renderer.View | Number
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.rotateZ(view.rotateZ() + 30);

rotationOrigin(x, y) → {caph.module.renderer.View|Array}

Set the rotation origin or get the rotation origin.

Parameters:
Name Type Description
x Number

The number is x-position about rotation origin. The rotation origin value range is from 0 to 1.

y Number

The number is y-position about rotation origin. The rotation origin value range is from 0 to 1.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an array including two unit-less pixel values, which means x and y rotation origin.

Type
caph.module.renderer.View | Array
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.rotationOrigin(0, 1);
 view.rotateZ(120);

scale(x, y) → {caph.module.renderer.View|Array}

Set scale of component or get scale of component.

Parameters:
Name Type Description
x Number

The number is scale value about x axis. The scale value range is from 0 to 1.

y Number

The number is scale value about y axis. The scale value range is from 0 to 1.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an array including two unit-less ratio values, which means x and y scale.

Type
caph.module.renderer.View | Array
Example
var View = caph.module.renderer.View;
 var view = new View();
 var curScale = view.scale();
 view.scale(curScale[0] * 0.5, curScale[1] * 0.5);

setARIA(option) → {caph.ui.base.Component}

Set accessibility properties.

Parameters:
Name Type Description
option String | Object

A set of accessibility values.

Since:
  • 2.0.0
Inherited From:
Returns:
Type
caph.ui.base.Component
Example
//Set uiComponent's accessibility value
uiComponent.setARIA({
     role : 'button',
     title : 'button'
});

//change value about title to 'basic button'
uiComponent.setARIA({
     title : 'basic button'
});

setEnable(state)

Set state to enable or disable for component.

Parameters:
Name Type Description
state Boolean

state is boolean value. true is enabled, false is disabled.

Since:
  • 2.0.0
Inherited From:
Example
//enabled flag change to false.
//in each component should override this method.
uiComponent.setEnable(false);

//enabled flag change to true.
uiComponent.setEnable(true);

setHeight(height) → {caph.ui.base.component.Tooltip}

Sets the tooltip height.

Parameters:
Name Type Description
height Number

An integer representing the number of pixels.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.setHeight(200);

setOption(option)

Sets this object's own properties with the given option.

Parameters:
Name Type Description
option Object

A set of component's properties.

Since:
  • 2.0.0
Inherited From:
Example
var base = caph.ui.base.Component();

base.setOption({
     'position' : [100,100],
     'size' : [300,200],
     'dom' : {
         'id' : 'base1'
     },
     accessibility : {role : 'button', title : 'button'}
});

setProperty(properties) → {caph.module.renderer.VDom}

Sets this object's properties.

Parameters:
Name Type Description
properties Object

An object with attribute name and value pairs which correspond to the properties of HTMLElement. (@link https://developer.mozilla.org/en-US/docs/Web/API/element#Properties) 'script','iframe','link' in 'innerHTML' attribute are not allowed.

Since:
  • 2.0.0
Inherited From:
See:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var vdom = new VDom();
vdom.setProperty({
              id: 'button',
             innerHTML: 'add',
             style: {
                 width: '100px',
                 height: '50px',
                 color: 'white',
                 textAlign: 'center',
                 backgroundColor: 'blue'
             }
           });

setStyle(styles) → {caph.module.renderer.VDom}

Sets this object's style attibutes.

Parameters:
Name Type Description
styles Object

An object with style name and value pairs which correspond to the configuration of ElementCSSInlineStyle. (@link http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle)

Since:
  • 2.0.0
Inherited From:
See:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var vdom = new VDom();
vdom.setStyle({
             width: '100px',
             height: '50px',
             color: 'white',
             textAlign: 'center',
             backgroundColor: 'blue'
           });

setTailAlign(align) → {caph.ui.base.component.Tooltip}

Sets the tooltip tail alignment. After setting, the given "align" value is added to the tail area in tooltip as a class name. The previous class name is removed.

Parameters:
Name Type Description
align String

A string of tooltip tail alignment.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.setTailAlign(caph.ui.base.component.Tooltip.LEFT);

setTailDirection(direction) → {caph.ui.base.component.Tooltip}

Sets the tooltip tail direction. After setting the given "direction" value is added to the text area in tooltip as class name. The class name concatenating the "tailClassPrefixName" property value and the "direction" value is added to the tail area in tooltip. The previous class names are removed.

Parameters:
Name Type Description
direction String

A string of tooltip tail direction.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.setTailDirection(caph.ui.base.component.Tooltip.LEFT);

setText(text) → {caph.ui.base.component.Tooltip}

Sets the tooltip text.

Parameters:
Name Type Description
text String

A string of HTML to set as the content of the tooltip.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     size: [100, 100]
 });
 
 tooltip.setText('Test');

setTextFont(font) → {caph.ui.base.component.Tooltip}

Sets the tooltip text font.

Parameters:
Name Type Description
font String

Specifies the label text font. Look at http://www.w3schools.com/cssref/pr_font_font.asp for the details.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.setTextFont('bold 15px arial');

setTextStyle(style) → {caph.ui.base.component.Tooltip}

Sets the tooltip text style.

Parameters:
Name Type Description
style Object

An object with style name and value pairs. Refer to the details in caph.module.renderer.View#setStyle.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.setTextStyle({
        color: 'white',
        backgroundColor: 'blue'
 });

setTimeout(timeout) → {caph.ui.base.component.Tooltip}

Sets timeout. If timeout is 0, do not disappear tooltip before calling the hide method.

Parameters:
Name Type Description
timeout Number

A number Indicates how long the tooltip is shown. (ms)

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.setTimeout(1000);

setWidth(width) → {caph.ui.base.component.Tooltip}

Sets the tooltip width.

Parameters:
Name Type Description
width Number

An integer representing the number of pixels.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.setWidth(200);

show() → {caph.ui.base.component.Tooltip}

Shows the tooltip. The "show" class name is added to the tooltip. If elapsed timeout, hide automatically.

Since:
  • 2.0.0
Returns:
Type
caph.ui.base.component.Tooltip
Example
var tooltip = new caph.ui.base.component.Tooltip({
     text: 'Tooltip Test',
     size: [100, 100]
 });
 
 tooltip.show();

size(size) → {caph.module.renderer.View|Array}

Set size or get size (width / height)

Parameters:
Name Type Argument Description
size Array.<number> <optional>

A array unit-less pixel value The array has size value.( number[width, height] )

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an array including two unit-less pixel values, which means width and height. (for example, [100,100] means width : 100px, height: 100px).

Type
caph.module.renderer.View | Array
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.size([100, 100]);

skew(x, y) → {caph.module.renderer.View|Array}

Set skew of component or get skew of component.

Parameters:
Name Type Description
x Number

The number is skew value about x axis.

y Number

The number is skew value about y axis.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an array including two unit-less degree values, which means x and y skew.

Type
caph.module.renderer.View | Array
Example
var View = caph.module.renderer.View;
 var view = new View();
 var curSkew = view.skew();
 view.skew(curSkew[0] + 30, curSkew[1] + 30);

toggleClass(className) → {caph.module.renderer.VDom}

Toggles the existence of a class in this object's list of classes.

Parameters:
Name Type Description
className String

The class name to be toggled.

Since:
  • 2.0.0
Inherited From:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var result, vdom = new VDom();
vdom.addClass('class1 class2');
vdom.toggleClass('class2');

translate(dx, dy, dz) → {caph.module.renderer.View}

Translates this object relatively from its current position.

Parameters:
Name Type Description
dx Number

delta value of x. unit-less pixel value.

dy Number

delta value of y. unit-less pixel value.

dz Number

delta value of z. unit-less pixel value.

Since:
  • 2.0.0
Inherited From:
Returns:

It returns itself to provide method chaining.

Type
caph.module.renderer.View
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.translate(50, 50, 50);

unmount()

Unmounts from HTML element. If target vdom is not mounted at HTML Element, this method doesn't work.

Since:
  • 2.1.0
Inherited From:
Example
var VDom = caph.require('module.renderer.VDom');
var node = new VDom();
node.mount(document.body);

//unmounting from body. (not destroyed)
node.unmount();

update() → {caph.module.renderer.VDom}

Updates its properties to the corresponding DOM element.

Since:
  • 2.0.0
Inherited From:
Returns:

itself.

Type
caph.module.renderer.VDom
Example
var VDom = caph.require('module.renderer.VDom');
var vdom = new VDom();
vdom.update();

visibility(value) → {caph.module.renderer.View|Boolean}

Set visibility property or get visibility property.

Parameters:
Name Type Description
value Boolean

The boolean value is true or false.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns an Boolean, which means visibility state. If visibility is visible, true. If not, false.

Type
caph.module.renderer.View | Boolean
Example
var View = caph.module.renderer.View;
 var view = new View();
 if(view.visibility()) {
     view.visibility(false);
 }
 else {
     view.visibility(true);
 }

x(value) → {caph.module.renderer.View|Number}

Set x position property or get x position property.

Parameters:
Name Type Description
value Number

The number is x-axis position about component.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns a x position value.

Type
caph.module.renderer.View | Number
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.x(view.x() + 100);

y(value) → {caph.module.renderer.View|Number}

Set y position property or get y position property.

Parameters:
Name Type Description
value Number

The number is y-axis position about component.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns a y position value.

Type
caph.module.renderer.View | Number
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.y(view.y() + 100);

z(value) → {caph.module.renderer.View|Number}

Set z position property or get z position property.

Parameters:
Name Type Description
value Number

The number is z-axis position about component.

Since:
  • 2.0.0
Inherited From:
Returns:

If there is an argument, then it returns itself to provide method chaining. In case of no argument, it returns a z position value.

Type
caph.module.renderer.View | Number
Example
var View = caph.module.renderer.View;
 var view = new View();
 view.z(view.z() + 100);