Commit 938b7318 authored by limingzhe's avatar limingzhe

fix: debug

parent b9c88b34
No preview for this file type
......@@ -632,6 +632,49 @@ cc.Class({
},
getRegionByRect(regionRect, bgRect) {
const left = Math.round( (regionRect.x ) / bgRect.width * 1000 ) / 1000;
const right = Math.round( (regionRect.x + regionRect.width) / bgRect.width * 1000 ) / 1000;
const top = Math.round( (regionRect.y ) / bgRect.height * 1000 ) / 1000;
const bottom = Math.round( (regionRect.y + regionRect.height) / bgRect.height * 1000 ) / 1000;
return {left, top, right, bottom};
},
getGroupArrByGIdx(arr, gIdx) {
const groupArr = [];
for (let i=0; i<arr.length; i++) {
if (arr[i].gIdx == gIdx) {
const data = JSON.parse(JSON.stringify(arr[i]));
groupArr.push(data);
}
}
return groupArr;
},
getRegionsByGidx(gIdx) {
const arr = this.getGroupArrByGIdx(this.data.hotZoneItemArr2, gIdx);
const bgRect = this.data.bgItem2.rect;
console.log("arr:", arr);
const newLocationArr = [];
for (let i=0; i<arr.length; i++) {
const hzItem = arr[i];
const regionRect = hzItem.rect;
let region = this.getRegionByRect(regionRect, bgRect);
newLocationArr.push(region)
}
return newLocationArr;
},
//调起检测
startTesting() {
......@@ -653,6 +696,10 @@ cc.Class({
// return;
const partRegions = this.getRegionsByGidx('2');
console.log('partRegions: ', partRegions);
const cw = window.courseware;
if (!cw || !cw.openOsmoHandwriting) {
......@@ -671,7 +718,8 @@ cc.Class({
"part_name": this.data.part_name, //"d",
"is_hand_writing": true,
"is_line_link": false,
"write_regions": [this.ques_region_opt],
// "write_regions": [this.ques_region_opt],
"write_regions": [partRegions],
lineType,
circleSize
......
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