From e9e1c6c9ae114bbf7f92a18116e67fd953cd25b7 Mon Sep 17 00:00:00 2001 From: Fengda HUANG Date: Wed, 8 Feb 2017 12:42:20 +0800 Subject: [PATCH] fix page component --- src/pages/discover/exam-detail/exam-detail.ts | 6 +++--- src/pages/effect/paging-conponents.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/discover/exam-detail/exam-detail.ts b/src/pages/discover/exam-detail/exam-detail.ts index 162b937c..0f2ffd46 100644 --- a/src/pages/discover/exam-detail/exam-detail.ts +++ b/src/pages/discover/exam-detail/exam-detail.ts @@ -1,7 +1,7 @@ import {Component, ViewChild, ElementRef} from "@angular/core"; import {PageObject, AnimationReadyEvent} from "../../effect/paging-conponents"; import {BodyContent} from "./body-content"; -import {NavParams, NavController, GestureController, Animation} from "ionic-angular"; +import {NavParams, NavController, GestureController, Animation, Platform} from "ionic-angular"; import {QUIZS} from "../../../data/QUIZS"; import * as _ from "lodash"; @@ -22,7 +22,7 @@ export class ExamDetailPage { private allQuestions; private questionsWithShuffle; - constructor(public params: NavParams, public nav: NavController, public gestureController: GestureController) { + constructor(public params: NavParams, public nav: NavController, public gestureController: GestureController, public plt: Platform) { this.domain = params.get("domain"); this.allQuestions = QUIZS[this.domain]; this.questionsWithShuffle = this.shuffleQuestion(this.allQuestions); @@ -78,7 +78,7 @@ export class ExamDetailPage { private exchangeAnimation(previousIndex, selectedIndex) { let component = this.content.nativeElement.querySelectorAll('body-content > ion-nav ng-component'); let currentComponent = component[this.activeIndex]; - let componentAnimation = new Animation(currentComponent); + let componentAnimation = new Animation(this.plt, currentComponent); if (previousIndex >= selectedIndex) { componentAnimation diff --git a/src/pages/effect/paging-conponents.ts b/src/pages/effect/paging-conponents.ts index 8782b83b..eeb972a9 100644 --- a/src/pages/effect/paging-conponents.ts +++ b/src/pages/effect/paging-conponents.ts @@ -99,7 +99,7 @@ export class PagingComponent { let previousDistanceNeededToMove = this.currentAmountShiftedInPx; this.currentAmountShiftedInPx = centerPoint - selectedItemCenterPoint; - let animation = new Animation(this.container.nativeElement); + let animation = new Animation(this.plt, this.container.nativeElement); animation.fromTo("translateX", `${previousDistanceNeededToMove}px`, `${this.currentAmountShiftedInPx}px`); for (let i = 0; i < pagingCircleWrapperElements.length; i++) { @@ -111,7 +111,7 @@ export class PagingComponent { if (this.ignoreFirst) { this.ignoreFirst = false; } else { - let circleAnimation = new Animation(this.zoomCircleRef.nativeElement); + let circleAnimation = new Animation(this.plt, this.zoomCircleRef.nativeElement); let animationOriginY = pagingCircleWrapperElements[newIndex].nativeElement.offsetTop + SMALL_CIRCLE_DIAMETER / 2; let circleXOrigin = selectedItemCenterPoint - SMALL_CIRCLE_DIAMETER / 2; @@ -148,7 +148,7 @@ export class PagingComponent { } buildChildAnimation(selectedIndex:number, currentIndex:number, pagingCircleWrapperRef:ElementRef, originalOffset:number, newOffset:number) { - let animation = new Animation(pagingCircleWrapperRef.nativeElement); + let animation = new Animation(this.plt, pagingCircleWrapperRef.nativeElement); let circleElement = pagingCircleWrapperRef.nativeElement.children[0]; let innerCircleElement = circleElement.children[0]; let circleAnimation = new Animation(this.plt, circleElement);