# fabricjs-object-fit

# Table of contents

# Namespaces

# Enumerations

# Interfaces

# Type aliases

# Variables

# Functions

# Type aliases

# IFabricNS

Ƭ IFabricNS: typeof fabric

# Defined in

src/types/IFabricNS.ts:3 (opens new window)


# IFitMode

Ƭ IFitMode: typeof FitMode["COVER"] | typeof FitMode["CONTAIN"] | typeof FitMode["FILL"] | typeof FitMode["NONE"] | typeof FitMode["SCALE_DOWN"]

# Defined in

src/types/IFitMode.ts:3 (opens new window)


# IGetFittedObjectOptions

Ƭ IGetFittedObjectOptions: IGetFittedObjectPayload & { mode: IFitMode }

# Defined in

src/types/IGetFittedObjectOptions.ts:4 (opens new window)


# IGetFittedObjectPayload

Ƭ IGetFittedObjectPayload: Object

# Type declaration

Name Type
height number
position? Partial<IPosition>
width number

# Defined in

src/types/IGetFittedObjectPayload.ts:3 (opens new window)


# IObjectFitConstructorOptions

Ƭ IObjectFitConstructorOptions: Partial<IGetFittedObjectOptions & Pick<IObjectFit, "useObjectTransform" | "enableRecomputeOnScaled" | "enableRecomputeOnScaling">>

# Defined in

src/types/IObjectFitConstructorOptions.ts:4 (opens new window)


# IObjectFitSerialized

Ƭ IObjectFitSerialized: Partial<fabric.Group> & { height: number ; mode: IFitMode ; object?: Partial<fabric.Object> | null ; position: IPositionSerialized ; width: number }

# Defined in

src/types/IObjectFitSerialized.ts:5 (opens new window)


# IPoint

Ƭ IPoint: Object

# Type declaration

Name Type
getAbsolute (containerSize: number, objectSize: number) => number
toJSON () => IPointSerialized
toString? () => string

# Defined in

src/types/IPoint.ts:3 (opens new window)


# IPointSerialized

Ƭ IPointSerialized: { args: [number] ; type: "fromAbsolute" } | { args: [number] ; type: "fromFactor" } | { args: [string | number] ; type: "fromPercentage" } | { args: [Tag] ; type: "fromTag" }

# Defined in

src/types/IPointSerialized.ts:3 (opens new window)


# IPosition

Ƭ IPosition: Object

# Type declaration

Name Type
x IPoint
y IPoint

# Defined in

src/types/IPosition.ts:3 (opens new window)


# IPositionSerialized

Ƭ IPositionSerialized: Partial<{ x: IPointSerialized ; y: IPointSerialized }>

# Defined in

src/types/IPositionSerialized.ts:3 (opens new window)


# ISetupOptions

Ƭ ISetupOptions: Object

# Type declaration

Name Type
assingClassesToNamespace? boolean

# Defined in

src/types/ISetupOptions.ts:1 (opens new window)

# Variables

# FitMode

FitMode: Object

# Type declaration

Name Type
CONTAIN "contain"
COVER "cover"
FILL "fill"
NONE "none"
SCALE_DOWN "scale-down"

# Defined in

src/enums/FitMode.ts:1 (opens new window)


# defaultPosition

defaultPosition: IPosition

# Defined in

src/misc/Position/defaultPosition.ts:4 (opens new window)

# Functions

# createObjectFitClass

Const createObjectFitClass(ns): IObjectFitConstructor

# Parameters

Name Type
ns __module

# Returns

IObjectFitConstructor

# Defined in

src/createObjectFitClass.ts:17 (opens new window)


# getContainFittedObject

Const getContainFittedObject(object, options, ns): Group

# Parameters

Name Type
object Object
options IGetFittedObjectPayload
ns __module

# Returns

Group

# Defined in

src/utils/getContainFittedObject.ts:10 (opens new window)


# getCoverFittedObject

Const getCoverFittedObject(object, options, ns): Group

# Parameters

Name Type
object Object
options IGetFittedObjectPayload
ns __module

# Returns

Group

# Defined in

src/utils/getCoverFittedObject.ts:10 (opens new window)


# getFillFittedObject

Const getFillFittedObject(object, options, ns): Group

# Parameters

Name Type
object Object
options IGetFittedObjectPayload
ns __module

# Returns

Group

# Defined in

src/utils/getFillFittedObject.ts:10 (opens new window)


# getFittedObject

Const getFittedObject(object, options, ns): void | Object

# Parameters

Name Type
object Object
options IGetFittedObjectOptions
ns __module

# Returns

void | Object

# Defined in

src/utils/getFittedObject.ts:11 (opens new window)


# getNoneFittedObject

Const getNoneFittedObject(object, options, ns): Group

# Parameters

Name Type
object Object
options IGetFittedObjectPayload
ns __module

# Returns

Group

# Defined in

src/utils/getNoneFittedObject.ts:9 (opens new window)


# getScaleDownFittedObject

Const getScaleDownFittedObject(object, options, ns): Group

# Parameters

Name Type
object Object
options IGetFittedObjectPayload
ns __module

# Returns

Group

# Defined in

src/utils/getScaleDownFittedObject.ts:7 (opens new window)


# parsePoint

Const parsePoint(serializedPoint, shouldFallbackToDefault?): IPoint

# Parameters

Name Type Default value
serializedPoint IPointSerialized undefined
shouldFallbackToDefault boolean true

# Returns

IPoint

# Defined in

src/misc/Point/parsePoint.ts:9 (opens new window)


# parsePosition

Const parsePosition(serializedPosition): Object

# Parameters

Name Type
serializedPosition Partial<{ x: IPointSerialized ; y: IPointSerialized }>

# Returns

Object

Name Type
x IPoint
y IPoint

# Defined in

src/misc/Position/parsePosition.ts:5 (opens new window)


# setup

Const setup(ns, options?): Object

# Parameters

Name Type
ns __module
options ISetupOptions

# Returns

Object

Name Type
ObjectFit IObjectFitConstructor

# Defined in

src/setup.ts:5 (opens new window)