Skip to content

Commit e0b44a5

Browse files
committed
修复编辑器描边宽度实时更新问题
问题:主页修改描边宽度后,编辑器中的文本描边没有实时更新 原因: - render_parameter_service导出参数时将stroke_width重命名为text_stroke_width - 但创建RenderConfig时没有映射回原字段名 - 导致config.render.stroke_width不存在,使用了默认值0.07 修复: - 在text_renderer_backend.py中添加字段名映射 - 将text_stroke_width映射回stroke_width - 将text_stroke_color映射回bg_color 现在主页修改描边宽度后,编辑器会立即重新渲染并应用新的描边宽度
1 parent af32e3e commit e0b44a5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

desktop_qt_ui/editor/text_renderer_backend.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ def render_text_for_region(text_block: TextBlock, dst_points: np.ndarray, transf
9494
config_data['font_color'] = f'#{rgb[0]:02x}{rgb[1]:02x}{rgb[2]:02x}'
9595
except (IndexError, TypeError):
9696
config_data.pop('font_color')
97+
98+
# ✅ 修复:将后端参数名映射回RenderConfig期望的字段名
99+
if 'text_stroke_width' in config_data:
100+
config_data['stroke_width'] = config_data.pop('text_stroke_width')
101+
if 'text_stroke_color' in config_data:
102+
config_data['bg_color'] = config_data.pop('text_stroke_color')
97103

98104
config_obj = Config(render=RenderConfig(**config_data)) if config_data else Config()
99105
line_spacing_from_params = render_params.get('line_spacing')

0 commit comments

Comments
 (0)