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 {
}
}
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 {
drawFrame() {
......
......@@ -14,7 +14,7 @@ import {
} from '@angular/core';
import {Subject} from 'rxjs';
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 {getMinScale} from '../../play/Unit';
import {tar} from 'compressing';
......@@ -500,9 +500,50 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
}
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 {
}
}
// 检测多矩形
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--) {
......@@ -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) {
this.curItem = item;
}
......@@ -1855,6 +1929,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
onMultRectSave(e, item) {
console.log(' in onMultRectSave: ', e);
item.multRect = e;
this.setItemMultRectByData(item, item.multRect);
}
......
......@@ -65,10 +65,10 @@ export class MultRectComponent implements OnDestroy, OnChanges {
this.rectArr.push(
{
color: this.colorArr[0].color,
width: 20,
height: 20,
x: 20,
y: 20,
width: 100,
height: 100,
x: -1,
y: -1,
}
)
......
......@@ -282,25 +282,28 @@
</div>
</div>
<div style="margin-top: 30px;"></div>
<h2>标记组合并识别设置(选填):</h2>
<div style="padding: 10px; border: 2px solid #ccc; border-radius: 10px; width: 350px;">
<div *ngIf="checkHasCombineGroup()" style="position: relative;">
<button nz-button nzType="default" nzShape="circle" (click)="addItemCombineGroup()" style="position: absolute; top: -40px; right: 0;">
<span nz-icon nzType="plus"></span>
</button>
<div style="margin-top: 40px;">
<div *ngFor="let cgItem of item.itemCombineGroup; let i = index" style="width: 100%; padding-right: 50px; position: relative; margin-top: 10px;">
<nz-select [(ngModel)]="item.itemCombineGroup[i]" nzMode="multiple" (ngModelChange)="onItemCombineGroupChange()" nzPlaceHolder="Please select" style="width: 100%;">
<nz-option *ngFor="let option of item.hotZoneItemArr2; let j = index" [nzLabel]="'sign-item-' + (j+1)" [nzValue]="j"></nz-option>
</nz-select>
<button nz-button nzType="danger" nzShape="circle" (click)="deleteItemCombineGroup(i)" style="position: absolute; right: 0;">
<span nz-icon nzType="delete"></span>
</button>
<div *ngIf="hasCombineGroup">
<div style="margin-top: 30px;"></div>
<h2>标记组合并识别设置(选填):</h2>
<div style="padding: 10px; border: 2px solid #ccc; border-radius: 10px; width: 350px;">
<div *ngIf="hasCombineGroup" style="position: relative;">
<button nz-button nzType="default" nzShape="circle" (click)="addItemCombineGroup()" style="position: absolute; top: -40px; right: 0;">
<span nz-icon nzType="plus"></span>
</button>
<div style="margin-top: 40px;">
<div *ngFor="let cgItem of item.itemCombineGroup; let i = index" style="width: 100%; padding-right: 50px; position: relative; margin-top: 10px;">
<nz-select [(ngModel)]="item.itemCombineGroup[i]" nzMode="multiple" (ngModelChange)="onItemCombineGroupChange()" nzPlaceHolder="Please select" style="width: 100%;">
<nz-option *ngFor="let option of item.hotZoneItemArr2; let j = index" [nzLabel]="'sign-item-' + (j+1)" [nzValue]="j"></nz-option>
</nz-select>
<button nz-button nzType="danger" nzShape="circle" (click)="deleteItemCombineGroup(i)" style="position: absolute; right: 0;">
<span nz-icon nzType="delete"></span>
</button>
</div>
</div>
</div>
</div>
</div>
<div style="margin-top: 30px;"></div>
......@@ -352,7 +355,13 @@
</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="display: flex; align-items: center; margin: 30px;">
......
......@@ -171,8 +171,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
{
name: '画圈区域',
rect: true,
isCopy: true
// multRect : true
isCopy: true,
multRect : true
},
{
......@@ -216,6 +216,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
]
typeArr = [];
hasCombineGroup = false;
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
......@@ -277,6 +278,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
this.item.circleSize = '1';
}
if (this.item.helpTime == null) {
this.item.helpTime = 10;
}
this.checkHasCombineGroup();
}
getAllGroupType() {
......@@ -328,16 +333,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
}
checkHasCombineGroup() {
let count = 0;
console.log(" this.hasCombineGroup : " + this.hasCombineGroup );
this.hasCombineGroup = false;
if (!this.item?.hotZoneItemArr) {
return false;
return ;
}
let count = 0;
this.item.hotZoneItemArr.forEach(item => {
item.gIdx == '4';
count++;
if (item.gIdx == '4') {
count++;
}
});
return count>1;
if (count >= 1) {
this.hasCombineGroup = true;
}
console.log("2 this.hasCombineGroup : " + this.hasCombineGroup );
}
onItemCombineGroupChange() {
......@@ -429,8 +446,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
this.item.itemCombineGroup = [];
this.getAllGroupType();
this.checkHasCombineGroup();
this.save();
}
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