Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP72
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
OP72
Commits
a2ad4ba3
Commit
a2ad4ba3
authored
Apr 13, 2023
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 符号修正
parent
0ed45c26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
4 deletions
+78
-4
OP72.js
assets/OP72/scene/OP72.js
+78
-4
No files found.
assets/OP72/scene/OP72.js
View file @
a2ad4ba3
...
...
@@ -1129,6 +1129,7 @@ cc.Class({
// case "4":
// // 符号
// this.curCheckGroup = this.CHECK_TYPE_SIGN;
// this.signRegions = signRegions ;
// this.initItemCombineGroup();
// break;
...
...
@@ -1231,6 +1232,7 @@ cc.Class({
case "4":
// 符号
para.sign_regions = signRegions;
this.signRegions = signRegions;
this.curCheckGroup = this.CHECK_TYPE_SIGN;
this.initItemCombineGroup();
break;
...
...
@@ -2191,10 +2193,20 @@ cc.Class({
return;
}
cons
t symbol = textArr[0]?.symbol
le
t symbol = textArr[0]?.symbol
if (!symbol) {
return;
}
const poly = textArr[0]?.poly
if (poly) {
symbol = this.resetSymbolData(symbol, poly);
}
if (symbol.length != this.signRegions.length) {
// 正常经过处理不会出现这种情况 没poly可能会出现这种情况
return;
}
// return
const answerData = {};
...
...
@@ -2205,8 +2217,8 @@ cc.Class({
const signDebugItem = this.signRectCheckArr[i];
const dropDownItem = signDebugItem.data.dropDownItem;
if (
!symbol[i]
) {
break
;
if (
symbol[i] == -1
) {
continue
;
}
const curSignKey = symbol[i].toString();
...
...
@@ -2263,6 +2275,67 @@ cc.Class({
// this.showCircleAnswer(answerData);
},
resetSymbolData(symbol, poly) {
if (symbol.length == this.signRegions.length) {
return symbol;
}
if (!this.signRegionRectArr) {
this.signRegionRectArr = [];
for (let i=0; i<this.signRegions.length; i++) {
const oneRegin = this.signRegions[i];
const reginRect = new cc.Rect();
reginRect.x = oneRegin.left;
reginRect.y = oneRegin.bottom;
reginRect.width = oneRegin.right - oneRegin.left;
reginRect.height = oneRegin.bottom - oneRegin.top;
this.signRegionRectArr.push(reginRect);
}
}
let signRegionRectArr = this.signRegionRectArr
const newSymbol = [];
for (let j=0; j<signRegionRectArr.length; j++) {
const reginRect = signRegionRectArr[j];
newSymbol[i] = -1;
for(let i=0; i<poly.length; i++) {
const oneSymbol = symbol[i];
const onePoly = poly[i];
const polyRect = new cc.Rect();
polyRect.x = onePoly.left;
polyRect.y = onePoly.bottom;
polyRect.width = onePoly.right - onePoly.left;
polyRect.height = onePoly.bottom - onePoly.top;
if (reginRect.intersects(polyRect)) {
newSymbol[i] = oneSymbol
break;
}
}
}
console.log('newSymbol: ' + JSON.stringify(newSymbol));
return newSymbol;
},
showSignAnswer(answerData) {
...
...
@@ -2300,6 +2373,7 @@ cc.Class({
},
showSign(node, isRight = true) {
console.log('in showCircle 1');
...
...
@@ -5261,7 +5335,7 @@ cc.Class({
getPhotoData(cb) {
cb ({"result":{"text":[{"
left":0.7829999923706055,"right":0.8629999756813049,"top":0.23106646537780762,"bottom":0.2905718684196472,"score":1,"content":"3","characters":[{"character":"3","centerLoc":[0.82299995,0.26081917],"poly":[0.783,0.23106647,0.863,0.29057187]}]},{"left":0.574999988079071,"right":0.6470000147819519,"top":0.23724883794784546,"bottom":0.2905718684196472,"score":1,"content":"1","characters":[{"character":"1","centerLoc":[0.611,0.26391035],"poly":[0.575,0.23724884,0.647,0.29057187]}]},{"left":0.35899999737739563,"right":0.43700000643730164,"top":0.23724883794784546,"bottom":0.2982998490333557,"score":1,"content":"4","characters":[{"character":"4","centerLoc":[0.398,0.26777434],"poly":[0.359,0.23724884,0.437,0.29829985]}]},{"left":0.14499999582767487,"right":0.2199999988079071,"top":0.24188563227653503,"bottom":0.299845427274704,"score":1,"content":"2","characters":[{"character":"2","centerLoc":[0.1825,0.27086553],"poly":[0.145,0.24188563,0.22,0.29984543]
}]}]}})
cb ({"result":{"text":[{"
symbol":[4,2,4,0,2,4],"poly":[{"left":0.2070000022649765,"right":0.27000001072883606,"top":0.2789798974990845,"bottom":0.3338485360145569},{"left":0.4860000014305115,"right":0.5490000247955322,"top":0.2751159071922302,"bottom":0.3338485062122345},{"left":0.7710000276565552,"right":0.8360000252723694,"top":0.27588871121406555,"bottom":0.3338485360145569},{"left":0.2070000022649765,"right":0.27000001072883606,"top":0.4459041655063629,"bottom":0.5038639903068542},{"left":0.4860000014305115,"right":0.550000011920929,"top":0.4459041655063629,"bottom":0.5054095983505249},{"left":0.7689999938011169,"right":0.8370000123977661,"top":0.442812979221344,"bottom":0.5046367645263672
}]}]}})
return;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment