Commit daa46f8c authored by limingzhe's avatar limingzhe

fix: debug

parent e6ea94c9
No preview for this file type
{"ver":"1.1.2","uuid":"5bbfa58c-397c-411f-b8e0-56870acd31fc","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}} {
\ No newline at end of file "ver": "1.1.2",
"uuid": "5bbfa58c-397c-411f-b8e0-56870acd31fc",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
...@@ -2141,6 +2141,52 @@ export class HotZoneItem extends MySprite { ...@@ -2141,6 +2141,52 @@ export class HotZoneItem extends MySprite {
} }
} }
export class HotZoneMultRect extends HotZoneItem {
item;
drawLine() {
if (!this.item) {
return;
}
this.ctx.save();
const rect = this.getBoundingBox();
const w = rect.width;
const h = rect.height;
const x = rect.x //+ w / 2;
const y = rect.y //+ h / 2;
this.ctx.setLineDash([4, 4]);
this.ctx.lineWidth = 1;
this.ctx.strokeStyle = '#ffa568';
this.ctx.beginPath();
this.ctx.moveTo( x + w / 2 , y + h / 2 );
this.ctx.lineTo(this.item.x, this.item.y);
// this.ctx.fill();
this.ctx.stroke();
this.ctx.restore();
}
draw() {
super.draw();
if (this.lineDashFlag) {
this.drawLine();
}
}
}
export class HotZoneImg extends MySprite { export class HotZoneImg extends MySprite {
drawFrame() { drawFrame() {
......
...@@ -14,7 +14,7 @@ import { ...@@ -14,7 +14,7 @@ import {
} from '@angular/core'; } from '@angular/core';
import {Subject} from 'rxjs'; import {Subject} from 'rxjs';
import {debounceTime, retryWhen} from 'rxjs/operators'; import {debounceTime, retryWhen} from 'rxjs/operators';
import {DragItem, EditorItem, HotZoneImg, HotZoneItem, HotZoneLabel, Label, MySprite, removeItemFromArr, ShapeCircle, ShapeRect, ShapeRectNew} from './Unit'; import {DragItem, EditorItem, HotZoneImg, HotZoneItem, HotZoneLabel, HotZoneMultRect, Label, MySprite, removeItemFromArr, ShapeCircle, ShapeRect, ShapeRectNew} from './Unit';
import TWEEN from '@tweenjs/tween.js'; import TWEEN from '@tweenjs/tween.js';
import {getMinScale} from '../../play/Unit'; import {getMinScale} from '../../play/Unit';
import {tar} from 'compressing'; import {tar} from 'compressing';
...@@ -500,9 +500,50 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -500,9 +500,50 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
} }
setItemMultRect(item, saveData) { setItemMultRect(item, saveData) {
if (saveData && saveData.itemMultRect) {
console.log(" in setItemMultRect")
if (saveData && saveData.multRect) {
this.setItemMultRectByData(item, saveData.multRect);
console.log("multRect ~", saveData.multRect);
}
}
setItemMultRectByData(item, multRectArr) {
const arr = [];
for (let i=0; i<multRectArr.length; i++) {
const multRectData = multRectArr[i];
const multRect = new HotZoneMultRect(this.ctx);
multRect.showLineDash();
multRect.setSize(multRectData.width, multRectData.height);
multRect.anchorX = 0.5;
multRect.anchorY = 0.5;
multRect.rectEdgeColor = multRectData.color;
multRect.showLabel("M-" + (i+1));
multRect.item = item;
multRect.visible = true;
if (multRectData.x == -1 && multRectData.y == -1) {
multRect.x = item.x + multRect.width * i * 0.3;
multRect.y = item.y + multRect.width * i * 0.3;
} else {
multRect.x = multRectData.x;
multRect.y = multRectData.y;
}
this.renderArr.push(multRect);
arr.push(multRect);
} }
item.multRectArr = arr;
} }
...@@ -917,6 +958,22 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -917,6 +958,22 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
} }
} }
// 检测多矩形
for (let i = this.hotZoneArr.length - 1; i >= 0; i--) {
const item = this.hotZoneArr[i];
if (item && item.multRectArr) {
for (let j=item.multRectArr.length - 1; j>=0; j--) {
if (this.checkClickTarget(item.multRectArr[j])) {
this.clickedMultRect(item.multRectArr[j]);
return;
}
}
}
}
for (let i = this.hotZoneArr.length - 1; i >= 0; i--) { for (let i = this.hotZoneArr.length - 1; i >= 0; i--) {
...@@ -1801,6 +1858,23 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -1801,6 +1858,23 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
} }
} }
private clickedMultRect(multRect: any) {
if (this.checkClickTarget(multRect)) {
if (multRect.lineDashFlag && this.checkClickTarget(multRect.arrow)) {
this.changeItemSize(multRect);
}
else if (multRect.lineDashFlag && this.checkClickTarget(multRect.arrowTop)) {
this.changeItemTopSize(multRect);
} else if (multRect.lineDashFlag && this.checkClickTarget(multRect.arrowRight)) {
this.changeItemRightSize(multRect);
} else {
this.changeCurItem(multRect);
}
return;
}
}
clickedDragPoint(item) { clickedDragPoint(item) {
this.curItem = item; this.curItem = item;
} }
...@@ -1855,6 +1929,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -1855,6 +1929,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
onMultRectSave(e, item) { onMultRectSave(e, item) {
console.log(' in onMultRectSave: ', e); console.log(' in onMultRectSave: ', e);
item.multRect = e; item.multRect = e;
this.setItemMultRectByData(item, item.multRect);
} }
......
...@@ -65,10 +65,10 @@ export class MultRectComponent implements OnDestroy, OnChanges { ...@@ -65,10 +65,10 @@ export class MultRectComponent implements OnDestroy, OnChanges {
this.rectArr.push( this.rectArr.push(
{ {
color: this.colorArr[0].color, color: this.colorArr[0].color,
width: 20, width: 100,
height: 20, height: 100,
x: 20, x: -1,
y: 20, y: -1,
} }
) )
......
...@@ -282,25 +282,28 @@ ...@@ -282,25 +282,28 @@
</div> </div>
</div> </div>
<div style="margin-top: 30px;"></div> <div *ngIf="hasCombineGroup">
<h2>标记组合并识别设置(选填):</h2> <div style="margin-top: 30px;"></div>
<div style="padding: 10px; border: 2px solid #ccc; border-radius: 10px; width: 350px;"> <h2>标记组合并识别设置(选填):</h2>
<div *ngIf="checkHasCombineGroup()" style="position: relative;"> <div style="padding: 10px; border: 2px solid #ccc; border-radius: 10px; width: 350px;">
<button nz-button nzType="default" nzShape="circle" (click)="addItemCombineGroup()" style="position: absolute; top: -40px; right: 0;"> <div *ngIf="hasCombineGroup" style="position: relative;">
<span nz-icon nzType="plus"></span> <button nz-button nzType="default" nzShape="circle" (click)="addItemCombineGroup()" style="position: absolute; top: -40px; right: 0;">
</button> <span nz-icon nzType="plus"></span>
<div style="margin-top: 40px;"> </button>
<div *ngFor="let cgItem of item.itemCombineGroup; let i = index" style="width: 100%; padding-right: 50px; position: relative; margin-top: 10px;"> <div style="margin-top: 40px;">
<nz-select [(ngModel)]="item.itemCombineGroup[i]" nzMode="multiple" (ngModelChange)="onItemCombineGroupChange()" nzPlaceHolder="Please select" style="width: 100%;"> <div *ngFor="let cgItem of item.itemCombineGroup; let i = index" style="width: 100%; padding-right: 50px; position: relative; margin-top: 10px;">
<nz-option *ngFor="let option of item.hotZoneItemArr2; let j = index" [nzLabel]="'sign-item-' + (j+1)" [nzValue]="j"></nz-option> <nz-select [(ngModel)]="item.itemCombineGroup[i]" nzMode="multiple" (ngModelChange)="onItemCombineGroupChange()" nzPlaceHolder="Please select" style="width: 100%;">
</nz-select> <nz-option *ngFor="let option of item.hotZoneItemArr2; let j = index" [nzLabel]="'sign-item-' + (j+1)" [nzValue]="j"></nz-option>
<button nz-button nzType="danger" nzShape="circle" (click)="deleteItemCombineGroup(i)" style="position: absolute; right: 0;"> </nz-select>
<span nz-icon nzType="delete"></span> <button nz-button nzType="danger" nzShape="circle" (click)="deleteItemCombineGroup(i)" style="position: absolute; right: 0;">
</button> <span nz-icon nzType="delete"></span>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div style="margin-top: 30px;"></div> <div style="margin-top: 30px;"></div>
...@@ -352,7 +355,13 @@ ...@@ -352,7 +355,13 @@
</div> </div>
<div style="margin-top: 30px; width: 300px; border: 1px solid #ccc ; border-radius: 5px;">
<div style="display: flex; justify-content: center; align-items: center; height: 50px">
<span style="width: 120px; margin-right: 10px;" align="right">帮助提示间隔(秒): </span>
<input type="text" nz-input [(ngModel)]="item.helpTime" (blur)="save()" style="margin-right: 15px; width: 100px ">
</div>
</div>
<div style="margin-top: 30px; width: 300px; height: 50px; border: 1px solid #ccc ; border-radius: 5px; display: flex; align-items: center; "> <div style="margin-top: 30px; width: 300px; height: 50px; border: 1px solid #ccc ; border-radius: 5px; display: flex; align-items: center; ">
<div style="display: flex; align-items: center; margin: 30px;"> <div style="display: flex; align-items: center; margin: 30px;">
......
...@@ -171,8 +171,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -171,8 +171,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
{ {
name: '画圈区域', name: '画圈区域',
rect: true, rect: true,
isCopy: true isCopy: true,
// multRect : true multRect : true
}, },
{ {
...@@ -216,6 +216,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -216,6 +216,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
] ]
typeArr = []; typeArr = [];
hasCombineGroup = false;
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) { constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
...@@ -277,6 +278,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -277,6 +278,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
this.item.circleSize = '1'; this.item.circleSize = '1';
} }
if (this.item.helpTime == null) {
this.item.helpTime = 10;
}
this.checkHasCombineGroup();
} }
getAllGroupType() { getAllGroupType() {
...@@ -328,16 +333,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -328,16 +333,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
} }
checkHasCombineGroup() { checkHasCombineGroup() {
let count = 0;
console.log(" this.hasCombineGroup : " + this.hasCombineGroup );
this.hasCombineGroup = false;
if (!this.item?.hotZoneItemArr) { if (!this.item?.hotZoneItemArr) {
return false; return ;
} }
let count = 0;
this.item.hotZoneItemArr.forEach(item => { this.item.hotZoneItemArr.forEach(item => {
item.gIdx == '4'; if (item.gIdx == '4') {
count++; count++;
}
}); });
return count>1; if (count >= 1) {
this.hasCombineGroup = true;
}
console.log("2 this.hasCombineGroup : " + this.hasCombineGroup );
} }
onItemCombineGroupChange() { onItemCombineGroupChange() {
...@@ -429,8 +446,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -429,8 +446,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
this.item.itemCombineGroup = []; this.item.itemCombineGroup = [];
this.getAllGroupType(); this.getAllGroupType();
this.checkHasCombineGroup();
this.save(); this.save();
} }
saveHotZone2(group, e) { saveHotZone2(group, e) {
......
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