|
32 | 32 | fixedLineHeight: false,
|
33 | 33 | lineHeight: 14,
|
34 | 34 | rich: true,
|
35 |
| - breakAll: false |
| 35 | + overflow: 'break' |
36 | 36 | }
|
37 | 37 |
|
38 | 38 |
|
|
72 | 72 |
|
73 | 73 | const TEXTS = [LARGE_TEXT_EN, LARGE_TEXT_ZH];
|
74 | 74 | function update() {
|
75 |
| - enText.style.width = cnText.style.width = config.width; |
76 |
| - enText.style.height = cnText.style.height = config.height; |
77 |
| - |
78 |
| - enText.style.overflow = config.breakAll ? 'breakAll' : 'break'; |
79 |
| - |
80 | 75 | cnText.style.x = config.width + 100;
|
81 | 76 |
|
82 |
| - enText.style.rich = cnText.style.rich = config.rich ? { |
83 |
| - highlight: { |
84 |
| - // padding: 4, |
85 |
| - backgroundColor: 'yellow', |
86 |
| - fontSize: 20 |
87 |
| - } |
88 |
| - } : null; |
89 |
| - |
90 | 77 | [enText, cnText].forEach((text, idx) => {
|
91 |
| - text.style.fontSize = cnText.style.fontSize = config.fontSize; |
| 78 | + text.style.fontSize = config.fontSize; |
| 79 | + text.style.width = config.width; |
| 80 | + text.style.height = config.height; |
| 81 | + text.style.overflow = config.overflow; |
| 82 | + text.style.rich = config.rich ? { |
| 83 | + highlight: { |
| 84 | + // padding: 4, |
| 85 | + backgroundColor: 'yellow', |
| 86 | + fontSize: 20 |
| 87 | + } |
| 88 | + } : null; |
92 | 89 |
|
93 | 90 | if (config.search) {
|
94 | 91 | text.style.text = TEXTS[idx].replace(
|
|
121 | 118 | gui.add(config, 'fixedLineHeight').onChange(update);
|
122 | 119 | gui.add(config, 'lineHeight', 12, 50).onChange(update);
|
123 | 120 | gui.add(config, 'rich').onChange(update);
|
124 |
| - gui.add(config, 'breakAll').onChange(update); |
| 121 | + gui.add(config, 'overflow', ['break', 'breakAll', 'truncate', 'none']).onChange(update); |
125 | 122 |
|
126 | 123 | update();
|
127 | 124 | </script>
|
|
0 commit comments