Commit eff49446 authored by Seaborn Lee's avatar Seaborn Lee

style: 显示用户上传的图片

parent 6afb1b57
import {Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListener} from '@angular/core'; import {Component, ElementRef, HostListener, OnDestroy, OnInit, ViewChild} from '@angular/core';
import { import {
Label, Label,
...@@ -13,8 +13,6 @@ import {debounceTime} from 'rxjs/operators'; ...@@ -13,8 +13,6 @@ import {debounceTime} from 'rxjs/operators';
import TWEEN from '@tweenjs/tween.js'; import TWEEN from '@tweenjs/tween.js';
@Component({ @Component({
selector: 'app-play', selector: 'app-play',
templateUrl: './play.component.html', templateUrl: './play.component.html',
...@@ -57,7 +55,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -57,7 +55,7 @@ export class PlayComponent implements OnInit, OnDestroy {
canvasLeft; canvasLeft;
canvasTop; canvasTop;
saveKey = 'test_0011'; saveKey = 'pu09';
btnLeft; btnLeft;
...@@ -443,10 +441,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -443,10 +441,7 @@ export class PlayComponent implements OnInit, OnDestroy {
* 添加预加载图片 * 添加预加载图片
*/ */
initImg() { initImg() {
this.addUrlToImages(this.data.pic_url); this.addUrlToImages(this.data.pic_url);
this.addUrlToImages(this.data.pic_url_2);
} }
/** /**
...@@ -508,9 +503,25 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -508,9 +503,25 @@ export class PlayComponent implements OnInit, OnDestroy {
pic.setScaleXY(this.mapScale); pic.setScaleXY(this.mapScale);
pic.x = (pic.width / 2 - 100) * this.mapScale; pic.x = (pic.width / 2 - 100) * this.mapScale;
pic.y = this.canvasHeight - pic.height / 2 * this.mapScale + 50 * this.mapScale; pic.y = this.canvasHeight - pic.height / 2 * this.mapScale + 50 * this.mapScale;
this.addScreenPicToBoard(pic);
this.renderArr.push(pic); this.renderArr.push(pic);
} }
private addScreenPicToBoard(board: MySprite) {
const pic = new MySprite();
pic.init(this.images.get(this.data.pic_url));
const scaleX = 565 / pic.width;
const scaleY = 373 / pic.height;
const scale = Math.min(scaleX, scaleY);
pic.setScaleXY(scale);
pic.y = -138;
board.addChild(pic);
}
private initBg() { private initBg() {
const pic = new MySprite(); const pic = new MySprite();
pic.init(this.images.get('bg')); pic.init(this.images.get('bg'));
......
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