fix: 优化点位展示、选择滚动和收款信息

This commit is contained in:
2026-11-04 11:13:12 +08:00
parent 7a63ea3432
commit 1c766ff12f
7 changed files with 116 additions and 38 deletions
@@ -69,7 +69,9 @@ final class DroneMaterialFilterCell: UICollectionViewCell {
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
/// 映射筛选名称、选中态与交互许可。
func apply(title: String, id: String?, selected: Bool, locked: Bool) {
func apply(title: String, id: String?, selected: Bool, locked: Bool, wrapsTitle: Bool = false) {
titleLabel.numberOfLines = wrapsTitle ? 0 : 1
titleLabel.lineBreakMode = wrapsTitle ? .byWordWrapping : .byTruncatingTail
titleLabel.text = title
titleLabel.textColor = selected ? DroneDockStyle.primary : UIColor(hex: 0x677183)
contentView.backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.09) : .white
@@ -82,6 +84,15 @@ final class DroneMaterialFilterCell: UICollectionViewCell {
if locked { traits.insert(.notEnabled) }
accessibilityTraits = traits
}
/// 云端交付点位在限定宽度内完整换行,短名称保留紧凑卡片。
static func wrappedSize(title: String, maximumWidth: CGFloat) -> CGSize {
let font = UIFont.systemFont(ofSize: 13, weight: .medium)
let width = min(maximumWidth, ceil((title as NSString).size(withAttributes: [.font: font]).width) + 10)
let bounds = (title as NSString).boundingRect(with: CGSize(width: max(1, width - 10), height: .greatestFiniteMagnitude),
options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.font: font], context: nil)
return CGSize(width: width, height: max(40, ceil(bounds.height) + 10))
}
}
/// 点位限定入口的只读提示,不将当前任务点位伪装成可切换筛选。