@vrspace/babylonjs
Version:
vrspace.org babylonjs client
85 lines (84 loc) • 2.63 kB
TypeScript
/**
* Text area somewhere in space, like a screen.
* Provides methods for writing the text, movement, resizing.
*/
export class TextArea extends BaseArea {
/**
* Creates the area with default values.
* By default, it's sized and positioned to be attached to the camera, is nicely transparent, font size 16 on 512x512 texture,
* and includes manipulation handles.
* @param scene babylon scene, mandatory
* @param name optional, defaults to TextArea
* @param titleText optional title to display above the area
*/
constructor(scene: any, name?: string, titleText?: any);
titleText: any;
alpha: number;
fontSize: number;
width: number;
height: number;
capacity: number;
textWrapping: boolean;
addBackground: boolean;
autoScale: boolean;
textHorizontalAlignment: any;
textVerticalAlignment: any;
text: string;
/** @type {Label} */
title: Label;
/**
* As the name says. Optionally also creates manipulation handles.
*/
show(): void;
textBlock: any;
ratio: number;
backgroundPlane: any;
/**
* Show title text on top of the area. Title can be changed and displayed any time after show().
*/
showTitle(): void;
/**
* Remove the title, if any.
*/
removeTitle(): void;
/**
* Creates manipulation handles. Left and right handle resize, and top and bottom move it.
*/
createHandles(): void;
/**
* Hide/show (requires manipulation handles)
* @param flag boolean, hide/show
*/
hide(flag: any): void;
/**
* Detach from whatever attached to, i.e. drop it where you stand.
*/
detach(offset: any): void;
/**
* Check if current text length exceeds the capacity and truncate as required.
*/
checkCapacity(): void;
/** Same as write */
print(string: any): void;
/** Write a string */
write(string: any): void;
/** Same as writeln */
println(string: any): void;
/** Print a string into a new line */
writeln(string?: string): void;
/** Print a number of lines */
writeArray(text: any): void;
/** Remove the text */
clear(): void;
/** Calculates and returns maximum text rows available */
getMaxRows(): number;
/** Calculates and returns maximum number text columns available */
getMaxCols(): number;
/**
* Set click event handler here
* @param callback executed on pointer click, passed Control argument
*/
onClick(callback: any): void;
}
import { BaseArea } from './base-area.js';
import { Label } from './label.js';