Constructors
constructor
- new CanvasSource(canvasElementOrQuery, sizeBasis?): CanvasSource
Parameters
- canvasElementOrQuery: string | HTMLCanvasElement
- sizeBasis: "max" | "min" = ...
Accessors
context
- get context(): CanvasRenderingContext2D
Returns CanvasRenderingContext2D
height
- get height(): number
Returns number
offset
- get offset(): {
x: number;
y: number;
} Returns {
x: number;
y: number;
}
sizeScaler
- get sizeScaler(): {
abs: ((v: number) => number);
rel: ((v: number) => number);
} Returns {
abs: ((v: number) => number);
rel: ((v: number) => number);
}
abs: ((v: number) => number)
- (v): number
Returns number
rel: ((v: number) => number)
- (v): number
Returns number
width
- get width(): number
Returns number
Methods
clear
- clear(): void
Returns void
invalidateContext
- invalidateContext(): void
Returns void
setLogicalSize
- setLogicalSize(size): Rect
toAbsPoint
- toAbsPoint(pt, kind?): {
x: number;
y: number;
} Parameters
- pt: Point
- kind: "independent" = ...
Returns {
x: number;
y: number;
}
toAbsRect
- toAbsRect(rect, kind?): {
height: number;
width: number;
x: number;
y: number;
} | {
height: number;
width: number;
} Returns {
height: number;
width: number;
x: number;
y: number;
} | {
height: number;
width: number;
}
toRelPoint
- toRelPoint(pt, source, kind?, clamped?): {
x: number;
y: number;
} Parameters
- pt: Point
- source: "source" | "screen"
- kind: "independent" | "skip" = ...
- clamped: boolean = true
Returns {
x: number;
y: number;
}
Creates a region
Absolute positioned. Uses source coordinates which don't change
Relative positioned. Uses coordiantes relative to source dimensions. Updated if source changes.
Relative sized. Uses size relative to source dimension. By default centers.