“The point where the bar turns critical” is the critical threshold.
「条变成临界状态的那个点」就是临界阈值。
Prompt fragmentPrompt 片段
the NSLevelIndicator.criticalValue threshold where the capacity fill takes its native critical color
NSLevelIndicator.criticalValue 阈值:容量填充在此处变为原生临界色
4Rating symbol评分符号NSLevelIndicator.Style.rating
“Each star in the rating row” is a rating symbol in the level indicator.
「评分那排里的每颗星星」都是级别指示器里的一个评分符号。
Prompt fragmentPrompt 片段
the repeated rating symbols in NSLevelIndicator.Style.rating, filled through the current rating value
NSLevelIndicator.Style.rating 中重复的评分符号,按当前评分值填充
Prompt — paste into your agentPrompt —— 直接粘贴给你的代理
Use an NSLevelIndicator with the style that matches the meaning: .continuousCapacity or .discreteCapacity for a bounded level, .rating for stars, or .relevancy for match strength. Configure warningValue and criticalValue for native threshold coloring; SwiftUI's nearest general equivalent is Gauge.
Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时
Debug my macOS level indicator (NSLevelIndicator). Rule out: the wrong style — continuous capacity vs discrete ticks vs rating stars are one class with different levelIndicatorStyle values; warning and critical thresholds recoloring the fill unexpectedly; isEditable letting clicks change the value when it should be display-only; value changes not animating because the cell redraws instantly. The symptom:
# Level Indicator · 级别指示器
UI reference — https://K3tty5555.github.io/LearnUI_PM/macos/level-indicator/
**A Mac gauge rendered as a capacity bar, rating stars, or relevance meter**
Mac 上的量表:容量条、评分星星或相关度仪表
**Also called / 也叫:** level meter, capacity indicator, rating indicator, relevancy indicator / 级别仪表、容量指示器、评分指示器、相关度指示器
## Anatomy — every part, named / 解剖
1. **Filled level · 已填充量** (`NSLevelIndicator.doubleValue`)
“The colored amount inside the little meter” is the filled level.
「小仪表里有颜色的那部分」就是已填充量。
Prompt fragment: the filled level of an NSLevelIndicator, sized from its doubleValue within the configured range
2. **Warning threshold · 警告阈值** (`NSLevelIndicator.warningValue`)
“The point where the meter changes to a warning color” is the warning threshold.
「仪表变成警告颜色的那个点」就是警告阈值。
Prompt fragment: the NSLevelIndicator.warningValue threshold where the capacity fill changes to its native warning color
3. **Critical threshold · 临界阈值** (`NSLevelIndicator.criticalValue`)
“The point where the bar turns critical” is the critical threshold.
「条变成临界状态的那个点」就是临界阈值。
Prompt fragment: the NSLevelIndicator.criticalValue threshold where the capacity fill takes its native critical color
4. **Rating symbol · 评分符号** (`NSLevelIndicator.Style.rating`)
“Each star in the rating row” is a rating symbol in the level indicator.
「评分那排里的每颗星星」都是级别指示器里的一个评分符号。
Prompt fragment: the repeated rating symbols in NSLevelIndicator.Style.rating, filled through the current rating value
## Prompt / 提示词
Use an NSLevelIndicator with the style that matches the meaning: .continuousCapacity or .discreteCapacity for a bounded level, .rating for stars, or .relevancy for match strength. Configure warningValue and criticalValue for native threshold coloring; SwiftUI's nearest general equivalent is Gauge.
使用 NSLevelIndicator,样式要和含义匹配:有上限的量值用 .continuousCapacity 或 .discreteCapacity,星星评分用 .rating,匹配强度用 .relevancy。配置 warningValue 和 criticalValue 获得原生的阈值变色;SwiftUI 最接近的通用等价物是 Gauge。
## Debug prompt / 调试提示词
Debug my macOS level indicator (NSLevelIndicator). Rule out: the wrong style — continuous capacity vs discrete ticks vs rating stars are one class with different levelIndicatorStyle values; warning and critical thresholds recoloring the fill unexpectedly; isEditable letting clicks change the value when it should be display-only; value changes not animating because the cell redraws instantly. The symptom:
调试我的 macOS 级别指示器(NSLevelIndicator)。排除以下可能:样式用错——连续容量、离散刻度、评分星星是同一个类,只是 levelIndicatorStyle 值不同;警告和临界阈值意外改变了填充颜色;isEditable 让点击能改数值,而它本该只读展示;数值变化没有动画,因为 cell 瞬间重绘。症状是:
## In code / 代码里叫什么
- **AppKit** `NSLevelIndicator`
- **AppKit** `NSLevelIndicator.Style`
- **SwiftUI** `Gauge`