import { TClassProperties } from '../typedefs'; import { IText } from './IText/IText'; export declare const textboxDefaultValues: Partial>; /** * Textbox class, based on IText, allows the user to resize the text rectangle * and wraps lines automatically. Textboxes have their Y scaling locked, the * user can only change width. Height is adjusted automatically based on the * wrapping of lines. */ export declare class Textbox extends IText { /** * Minimum width of textbox, in pixels. * @type Number * @default */ minWidth: number; obj_type: string; hasNoText: boolean; /** * Minimum calculated width of a textbox, in pixels. * fixed to 2 so that an empty textbox cannot go to 0 * and is still selectable without text. * @type Number * @default */ dynamicMinWidth: number; oneLine: boolean; fromCopy: boolean; /** * Use this boolean property in order to split strings that have no white space concept. * this is a cheap way to help with chinese/japanese * @type Boolean * @since 2.6.0 */ splitByGrapheme: boolean; static textLayoutProperties: string[]; static ownDefaults: Record; static getDefaults(): { [x: string]: any; }; constructor(text: string, options: any); _getTotalLineHeights(): number; /** * Unlike superclass's version of this function, Textbox does not update * its width. * @private * @override */ initDimensions(): void; /** * Generate an object that translates the style object so that it is * broken up by visual lines (new lines and automatic wrapping). * The original text styles object is broken up by actual lines (new lines only), * which is only sufficient for Text / IText * @private */ _generateStyleMap(textInfo: any): {}; /** * Returns true if object has a style property or has it on a specified line * @param {Number} lineIndex * @return {Boolean} */ styleHas(property: any, lineIndex: number): boolean; /** * Returns true if object has no styling or no styling in a line * @param {Number} lineIndex , lineIndex is on wrapped lines. * @return {Boolean} */ isEmptyStyles(lineIndex: number): boolean; /** * @param {Number} lineIndex * @param {Number} charIndex * @private */ _getStyleDeclaration(lineIndex: number, charIndex: number): Partial | null; /** * @param {Number} lineIndex * @param {Number} charIndex * @param {Object} style * @private */ _setStyleDeclaration(lineIndex: number, charIndex: number, style: object): void; /** * @param {Number} lineIndex * @param {Number} charIndex * @private */ _deleteStyleDeclaration(lineIndex: number, charIndex: number): void; /** * probably broken need a fix * Returns the real style line that correspond to the wrapped lineIndex line * Used just to verify if the line does exist or not. * @param {Number} lineIndex * @returns {Boolean} if the line exists or not * @private */ _getLineStyle(lineIndex: number): boolean; /** * Set the line style to an empty object so that is initialized * @param {Number} lineIndex * @param {Object} style * @private */ _setLineStyle(lineIndex: number): void; /** * Wraps text using the 'width' property of Textbox. First this function * splits text on newlines, so we preserve newlines entered by the user. * Then it wraps each line using the width of the Textbox by calling * _wrapLine(). * @param {Array} lines The string array of text that is split into lines * @param {Number} desiredWidth width you want to wrap to * @returns {Array} Array of lines */ _wrapText(lines: Array, desiredWidth: number): Array; /** * Helper function to measure a string of text, given its lineIndex and charIndex offset * It gets called when charBounds are not available yet. * Override if necessary * Use with {@link Textbox#wordSplit} * * @param {CanvasRenderingContext2D} ctx * @param {String} text * @param {number} lineIndex * @param {number} charOffset * @returns {number} */ _measureWord(word: any, lineIndex: number, charOffset?: number): number; /** * Override this method to customize word splitting * Use with {@link Textbox#_measureWord} * @param {string} value * @returns {string[]} array of words */ wordSplit(value: string): string[]; /** * Wraps a line of text using the width of the Textbox and a context. * @param {Array} line The grapheme array that represent the line * @param {Number} lineIndex * @param {Number} desiredWidth width you want to wrap the line to * @param {Number} reservedSpace space to remove from wrapping for custom functionalities * @returns {Array} Array of line(s) into which the given text is wrapped * to. */ graphemeSplitForRectNotes(textstring: string): string[]; _wrapLine(_line: any, lineIndex: number, desiredWidth: number, reservedSpace?: number): Array; /** * Detect if the text line is ended with an hard break * text and itext do not have wrapping, return false * @param {Number} lineIndex text to split * @return {Boolean} */ isEndOfWrapping(lineIndex: number): boolean; /** * Detect if a line has a linebreak and so we need to account for it when moving * and counting style. * @return Number */ missingNewlineOffset(lineIndex: any): 1 | 0; /** * Gets lines of text to render in the Textbox. This function calculates * text wrapping on the fly every time it is called. * @param {String} text text to split * @returns {Array} Array of lines in the Textbox. * @override */ _splitTextIntoLines(text: string): import("./Text/Text").TextLinesInfo; getMinWidth(): number; _removeExtraneousStyles(): void; addControls(): void; controlMousedownProcess(transformData: any, rx: any, ry: any): void; /** * Returns object representation of an instance * @method toObject * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output * @return {Object} object representation of an instance */ getObject(): {}; toObject(propertiesToInclude: Array): object; /**extend function for fronted */ checkTextboxChange(): void; InitializeEvent(): void; changeWidth(eventData: any, transform: any, x: any, y: any): boolean; resetResizeControls(): void; } export declare enum EventName { MODIFIED = "modified", CHANGED = "changed", TRIPLECLICK = "tripleclick", DBLCLICK = "dblclick", MOUSEOUT = "mouseout", EDITINGENTERED = "editing:entered", MOUSEOVER = "mouseover", EDITINGEXITED = "editing:exited", INITIALIZE = "initialize", INSERTNEWSTYLEBLOCK = "insertNewStyleBlock", RENDER = "_render", SET = "set", OBJECTMOVING = "object:moving", OBJECTMOVED = "object:moved", SELECTIONCREATED = "selection:created", SELECTIONCLEARED = "selection:cleared", SELECTED = "selected", DESELECTED = "deselected", MOUSEDBLCLICK = "mousedblclick", MOUSEUP = "mouseup", MOUSE_UP = "mouse:up", TOUCHSTART = "touchstart", SETSRC = "setSrc", REMOVED = "removed", MOUSEDOWN = "mousedown", MOVING = "moving", SELECTABLE = "selectable", EVENTED = "evented", FILL = "fill", ROTATING = "rotating", SCALING = "scaling", ADDED = "added", OBJECTSCALING = "object:scaling", OBJECTSCALED = "object:scaled", OBJECTROTATING = "object:rotating", OBJECTROTATED = "object:rotated", SELECTIONUPDATED = "selection:updated", DRAGENTER = "dragenter", DRAGLEAVE = "dragleave", CANVAS_MOUSE_DOWN = "canvas:mousedown", CANVAS_MOUSE_DOWN_BEFORE = "canvas:mousedownbefore", CANVAS_MOUSE_MOVE = "canvas:mousemove", CANVAS_MOUSE_UP = "canvas:mouseup", CANVAS_MOUSE_OUT = "canvas:mouseout", CANVAS_SCROLL = "canvas:scroll", DOCUMENT_KEY_UP = "document:keyup", DOCUMENT_KEY_DOWN = "document:keydown", DOCUMENT_MOUSE_DOWN = "mousedown", DOCUMENT_MOUSE_UP = "mouseup", DOCUMENT_MOUSE_MOVE = "mousemove", DOCUMENT_MOUSE_WHEEL = "wheel", DOCUMENT_DRAG_OVER = "dragover", DOCUMENT_PAUSE = "pause", DOCUMENT_RESUME = "resume", DOCUMENT_VISIBILITY_CHANGE = "visibilitychange", DOCUMENT_PASTE = "paste", WINDOW_BEFORE_UNLOAD = "beforeunload", WINDOW_MOUSE_MOVE = "mousemove", WINDOW_GESTURE_START = "gesturestart", WINDOW_GESTURE_CHANGE = "gesturechange", A_CTRL_KEY_DOWN = "a_ctrl:keydown", B_CTRL_KEY_DOWN = "b_ctrl:keydown", D_CTRL_KEY_DOWN = "d_ctrl:keydown", G_CTRL_SHIFT_KEY_DOWN = "g_ctrl_shift:keydown", G_CTRL_KEY_DOWN = "g_ctrl:keydown", T_KEY_DOWN = "t:keydown", P_KEY_DOWN = "p:keydown", S_KEY_UP = "s:keyup", S_KEY_DOWN = "s:keydown", O_KEY_UP = "o:keyup", O_KEY_DOWN = "o:keydown", R_KEY_UP = "r:keyup", R_KEY_DOWN = "r:keydown", F_KEY_UP = "f:keyup", F_KEY_DOWN = "f:keydown", L_KEY_UP = "l:keyup", L_KEY_DOWN = "l:keydown", Z_CTRL_KEY_UP = "z_ctrl:keyup", Z_CTRL_KEY_DOWN = "z_ctrl:keydown", Z_CTRL_SHIFT_KEY_UP = "z_ctrl_shift:keyup", Z_CTRL_SHIFT_KEY_DOWN = "z_ctrl_shift:keydown", SPACE_KEY_UP = "space:keyup", SPACE_KEY_DOWN = "space:keydown", SHIFT_KEY_UP = "shift:keyup", SHIFT_KEY_DOWN = "shift:keydown", SLASH_SHIFT_KEY_DOWN = "slash_shift:keydown", ESC_KEY_DOWN = "esc:keydown", DELETE_KEY_DOWN = "delete:keydown", CTRL_SHIFT_FIVE_KEY_DOWN = "ctrl_shift_five:keydown", CTRL_PLUS_KEY_DOWN = "ctrl_plus:keydown", CTRL_MINUS_KEY_DOWN = "ctrl_minus:keydown", CTRL_ZERO_KEY_DOWN = "ctrl_zero:keydown", UP_DOWN_LEFT_RIGHT_KEY_DOWN = "up_down_left_right:keydown", CANVAS_BEFORE_SELECTION_CLEARED = "before:selection:cleared", CANVAS_SELECTION_UPDATED = "selection:updated", CANVAS_SELECTION_CREATED = "selection:created", SELECTION_CLEARED = "selection:cleared", TEXT_CHANGED = "text:changed", BEFORE_RENDER = "before:render", AFTER_RENDER = "after:render", MOUSE_DOWN_BEFORE = "mouse:down:before", MOUSE_DOWN = "mouse:down", TEXT_EDITING_EXISTED = "text:editing:exited", MOUSE_DBCLICK = "mouse:dblclick", HAMMER_TAP1 = "tap1", HAMMER_DOUBLE_TAP = "doubletap", HAMMER_PAN1_START = "pan1start", HAMMER_PAN1_MOVE = "pan1move", HAMMER_PAN1_END = "pan1end", HAMMER_PAN3 = "pan3", HAMMER_PINCH_START = "pinchstart", HAMMER_PINCH_MOVE = "pinchmove", RETURN_DEFAULT_ZOOMM = "returndefaultzoom", MOUSE_MOVE = "mouse:move", RESIZING = "resizing" } export declare enum TextAlign { LEFT = "left", CENTER = "center", RIGHT = "right", JUSTIFY = "justify", JUSTIFYLEFT = "justify-left", JUSTIFYCENTER = "justify-center", JUSTIFYRIGHT = "justify-right" } export declare enum WidgetType { WBActiveSelection = "activeSelection", WBArrow = "WBArrow", WBCircle = "WBCircle", WBCircleNotes = "WBCircleNotes", WBFile = "WBFile", WBGroup = "WBGroup", WBImage = "WBImage", WBIText = "WBIText", WBObject = "WBObject", WBPath = "WBPath", WBPolyline = "WBPolyline", WBLine = "WBLine", WBRdRectPanel = "WBRdRectPanel", WBRect = "WBRect", WBRectNotes = "WBRectNotes", WBRectPanel = "WBRectPanel", WBShape = "WBShape", WBShapeNotes = "WBShapeNotes", WBTriangle = "WBTriangle", WBUrlImage = "WBUrlImage", WBText = "WBText", WBTextbox = "WBTextbox", Common = "common" } export declare enum NoteType { RECT = "rect", SQUARE = "square", CIRCLE = "circle", TEXT = "text" } export declare enum Origin { Left = "left", Right = "right", Center = "center" } export declare enum ModifiedField { Width = "width", Height = "height", Left = "left", Top = "top", ShapeScalex = "shapeScaleX", ScaleX = "scaleX", ScaleY = "scaleY", FlipX = "flipX", FLipY = "flipY", MaxHeight = "maxHeight", FixedScaleChange = "fixedScaleChange", Lines = "lines", PanelObj = "panelObj", Relationship = "relationship", ZIndex = "zIndex", x1 = "x1", x2 = "x2", y1 = "y1", y2 = "y2", ConnectorStart = "connectorStart", ConnectorEnd = "connectorEnd", Fill = "fill", Text = "text" } export declare enum SaveAction { MOVED = "MOVED", SCALED = "SCALED", ADDED = "ADDED", PASTE = "PASTE", REMOVED = "REMOVED", MODIFIED = "MODIFIED", UNBIND = "UNBIND", BIND = "BIND", ROTATED = "ROTATED" } //# sourceMappingURL=BX_Textbox.d.ts.map