Commit df5698d3 authored by 李维's avatar 李维

dev commit

parent b77497c0
......@@ -506,10 +506,11 @@ export class HotZoneImageItem extends MySprite {
arrowTop;
arrowRight;
init(image_url = null, callback?){
init(image_url = null, callback?, handleSave?){
this.showImage(image_url, (img)=>{
callback && callback(img.width, img.height)
this.setSize(img.width*this.image.scaleX, img.height*this.image.scaleY)
handleSave && handleSave()
this.lineDashFlag = true;
this.showLineDash()
this.showLabel();
......
......@@ -50,11 +50,11 @@
</div>
<div style="float: left; display: flex; flex-direction: column; padding-left: 10px;">
<button style="flex:1; margin-bottom: 5px;" nz-button nzType="dashed" (click)="handleMoveItemUp($event, i)">
<button style="flex:1; margin-bottom: 5px;" nz-button nzType="dashed" (click)="handleMoveItemUp($event, i)" [disabled]="i==0">
<i nz-icon nzType="up" nzTheme="outline"></i>
上移
</button>
<button style="flex:1; margin-bottom: 5px;" nz-button nzType="dashed" (click)="handleMoveItemDown($event, i)">
<button style="flex:1; margin-bottom: 5px;" nz-button nzType="dashed" (click)="handleMoveItemDown($event, i)" [disabled]="i==hotZoneArr.length-1">
<i nz-icon nzType="down" nzTheme="outline"></i>
下移
</button>
......
......@@ -2,7 +2,7 @@
width: 100%;
height: 100%;
border-radius: 0.5rem;
min-width: 1000px;
min-width: 1200px;
border: 2px solid #ddd;
.preview-box {
margin: auto;
......
......@@ -219,23 +219,20 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
item.scaleY = (saveData.rect.height/saveData.scale) / h;
item.x = saveRect.x / saveData.scale + newRect.x
item.y = saveRect.y / saveData.scale + newRect.y
console.log(saveRect.x, saveRect.y, saveData.scale)
console.log(item.x, item.y, saveData.scale)
if(saveData.media.image_url.indexOf("bg_200_200") == -1){
item.image_url = saveData.media.image_url
}
});
item.image_url = saveData.media.image_url
item.audio_url = saveData.media.audio_url
item.card_audio_url = saveData.media.card_audio_url
}else{
item.init("assets/default/bg_200_200.png" , ()=>{
item.image_url = "assets/default/bg_200_200.png"
});
item.x = this.canvasWidth / 2 - 100;
item.y = this.canvasHeight / 2 - 100;
},()=>this.autoSave());
}
item.anchorX = 0.5;
item.anchorY = 0.5;
item.x = this.canvasWidth / 2 - 100;
item.y = this.canvasHeight / 2 - 100;
return item;
}
......@@ -268,6 +265,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
} else {
item.showLineDash();
}
this.autoSave()
})
return item;
}
......@@ -320,7 +318,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
const arr = this.hotZoneItemArr.concat();
for (let i = 0; i < arr.length; i++) {
const data = JSON.parse(JSON.stringify(arr[i]));
console.log(rate)
data.rect.x *= rate;
data.rect.y *= rate;
data.rect.width *= rate;
......@@ -338,7 +335,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
initImgArr() {
// console.log('this.imgItemArr: ', this.imgItemArr);
let curBgRect;
if (this.bg) {
curBgRect = this.bg.getBoundingBox();
......@@ -352,9 +348,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
}
const rate = curBgRect.width / oldBgRect.width;
// console.log('rate: ', rate);
this.imgArr = [];
const arr = this.imgItemArr.concat();
for (let i = 0; i < arr.length; i++) {
......@@ -381,7 +374,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
initData() {
this.canvasWidth = this.wrap.nativeElement.clientWidth;
this.canvasHeight = (this.wrap.nativeElement.clientWidth/2)*3;
console.log(this.canvasWidth , this.canvasHeight )
this.scale = 200/ this.wrap.nativeElement.clientWidth
this.mapScale = this.canvasWidth / this.canvasBaseW;
this.renderArr = [];
......@@ -674,10 +666,8 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
const currentY = hotZoneItem['rect'].y
hotZoneItem['media'] = {}
hotZoneItem['scale'] = this.scale
console.log((Math.round( (currentX - bgItem['rect'].x) * 100) / 100) , (Math.round( (currentY- bgItem['rect'].y) * 100) / 100), this.scale)
hotZoneItem['rect'].x = (Math.round( (currentX - bgItem['rect'].x) * 100) / 100) * this.scale;
hotZoneItem['rect'].y = (Math.round( (currentY - bgItem['rect'].y) * 100) / 100) * this.scale;
console.log(hotZoneItem['rect'].x , hotZoneItem['rect'].y)
hotZoneItem['rect'].width = (Math.round( (hotZoneItem['rect'].width) * 100) / 100) * this.scale;
hotZoneItem['rect'].height = (Math.round( (hotZoneItem['rect'].height) * 100) / 100) * this.scale;
hotZoneItem['media'].image_url = hotZoneArr[i].image_url
......
......@@ -453,7 +453,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element.ref.y = parent.originY + item.rect.y/parent.contentScale + (element.ref.height*element.ref.scaleY/2)
this.g_cartoon.getCartoonElement("quertion-image-container").ref.addChild(element.ref)
element.cardIndex = index;
element.ref.alpha = 1;
element.ref.alpha = 0;
element.card_audio = item.media.card_audio_url
element.currentClick = false;
element.isPlaced = false;
......
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