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 {
Label,
......@@ -13,8 +13,6 @@ import {debounceTime} from 'rxjs/operators';
import TWEEN from '@tweenjs/tween.js';
@Component({
selector: 'app-play',
templateUrl: './play.component.html',
......@@ -57,7 +55,7 @@ export class PlayComponent implements OnInit, OnDestroy {
canvasLeft;
canvasTop;
saveKey = 'test_0011';
saveKey = 'pu09';
btnLeft;
......@@ -443,10 +441,7 @@ export class PlayComponent implements OnInit, OnDestroy {
* 添加预加载图片
*/
initImg() {
this.addUrlToImages(this.data.pic_url);
this.addUrlToImages(this.data.pic_url_2);
}
/**
......@@ -508,9 +503,25 @@ export class PlayComponent implements OnInit, OnDestroy {
pic.setScaleXY(this.mapScale);
pic.x = (pic.width / 2 - 100) * this.mapScale;
pic.y = this.canvasHeight - pic.height / 2 * this.mapScale + 50 * this.mapScale;
this.addScreenPicToBoard(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() {
const pic = new MySprite();
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