How to use the platform.screen function in platform

To help you get started, we’ve selected a few platform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imwalson / nativescript-swiper / nativescript-swiper.ios.js View on Github external
UIScrollViewDelegateSwiper.prototype.scrollViewDidScroll = function (sv) {
        var owner = this._owner.get();
        if (!owner) {
            return;
        }
        if (owner) {
            var scrollableWidth = Math.max(0, sv.contentSize.width - sv.bounds.size.width);
            this._slidesCount = Math.round(scrollableWidth/platformModule.screen.mainScreen.widthDIPs) + 1;
            owner.notify({
                object: owner,
                eventName: "scroll",
                scrollX: owner.horizontalOffset,
                scrollY: owner.verticalOffset,
                slidesCount: this._slidesCount
            });
        }
    };
    // 滚动视图减速完成,滚动将停止时,调用该方法。一次有效滑动,只执行一次。
github argonjs / argon-app / app / components / common / argon-device-provider.js View on Github external
NativescriptDeviceService.prototype.onUpdateFrameState = function () {
        var viewport = this.frameState.viewport;
        var contentView = frames.topmost().currentPage.content;
        var contentSize = contentView.getActualSize();
        viewport.x = 0;
        viewport.y = 0;
        viewport.width = contentSize.width;
        viewport.height = contentSize.height;
        var subviews = this.frameState.subviews;
        var device = vuforia.api.getDevice();
        var renderingPrimitives = device.getRenderingPrimitives();
        var renderingViews = renderingPrimitives.getRenderingViews();
        var numViews = renderingViews.getNumViews();
        var contentScaleFactor = vuforia.videoView.ios ? vuforia.videoView.ios.contentScaleFactor : platform.screen.mainScreen.scale;
        subviews.length = numViews;
        subviews.length = numViews;
        for (var i = 0; i < numViews; i++) {
            var view = renderingViews.getView(i);
            // TODO: support PostProcess rendering subview
            if (view === vuforia.View.PostProcess) {
                subviews.length--;
                continue;
            }
            var subview = subviews[i] = subviews[i] || {};
            // Set subview type
            switch (view) {
                case vuforia.View.LeftEye:
                    subview.type = Argon.SubviewType.LEFTEYE;
                    break;
                case vuforia.View.RightEye:
github NativeScript / nativescript-app-templates / packages / template-hello-world / tns_modules / ui / frame / frame-common.js View on Github external
function resolveFilePath(path, ext) {
    if (!fileNameResolver) {
        fileNameResolver = new fileResolverModule.FileNameResolver({
            width: platform.screen.mainScreen.widthDIPs,
            height: platform.screen.mainScreen.heightDIPs,
            os: platform.device.os,
            deviceType: platform.device.deviceType
        });
    }
    return fileNameResolver.resolveFileName(path, ext);
}
function pageFromBuilder(moduleNamePath, moduleExports) {
github NativeScript / NativeScript / tns-core-modules / camera / camera.android.ts View on Github external
var calculateInSampleSize = function (imageWidth, imageHeight, reqWidth, reqHeight) {
    let sampleSize = 1;
    let displayWidth = platform.screen.mainScreen.widthDIPs;
    let displayHeigth = platform.screen.mainScreen.heightDIPs;
    reqWidth = (reqWidth > 0 && reqWidth < displayWidth) ? reqWidth : displayWidth;
    reqHeight = (reqHeight > 0 && reqHeight < displayHeigth) ? reqHeight : displayHeigth;
    if (imageWidth > reqWidth && imageHeight > reqHeight) {
        let halfWidth = imageWidth / 2;
        let halfHeight = imageHeight / 2;
        while ((halfWidth / sampleSize) > reqWidth && (halfHeight / sampleSize) > reqHeight) {
            sampleSize *= 2;
        }
    }
    return sampleSize;
}
github bradyhouse / house / fiddles / nativeScript / fiddle-0009-SqliteDb / fifteenpuzzle / platforms / android / src / main / assets / app / tns_modules / camera / camera.js View on Github external
var calculateInSampleSize = function (imageWidth, imageHeight, reqWidth, reqHeight) {
    var sampleSize = 1;
    var displayWidth = platform.screen.mainScreen.widthDIPs;
    var displayHeigth = platform.screen.mainScreen.heightDIPs;
    reqWidth = (reqWidth > 0 && reqWidth < displayWidth) ? reqWidth : displayWidth;
    reqHeight = (reqHeight > 0 && reqHeight < displayHeigth) ? reqHeight : displayHeigth;
    if (imageWidth > reqWidth && imageHeight > reqHeight) {
        var halfWidth = imageWidth / 2;
        var halfHeight = imageHeight / 2;
        while ((halfWidth / sampleSize) > reqWidth && (halfHeight / sampleSize) > reqHeight) {
            sampleSize *= 2;
        }
    }
    return sampleSize;
};
var createDateTimeStamp = function () {
github JoshDSommer / nativescript-swiss-army-knife / nativescript-swiss-army-knife.common.ts View on Github external
public static getScreenHeight(): IScreenHeight {
		let height1 = Platform.screen.mainScreen.heightDIPs;
		let height2 = Platform.screen.mainScreen.widthDIPs;
		return {
			portrait: height1,
			landscape: height2
		};
	}
github JoshDSommer / nativescript-parallax / utilities.ts View on Github external
public static getMinimumHeights(): IMinimumHeights {
		let height1 = Platform.screen.mainScreen.heightDIPs;
		let height2 = Platform.screen.mainScreen.widthDIPs;
		//if the first hieght is lager than the second hiehgt it's the portrait views min hieght.
		if (height1 > height2) {
			return {
				portrait: height1,
				landscape: height2
			};
		} else {
			return {
				portrait: height2,
				landscape: height1
			};
		}
	}
github NickIliev / NativeScript-Firebase-Auth / firebaseAuth / platforms / android / build / intermediates / assets / F0F1 / debug / app / tns_modules / file-system / file-name-resolver.js View on Github external
function resolveFileName(path, ext) {
    if (!appEventAttached) {
        var app = require("application");
        app.on(app.orientationChangedEvent, function (data) {
            resolverInstance = undefined;
        });
        appEventAttached = true;
    }
    if (!resolverInstance) {
        resolverInstance = new FileNameResolver({
            width: platform.screen.mainScreen.widthDIPs,
            height: platform.screen.mainScreen.heightDIPs,
            os: platform.device.os,
            deviceType: platform.device.deviceType
        });
    }
    return resolverInstance.resolveFileName(path, ext);
}
exports.resolveFileName = resolveFileName;
github NativeScript / NativeScript / tns-core-modules / camera / camera.android.ts View on Github external
var calculateInSampleSize = function (imageWidth, imageHeight, reqWidth, reqHeight) {
    let sampleSize = 1;
    let displayWidth = platform.screen.mainScreen.widthDIPs;
    let displayHeigth = platform.screen.mainScreen.heightDIPs;
    reqWidth = (reqWidth > 0 && reqWidth < displayWidth) ? reqWidth : displayWidth;
    reqHeight = (reqHeight > 0 && reqHeight < displayHeigth) ? reqHeight : displayHeigth;
    if (imageWidth > reqWidth && imageHeight > reqHeight) {
        let halfWidth = imageWidth / 2;
        let halfHeight = imageHeight / 2;
        while ((halfWidth / sampleSize) > reqWidth && (halfHeight / sampleSize) > reqHeight) {
            sampleSize *= 2;
        }
    }
    return sampleSize;
}
github NickIliev / NativeScript-Firebase-Auth / platforms / android / build / intermediates / assets / F0F1 / debug / app / tns_modules / tns-core-modules / image-asset / image-asset.js View on Github external
var calculateInSampleSize = function (imageWidth, imageHeight, reqWidth, reqHeight) {
    var sampleSize = 1;
    var displayWidth = platform.screen.mainScreen.widthDIPs;
    var displayHeigth = platform.screen.mainScreen.heightDIPs;
    reqWidth = (reqWidth > 0 && reqWidth < displayWidth) ? reqWidth : displayWidth;
    reqHeight = (reqHeight > 0 && reqHeight < displayHeigth) ? reqHeight : displayHeigth;
    if (imageWidth > reqWidth && imageHeight > reqHeight) {
        var halfWidth = imageWidth / 2;
        var halfHeight = imageHeight / 2;
        while ((halfWidth / sampleSize) > reqWidth && (halfHeight / sampleSize) > reqHeight) {
            sampleSize *= 2;
        }
    }
    return sampleSize;
};
//# sourceMappingURL=image-asset.js.map