import { ViewerModule } from '@g.frame/core'; import { BufferGeometry, Mesh, MeshBasicMaterial, Vector2 } from 'three'; import { ITextViewerModuleOptions, ITextViewerModuleOptionsTextStyle } from './TextViewerModule_interfaces'; export declare class TextViewerModule extends ViewerModule { mesh: Mesh; material: MeshBasicMaterial; private canvas; private context; private sizePX; private sizeTHREE; private neededSize; private geometry; constructor(sizePX: Vector2, sizeTHREE: Vector2); static generateFontProperty(font: ITextViewerModuleOptionsTextStyle): string; static getTextStyleSeparated(context: CanvasRenderingContext2D): ITextViewerModuleOptionsTextStyle; /** * Function to wrap text on lines * @param {CanvasRenderingContext2D} ctx Context of the canvas * @param {string} text Text to write * @param {number} x Left coordinate of first letter * @param {number} y Top coordinate of first letter * @param {number} maxWidth Max width in px of each line * @param {number} lineHeight Line height in px * @param {boolean} wrapOnLines Text should be wrapped on lines */ static wrapText(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, maxWidth: number, lineHeight: number, wrapOnLines: boolean): void; /** * Draws a rounded rectangle using the current state of the canvas. * If you omit the last three params, it will draw a rectangle * outline with a 5 pixel border radius * @param {CanvasRenderingContext2D} ctx Context of the canvas * @param {Number} x The top left x coordinate * @param {Number} y The top left y coordinate * @param {Number} width The width of the rectangle * @param {Number} height The height of the rectangle * @param {Number} [radius = 5] The corner radius; It can also be an object * to specify different radii for corners * @param {Number} [radius.tl = 0] Top left * @param {Number} [radius.tr = 0] Top right * @param {Number} [radius.br = 0] Bottom right * @param {Number} [radius.bl = 0] Bottom left * @param {Boolean} [fill = false] Whether to fill the rectangle. * @param {Boolean} [stroke = true] Whether to stroke the rectangle. */ static roundRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius?: any | number, fill?: boolean, stroke?: boolean): void; /** * Function to draw text, background on canvas and get Mesh with CanvasTexture on it * @param {Object} options Options to draw * @param {Object} options.text Options to draw text * * @param {Object|Number} [options.text.margin = 5] Margin of the text * @param {Number} [options.text.margin.left = 5] Left margin of the text * @param {Number} [options.text.margin.right = 5] Right margin of the text * @param {Number} [options.text.margin.top = 5] Top margin of the text * @param {Number} [options.text.margin.bottom = 5] Bottom margin of the text * * @param {String} [options.text.color = '#000'] Color of the text '#000' * @param {String} [options.text.font = '32pt Roboto'] Font of the text * @param {String} [options.text.align = 'left'] Horizontal of the text. Possible values 'left', 'center' and 'right' * @param {Number} [options.text.lineHeight = 40] Line height of the text in pixels * @param {Boolean} [options.text.autoWrapping = false] Auto wrapping of the text * @param {Boolean} [options.text.autoWrappingHorizontal = false] Auto wrapping of the text in horizontal. Changes width of the plane. * @param {String} [options.text.value = 'Default text'] Text * * @param {Object} options.background Options to draw background * @param {Vector2} [options.background.size = size of the canvas] Background size * @param {String} [options.background.style = 'solid'] Background style. Possible values 'gradient' and 'solid' * @param {String} [options.background.color = '#fff'] Color for solid style. * @param {Function} [options.background.gradientFunction] Gradient function to draw gradient. * @param {Object} [options.background.border = false] Border properties on the background * @param {Number} [options.background.border.width = 10] Border width in pixels * @param {String} [options.background.border.color = '#000'] Border color * @param {Number} [options.background.radius = 0] Radius of the background. There is no radius on border. * @returns {Mesh} */ updateElement(options: ITextViewerModuleOptions): Mesh, import("three").Material | import("three").Material[], import("three").Object3DEventMap>; /** * Function to calculate wrapping text and scale canvas in Y dimension * @param {string} text Text to write * @param {number} x Left coordinate of first letter * @param {number} y Top coordinate of first letter * @param {number} maxWidth Max width in px of each line * @param {number} lineHeight Line height in px * @param {number} marginBottom Margin bottom in px * @param {boolean} wrapOnLines Text should be wrapped on lines */ private calculateWrapping; }