Commit a2fea002 authored by 范雪寒's avatar 范雪寒

feat: 选项大小

parent 85f1aaf6
...@@ -172,7 +172,7 @@ cc.Class({ ...@@ -172,7 +172,7 @@ cc.Class({
const canvasHeight = cc.find('Canvas').height; const canvasHeight = cc.find('Canvas').height;
const optionNum = this.data.question_arr[questionIdx].option_arr.length; const optionNum = this.data.question_arr[questionIdx].option_arr.length;
const maxOptionHeight = 500; const maxOptionHeight = 500;
const maxOptionWidth = canvasWidth / optionNum; const maxOptionWidth = (canvasWidth - 20) / optionNum;
const arr = randomSortByArr(this.data.question_arr[questionIdx].option_arr); const arr = randomSortByArr(this.data.question_arr[questionIdx].option_arr);
arr.forEach(async (option, idx) => { arr.forEach(async (option, idx) => {
...@@ -184,7 +184,7 @@ cc.Class({ ...@@ -184,7 +184,7 @@ cc.Class({
optionNode.parent = box; optionNode.parent = box;
cc.tween(optionNode) cc.tween(optionNode)
.to(0.1, { scale: Math.min((maxOptionWidth - 10) / optionNode.width, maxOptionHeight / optionNode.height) }) .to(0.1, { scale: Math.min(1, (maxOptionWidth - 10) / optionNode.width, maxOptionHeight / optionNode.height) })
.start(); .start();
}); });
}, },
......
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