Commit dc6f3c7e authored by liujiaxin's avatar liujiaxin

sdf

parent 1f67b77a
import { Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListener, AfterViewInit } from '@angular/core';
import { ChangeDetectorRef, ApplicationRef, Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListener, AfterViewInit } from '@angular/core';
import {
Label,
......@@ -41,7 +41,7 @@ export class PlayComponent implements OnInit, AfterViewInit, OnDestroy {
onResize(event) {
this.resetContainerItems();
}
constructor() {
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
this.rightAudio.src = 'assets/right.mp3';
this.rightAudio.load();
this.wrongAudio.src = 'assets/wrong.mp3';
......@@ -95,7 +95,9 @@ export class PlayComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
this.resetContainerItems();
......@@ -105,6 +107,11 @@ export class PlayComponent implements OnInit, AfterViewInit, OnDestroy {
}, this.saveKey);
}
refresh() {
setTimeout(() => {
this.appRef.tick();
}, 1);
}
move(el, to_x, to_y, cb?: () => void) {
// el.style.position = 'absolute';
const x = parseInt(el.offsetLeft, 10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment