projects/wms-framework/src/lib/basecomponentmodel/NativeContent.ts
Provides information about the content area.
Properties |
|
Accessors |
constructor(nWindow?: Window, nDocument?: Document)
|
|||||||||
Creates an instance of NativeContent.
Parameters :
|
Public Readonly Resized |
Type : SubscriptionEvent<void>
|
Default value : new SubscriptionEvent()
|
Event for when the content area change its size. |
ZoomFactor |
getZoomFactor()
|
Gets the browser's current zoom. |
ActualWidth |
getActualWidth()
|
Gets the width of the content area.
Returns :
number
|
ActualHeight |
getActualHeight()
|
Gets the height of the content area.
Returns :
number
|
import { SubscriptionEvent } from '../utils/SubscriptionEvent';
/**
* Provides information about the content area.
*
* @export
* @class NativeContent
* @wType System.Windows.Interop.Content
*/
export class NativeContent {
/**
* Event for when the content area change its size.
*
* @memberof NativeContent
*/
public readonly Resized: SubscriptionEvent<(x: any, y: any) => void> =
new SubscriptionEvent();
/**
* Creates an instance of NativeContent.
*
* @param {Window} [nWindow]
* @param {Document} [nDocument]
* @memberof NativeContent
*/
constructor(private nWindow?: Window, private nDocument?: Document) {
nWindow = nWindow ?? window;
nDocument = nDocument ?? document;
}
/**
* Gets the browser's current zoom.
*
* @memberof NativeContent
*/
public get ZoomFactor() {
return this.nWindow.devicePixelRatio;
}
/**
* Gets the width of the content area.
*
* @readonly
* @type {number}
* @memberof NativeContent
*/
public get ActualWidth(): number {
return (
this.nWindow.innerWidth ||
this.nDocument.documentElement.clientWidth ||
this.nDocument.body.clientWidth
);
}
/**
* Gets the height of the content area.
*
* @readonly
* @type {number}
* @memberof NativeContent
*/
public get ActualHeight(): number {
return (
this.nWindow.innerHeight ||
this.nDocument.documentElement.clientHeight ||
this.nDocument.body.clientHeight
);
}
}