UNPKG

@bezlepkin/nativescript-ar

Version:

NativeScript Augmented Reality plugin. ARKit on iOS and (with the help of Sceneform) ARCore on Android.

120 lines (119 loc) 3.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AR = exports.ARRotation = exports.ARPosition = exports.ARScale = exports.ARSize = exports.ARDimensions2D = exports.ARDimensions = void 0; const core_1 = require("@nativescript/core"); const debugLevelProperty = new core_1.Property({ name: "debugLevel", defaultValue: "NONE" }); const trackingModeProperty = new core_1.Property({ name: "trackingMode", defaultValue: "WORLD" }); const planeMaterialProperty = new core_1.Property({ name: "planeMaterial" }); const faceMaterialProperty = new core_1.Property({ name: "faceMaterial" }); const trackingImagesBundleProperty = new core_1.Property({ name: "trackingImagesBundle" }); const planeOpacityProperty = new core_1.Property({ name: "planeOpacity", defaultValue: 0.1 }); const planeDetectionProperty = new core_1.Property({ name: "planeDetection", defaultValue: "NONE" }); const showStatisticsProperty = new core_1.Property({ name: "showStatistics", defaultValue: false, valueConverter: core_1.booleanConverter }); class ARDimensions { constructor(x, y, z) { this.x = x; this.y = y; this.z = z; } } exports.ARDimensions = ARDimensions; class ARDimensions2D { constructor(x, y) { this.x = x; this.y = y; } } exports.ARDimensions2D = ARDimensions2D; class ARSize { constructor(width, height) { this.width = width; this.height = height; } } exports.ARSize = ARSize; class ARScale extends ARDimensions { } exports.ARScale = ARScale; class ARPosition extends ARDimensions { } exports.ARPosition = ARPosition; class ARRotation extends ARDimensions { } exports.ARRotation = ARRotation; class AR extends core_1.ContentView { static isSupported() { return false; } static isImageTrackingSupported() { return true; } static isFaceTrackingSupported() { return true; } [debugLevelProperty.setNative](value) { if (value) { this.setDebugLevel(value); } } [trackingModeProperty.setNative](value) { this.trackingMode = value; } [planeMaterialProperty.setNative](value) { this.planeMaterial = value; } [faceMaterialProperty.setNative](value) { this.faceMaterial = value; } [trackingImagesBundleProperty.setNative](value) { this.trackingImagesBundle = value; } [planeDetectionProperty.setNative](value) { this.planeDetection = value; } [showStatisticsProperty.setNative](value) { this.showStatistics = value; } [planeOpacityProperty.setNative](value) { if (!isNaN(value)) { this.planeOpacity = +value; } } } exports.AR = AR; AR.arLoadedEvent = "arLoaded"; AR.sceneTappedEvent = "sceneTapped"; AR.planeDetectedEvent = "planeDetected"; AR.planeTappedEvent = "planeTapped"; AR.trackingImageDetectedEvent = "trackingImageDetected"; AR.trackingFaceDetectedEvent = "trackingFaceDetected"; showStatisticsProperty.register(AR); planeDetectionProperty.register(AR); debugLevelProperty.register(AR); trackingModeProperty.register(AR); trackingImagesBundleProperty.register(AR); faceMaterialProperty.register(AR); planeMaterialProperty.register(AR); planeOpacityProperty.register(AR);