From 192a009cb0b0f1b34b39d7ba3a7d1d790867e677 Mon Sep 17 00:00:00 2001
From: Ariver <ar@MacBook-Air.local>
Date: Sun, 10 May 2026 23:11:39 +0800
Subject: [PATCH] Lock colorless container interactions
---
Apptag/ContentView.swift | 44 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/Apptag/ContentView.swift b/Apptag/ContentView.swift
index 7411edc..d5ab10b 100644
--- a/Apptag/ContentView.swift
+++ b/Apptag/ContentView.swift
@@ -204,6 +204,8 @@
@State private var draggedTagNames: [String] = [] // live drag order
@State private var dragItem: String? = nil // currently dragged tag
@State private var hoveredContainer: String? = nil // colored container lift
+ // Fixed interaction for "Colorless Container": hover fills persistently; click clears.
+ @State private var filledColorlessContainer: String? = nil
// Configurable defaults
@AppStorage("defaultGroupName") private var defaultGroupName = "Other"
@@ -337,10 +339,16 @@
ForEach(tagLabels) { tag in
TagPill(name: tag.name, colorIndex: tag.colorIndex,
action: {
+ if displayMode == "container" {
+ toggleColorlessFill(tag.id)
+ }
scrollTo(tag.id)
})
.onHover { hovering in
- if hovering { scrollTo(tag.id) }
+ if hovering {
+ fillColorlessContainer(tag.id)
+ scrollTo(tag.id)
+ }
}
}
}.padding(.horizontal, 24)
@@ -353,10 +361,16 @@
ForEach(tagLabels) { tag in
SideTagPill(name: tag.name, colorIndex: tag.colorIndex,
action: {
+ if displayMode == "container" {
+ toggleColorlessFill(tag.id)
+ }
scrollTo(tag.id)
})
.onHover { hovering in
- if hovering { scrollTo(tag.id) }
+ if hovering {
+ fillColorlessContainer(tag.id)
+ scrollTo(tag.id)
+ }
}
}
}.padding(12)
@@ -455,6 +469,8 @@
private func masonryCard(_ group: TagGroup, width: CGFloat) -> some View {
let isColored = displayMode == "coloredContainer"
+ let isColorless = displayMode == "container"
+ let isColorlessFilled = isColorless && filledColorlessContainer == group.name
let isHovered = hoveredContainer == group.name
let tagColor = Color(nsColor: TagColor.nsColor(for: tagColors[group.name] ?? 0))
return VStack(alignment: .leading, spacing: 6) {
@@ -485,7 +501,7 @@
.padding(16)
.background(
RoundedRectangle(cornerRadius: 14)
- .fill(isColored ? tagColor.opacity(0.30) : Color.clear)
+ .fill((isColored || isColorlessFilled) ? tagColor.opacity(0.30) : Color.clear)
.background(
RoundedRectangle(cornerRadius: 14)
.fill(.ultraThinMaterial)
@@ -501,7 +517,17 @@
.scaleEffect(isColored && isHovered ? 1.015 : 1.0)
.animation(.spring(response: 0.25, dampingFraction: 0.82), value: isHovered)
.onHover { hovering in
- hoveredContainer = hovering ? group.name : nil
+ if isColored {
+ hoveredContainer = hovering ? group.name : nil
+ } else if hovering {
+ fillColorlessContainer(group.name)
+ }
+ }
+ .contentShape(RoundedRectangle(cornerRadius: 14))
+ .onTapGesture {
+ if isColorlessFilled {
+ filledColorlessContainer = nil
+ }
}
}
@@ -767,6 +793,16 @@
withAnimation(.easeInOut(duration: 0.25)) { scrollProxy?.scrollTo(id, anchor: .top) }
}
+ private func fillColorlessContainer(_ id: String) {
+ guard displayMode == "container" else { return }
+ filledColorlessContainer = id
+ }
+
+ private func toggleColorlessFill(_ id: String) {
+ guard displayMode == "container" else { return }
+ filledColorlessContainer = (filledColorlessContainer == id) ? nil : id
+ }
+
func refreshApps() {
DispatchQueue.global(qos: .userInitiated).async {
var apps = AppIndexer.scan()
--
Gitblit v1.9.3