Commit 697286ab authored by Tt's avatar Tt

文字大小一致

parent 902c5297
...@@ -2497,7 +2497,7 @@ ...@@ -2497,7 +2497,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 240, "width": 220,
"height": 80 "height": 80
}, },
"_anchorPoint": { "_anchorPoint": {
......
...@@ -517,6 +517,24 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -517,6 +517,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
layout_card.addChild(item); layout_card.addChild(item);
this.updateCard(item, dt); this.updateCard(item, dt);
}) })
// 设置所有文字的大小问题
this.scheduleOnce(() => {
let minFont = 999;
layout_card.children.forEach((item, i) => {
let data = item.data;
if (data.type != 'img_txt') return;
let text = pg.view.find(item, 'image_text_text');
let font = text.getComponent(cc.Label).actualFontSize;
if (minFont > font) minFont = font;
})
layout_card.children.forEach((item, i) => {
let data = item.data;
if (data.type != 'img_txt') return;
let text = pg.view.find(item, 'image_text_text');
text.getComponent(cc.Label).fontSize = minFont
text.getComponent(cc.Label).overflow = cc.Label.Overflow.NONE;
})
}, 0.01)
} }
updateCard(item, data) { updateCard(item, data) {
......
...@@ -5,15 +5,15 @@ export const defaultData = { ...@@ -5,15 +5,15 @@ export const defaultData = {
"title": "Which animal have wings?", "title": "Which animal have wings?",
"options": [ "options": [
{ {
"type": "txt", "type": "img_txt",
"image": "", "image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png",
"text": "bird", "text": "bird",
"audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3' "audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3'
}, },
{ {
"type": "img", "type": "img_txt",
"image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png", "image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png",
"text": "", "text": "interface",
"audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3' "audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3'
}, },
{ {
......
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