Files
StellarX-kaifa/开发记录/功能变更/Feature-20260109-0002-删除Button尺寸别名API.md
T

67 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 功能变更 ID: Feature-20260109-0002
> 适用场景:记录小到中等规模的功能、接口、行为、默认值或配置变化。
> 不适用场景:新增核心模块、重大模块重构、架构级设计,请使用“新增功能模块”模板。
## 基本信息
- ID: Feature-20260109-0002
- 标题: 删除 Button 尺寸别名 API
- 状态:已完成(历史记录;本次仅归档,未重新验证)
- 类型:删除
- 级别:L2 中等
- 模块: Button / Control
- 版本 / 分支: v3.0.0 / master
- 环境: Windows 11 / Visual Studio 2022 / Debug、Release / EasyX
- 负责人: Ysm-04(历史实现)
## 变更背景
- 背景: Button 自身提供的 `getButtonWidth()` / `getButtonHeight()` 与基类 `Control::getWidth()` / `getHeight()` 的语义和返回值重复。
- 目标: 同一尺寸语义只保留基类正式入口,减少 API 冗余和派生类维护成本。
- 不做什么:[可选]
- 不改变 Button 的宽高字段、尺寸计算或绘制行为。
- 不提供旧名称的兼容包装函数。
## 变更内容
- 变更摘要: 删除 Button 层重复的尺寸获取方法,统一使用 Control 基类接口。
- 新增项:[可选]
- 无。
- 修改项:[可选]
- Button 宽高获取入口统一为 `getWidth()` / `getHeight()`。
- 删除 / 废弃项:[可选]
- `int Button::getButtonWidth() const`
- `int Button::getButtonHeight() const`
- 受影响的文件 / 类 / 函数:
- 历史路径:`include/StellarX/Button.h`
- `Button`、`Control::getWidth()`、`Control::getHeight()`
- 对外 API / 属性变化:[可选]
- 删除两个 Button 公共方法,属于源码级破坏性变更。
## 行为对照
- 变更前: 调用方既可通过 Button 专用别名,也可通过继承自 Control 的接口获取相同尺寸。
- 变更后: 只保留 `getWidth()` 和 `getHeight()`;读取的仍是同一组 `width` / `height` 状态。
- 兼容性说明:不兼容
- 迁移说明:[可选]
- `getButtonWidth()` -> `getWidth()`
- `getButtonHeight()` -> `getHeight()`
- 源码调用必须替换;若使用预编译库,升级后应重新编译和链接。
## 验证与落地
- 验证方式:
- 创建 Button 并设置尺寸,检查 `getWidth()` / `getHeight()` 返回值。
- 全量搜索并编译调用点,确认不存在已删除 API 的残留引用。
- 运行 Button 示例,观察布局、命中区域和重绘行为。
- 验证结果:
- PDF 记录了预期验证方式,但没有附带构建日志、测试报告或截图。
- 本次归档确认历史提交和 v3.0.0 更新日志包含该删除项,但没有重新构建旧版本。
- 关联 BUG / Fix:[可选]
- Commit: `5cb59b36525cde93de83313551296c6458694110`
- PR:[可选]
- 发布版本:[可选] v3.0.0
- 备注:[可选]
- 资料来源:`StellarX功能_模块变更.pdf` 第 16-18 页,并以对应提交和历史 `CHANGELOG.md` 交叉核对。