Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
一直很喜欢PS的导航器 现在有AI可以自己开发了
大佬我将 我在X-AnyLabeling开发的 的导航器组件成功集成到 BallonsTranslator了
核心功能
缩略图预览:显示当前图像,矩形框标识可视区域 (颜色可自定义)
快速导航:点击/拖拽缩略图定位画布
缩放控制:滑块、输入框、滚轮控制缩放 (1%-1000%)
鼠标位置指示器:圆点实时显示画布鼠标位置 (颜色可自定义)
操作方式
Alt+Z:打开/关闭导航器
鼠标放在导航器上滚动滚轮:+/- 1% 缩放(以鼠标位置为中心)
鼠标放在导航器上按住Ctrl+滚动滚轮:+/- 5% 缩放
中键:弹出设置菜单
可自定义设置
鼠标指示器:开关、颜色、大小
视口框:颜色、对角线显示
配置持久化
窗口位置、大小及所有设置自动保存,重启后恢复。
修改的文件
ui/navigator_widget.py (新增)
ui/mainwindow.py
ui/mainwindowbars.py
ui/canvas.py
utils/config.py
配置持久化通过 BallonsTranslator 现有的配置系统实现:
在 ProgramConfig dataclass 中添加了导航器相关字段:
导航器设置
navigator_x: int = -1
navigator_y: int = -1
navigator_width: int = 240
navigator_height: int = 300
navigator_show_mouse_indicator: bool = True
navigator_mouse_indicator_size: int = 4
navigator_mouse_indicator_color: List = [255, 0, 0, 255]
navigator_show_viewport_cross: bool = False
navigator_viewport_color: List = [255, 0, 0, 255]
2. 保存时机 (navigator_widget.py)
在 NavigatorDialog.hideEvent 中,当导航器关闭时自动调用 save_config():
def hideEvent(self, event):
self._saved_geometry = self.geometry()
self.save_config() # 保存到配置文件
super().hideEvent(event)
3. 加载时机 (mainwindow.py)
在首次创建导航器时调用 load_config():
self.navigator_dialog = NavigatorDialog(self)
... 连接信号 ...
self.navigator_dialog.load_config() # 从配置文件加载
4. 存储位置
配置最终保存到 config/config.json 文件中,由 save_config() 函数序列化 pcfg 对象写入。
PS导航器有的功能咱都有 PS没有的咱也做了下增强
图片展示

视频 演示
bandicam.2025-12-20.21-55-10-513.mp4