File

src/app/models/cabri-integration-lirelheure.ts

Constructor

constructor(cabriService: CabriDataService, globalService: GlobalService, _ngZone: NgZone, page: any, renderer: Renderer2)

Methods

updateCabriPosition
updateCabriPosition(holoMode: string)

RESIZE CABRI (from CM) -> Update DOM Cabri elements

Parameters :
  • holoMode

    Holo mode

  • platform

    Platform

Returns: any
onBabylonReady
onBabylonReady()
Returns: any
updateCabriBackground
updateCabriBackground(renderCanvas: any, condition: any)
Returns: void
checkActivityChange
checkActivityChange()
Returns: boolean
saveDom
saveDom()
Returns: void
restoreDom
restoreDom()
Returns: void
getCurrentOperation
getCurrentOperation()
Returns: string
clearResponse
clearResponse(mode: string, value: any)
Returns: any
setResponse
setResponse(mode: string, value: any)
Returns: void

Properties

_ngZone
_ngZone: NgZone
cabriService
cabriService: CabriDataService
globalService
globalService: GlobalService
page
page: any
renderer
renderer: Renderer2
import { CabriIntegration } from "./cabri-integration";
import { CabriDataService } from "../services/cabri-data.service";
import { GlobalService } from "../services/global.service";
import { Platform } from "@ionic/angular";
import { ElementRef, NgZone, Renderer2 } from "@angular/core";

declare var window: {
	store: any;
	document: any;
	innerWidth: any;
	innerHeight: any;
	outerWidth: any;
	outerHeight: any;
};

export class CabriIntegrationLirelheure extends CabriIntegration {
	constructor(
		public cabriService: CabriDataService,
		public globalService: GlobalService,
		public _ngZone: NgZone,
		public page,
		public renderer: Renderer2
	) {
		super(cabriService, globalService, _ngZone, page, renderer);
		this.page = page;
		this.cabriRenderStarted = true;
	}

	/**
	 * RESIZE CABRI (from CM) -> Update DOM Cabri elements
	 * @param holoMode Holo mode
	 * @param platform Platform
	 */
	updateCabriPosition(holoMode: string = null): Promise<void> {
		return super.updateCabriPosition(holoMode, "heure");
	}

	onBabylonReady(): Promise<void> {
		return new Promise(async (resolve, reject) => {
			await super.onBabylonReady();
			await this.importMascotteMeshes(1.14, 1.2);
			this.scene.onAfterRenderObservable.addOnce(() => {
				this.unlockRotation();
				this.camera.alpha = -Math.PI / 2;
				window.store.getters.cps.setPageOrientation(this.camera.alpha, this.camera.beta);
				this.replaceCabriLights();
				resolve();
			});
		});
	}

	async updateCabriBackground(renderCanvas, condition) {
		window.store.getters.cabri.Scene.meshes.forEach(async m => {
			if (m.id === "background") {
				// background width proportion = 4096/3072 = 1.333333:
				if (condition === 2) {
					m.scaling.x = 1.1;
					m.scaling.z = 1.1;
				}
				this.checkFlatHoloMode(m);
				await this.switchBackgroundLauncher(m, renderCanvas.clientHeight, renderCanvas.clientWidth);
				console.log("cabri background resized");
			}
		});
	}

	checkActivityChange(): boolean {
		return true;
		const activityChange =
			this.cabriService.currentSavedDom !== "lirelheure" ||
			this.cabriService.savedDomHoloMode !== this.cabriService.holoMode ||
			this.cabriService.savedDomMirrorMode !== this.cabriService.mirrorMode;
		// console.log("checkActivityChange = " + activityChange);
		return activityChange;
	}

	saveDom() {
		super.saveDom();
		this.cabriService.currentSavedDom = "lirelheure";
	}

	restoreDom() {
		super.restoreDom();
		this.startRender();
	}
	getCurrentOperation(): string {
		let str = "";

		const nbGR = window.store.getters.cps.getValueByName("v-good-responses").value;
		const a = window.store.getters.cps.getValueByName("v-first-number").value;
		const c = window.store.getters.cps.getValueByName("v-operation").value;
		const pas = window.store.getters.cps.getValueByName("v-pas").value;

		str = a + nbGR * c * pas + (c > 0 ? " + " : " - ") + pas;
		return str;
	}

	clearResponse(mode: string, value: any): Promise<any> {
		return;
	}

	setResponse(mode: string, value: any) {
		// display response
	}
}

results matching ""

    No results matching ""