Commit 6ffeaf37 authored by 范雪寒's avatar 范雪寒

test:test

parent e1f61b7c
...@@ -100,7 +100,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -100,7 +100,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
@Input() @Input()
set bgItem(v) { set bgItem(v) {
this._bgItem = v; this._bgItem = v;
this.init();
} }
_bgItem2 = null; _bgItem2 = null;
...@@ -110,7 +109,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -110,7 +109,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
@Input() @Input()
set bgItem2(v) { set bgItem2(v) {
this._bgItem2 = v; this._bgItem2 = v;
this.init();
} }
onResize(event) { onResize(event) {
...@@ -186,23 +184,20 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -186,23 +184,20 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this.renderArr.push(this.bg); this.renderArr.push(this.bg);
} }
const bg = this.bg;
console.log('this.bgItem.url = ' + this.bgItem.url);
if (!this.bgItem.url) { if (!this.bgItem.url) {
callBack(); callBack();
return; return;
} }
bg.load(this.bgItem.url).then(() => { this.bg.load(this.bgItem.url).then(() => {
const rate1 = this.canvasWidth / bg.width; const rate1 = this.canvasWidth / this.bg.width;
const rate2 = this.canvasHeight / bg.height; const rate2 = this.canvasHeight / this.bg.height;
const rate = Math.min(rate1, rate2); const rate = Math.min(rate1, rate2);
bg.setScaleXY(rate); this.bg.setScaleXY(rate);
bg.x = this.canvasWidth / 2; this.bg.x = this.canvasWidth / 2;
bg.y = this.canvasHeight / 2; this.bg.y = this.canvasHeight / 2;
callBack(); callBack();
}); });
...@@ -214,24 +209,22 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -214,24 +209,22 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this.renderArr.push(this.bg2); this.renderArr.push(this.bg2);
} }
console.log('this.bgItem2.url = ' + this.bgItem2.url);
const bg2 = this.bg2;
if (!this.bgItem2.url) { if (!this.bgItem2.url) {
callBack(); callBack();
return; return;
} }
bg2.load(this.bgItem2.url).then(() => { this.bg2.load(this.bgItem2.url).then(() => {
const rate1 = this.canvasWidth / bg2.width; const rate1 = this.canvasWidth / this.bg2.width;
const rate2 = this.canvasHeight / bg2.height; const rate2 = this.canvasHeight / this.bg2.height;
const rate = Math.min(rate1, rate2); const rate = Math.min(rate1, rate2);
bg2.setScaleXY(rate); this.bg2.setScaleXY(rate);
bg2.alpha = 0.5; this.bg2.alpha = 0.5;
bg2.x = this.canvasWidth / 2; this.bg2.x = this.canvasWidth / 2;
bg2.y = this.canvasHeight / 2; this.bg2.y = this.canvasHeight / 2;
callBack(); callBack();
}); });
...@@ -452,7 +445,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -452,7 +445,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this.bgItem2 = {}; this.bgItem2 = {};
} }
this.refreshBackground(() => { this.refreshBackground(() => {
console.log('汪汪汪')
if (!this.hotZoneItemArr) { if (!this.hotZoneItemArr) {
this.hotZoneItemArr = []; this.hotZoneItemArr = [];
} else { } else {
...@@ -478,8 +470,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -478,8 +470,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
const rate = curBgRect.width / oldBgRect.width; const rate = curBgRect.width / oldBgRect.width;
console.log('rate: ', rate);
this.hotZoneArr = []; this.hotZoneArr = [];
const arr = this.hotZoneItemArr.concat(); const arr = this.hotZoneItemArr.concat();
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
......
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