mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-01 11:39:28 +08:00
Add ITextOptions underline, overline, linethrough. Add Textbox object.
This commit is contained in:
97
types/fabric/fabric-impl.d.ts
vendored
97
types/fabric/fabric-impl.d.ts
vendored
@@ -3081,8 +3081,27 @@ interface ITextOptions extends IObjectOptions {
|
||||
fontFamily?: string;
|
||||
/**
|
||||
* Text decoration Possible values?: "", "underline", "overline" or "line-through".
|
||||
* Feels like this has been deprecated in favor of underline, overline, linethrough props
|
||||
*/
|
||||
textDecoration?: string;
|
||||
/**
|
||||
* Text decoration underline.
|
||||
* @type Boolean
|
||||
* @default
|
||||
*/
|
||||
underline?: boolean;
|
||||
/**
|
||||
* Text decoration overline.
|
||||
* @type Boolean
|
||||
* @default
|
||||
*/
|
||||
overline?: boolean;
|
||||
/**
|
||||
* Text decoration linethrough.
|
||||
* @type Boolean
|
||||
* @default
|
||||
*/
|
||||
linethrough?: boolean;
|
||||
/**
|
||||
* Text alignment. Possible values?: "left", "center", or "right".
|
||||
*/
|
||||
@@ -3190,6 +3209,33 @@ export class Text extends Object {
|
||||
* @param textDecoration Text decoration
|
||||
*/
|
||||
setTextDecoration(textDecoration: string): Text;
|
||||
/**
|
||||
* Retrieves object's underline
|
||||
*/
|
||||
getUnderline(): boolean;
|
||||
/**
|
||||
* Sets object's underline
|
||||
* @param underline Text underline
|
||||
*/
|
||||
setUnderline(underline: boolean): Text;
|
||||
/**
|
||||
* Retrieves object's overline
|
||||
*/
|
||||
getOverline(): boolean;
|
||||
/**
|
||||
* Sets object's overline
|
||||
* @param overline Text overline
|
||||
*/
|
||||
setOverline(overline: boolean): Text;
|
||||
/**
|
||||
* Retrieves object's linethrough
|
||||
*/
|
||||
getLinethrough(): boolean;
|
||||
/**
|
||||
* Sets object's linethrough
|
||||
* @param linethrough Text linethrough
|
||||
*/
|
||||
setLinethrough(linethrough: boolean): Text;
|
||||
/**
|
||||
* Retrieves object's fontStyle
|
||||
*/
|
||||
@@ -3311,6 +3357,52 @@ interface IITextOptions extends IObjectOptions, ITextOptions {
|
||||
*/
|
||||
caching?: boolean;
|
||||
}
|
||||
export interface Textbox extends IText {}
|
||||
export class Textbox extends IText {
|
||||
/**
|
||||
* Constructor
|
||||
* @param text Text string
|
||||
* @param [options] Options object
|
||||
*/
|
||||
constructor(text: string, options?: IITextOptions);
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Get minimum width of text box
|
||||
* @return {Number}
|
||||
*/
|
||||
getMinWidth(): number;
|
||||
/**
|
||||
* Selects entire text
|
||||
* @return {fabric.Text} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
selectAll(): Textbox;
|
||||
/**
|
||||
* Selects a line based on the index
|
||||
* @param {Number} selectionStart Index of a character
|
||||
* @return {fabric.IText} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
selectLine(selectionStart: number): Textbox;
|
||||
/**
|
||||
* Enters editing state
|
||||
* @return {fabric.Textbox} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
enterEditing(): Textbox;
|
||||
/**
|
||||
* Exits from editing state
|
||||
* @return {fabric.Textbox} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
exitEditing(): Textbox;
|
||||
}
|
||||
export interface IText extends Text, IITextOptions { }
|
||||
export class IText extends Object {
|
||||
/**
|
||||
@@ -3320,9 +3412,10 @@ export class IText extends Object {
|
||||
*/
|
||||
constructor(text: string, options?: IITextOptions);
|
||||
/**
|
||||
* Returns true if object has no styling
|
||||
* Returns true if object has no styling or no styling in a line
|
||||
* @param {Number} lineIndex , lineIndex is on wrapped lines.
|
||||
*/
|
||||
isEmptyStyles(): boolean;
|
||||
isEmptyStyles(lineIndex: number): boolean;
|
||||
render(ctx: CanvasRenderingContext2D, noTransform: boolean): void;
|
||||
/**
|
||||
* Returns object representation of an instance
|
||||
|
||||
1
types/fabric/index.d.ts
vendored
1
types/fabric/index.d.ts
vendored
@@ -6,6 +6,7 @@
|
||||
// Tiger Oakes <https://github.com/NotWoods>
|
||||
// Brian Martinson <https://github.com/bmartinson>
|
||||
// Rogerio Teixeira <https://github.com/RogerioTeixeira>
|
||||
// Bradley Hill <https://github.com/BradleyHill>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
export import fabric = require("./fabric-impl");
|
||||
|
||||
Reference in New Issue
Block a user