Ariver
2026-07-02 01bab5422712299b49f656e6b4c42a3bf314f519
src/Apptag/TagNavigationView.swift
@@ -5,6 +5,7 @@
    var id: String { name }
    let name: String
    let colorIndex: Int
    let customColor: TagCustomColor?
}
struct TagNavigationView: NSViewRepresentable {
@@ -402,7 +403,7 @@
    }
    required init?(coder: NSCoder) {
        self.item = TagNavigationItem(name: "", colorIndex: 0)
        self.item = TagNavigationItem(name: "", colorIndex: 0, customColor: nil)
        self.orientation = .horizontal
        super.init(coder: coder)
    }
@@ -497,16 +498,37 @@
        let start = Date()
        let longPressDuration: TimeInterval = 0.35
        let maxTrackingDuration: TimeInterval = 8
        var reorderActive = false
        var finished = false
        while !finished {
            guard let window,
                  window.isVisible,
                  NSApp.isActive,
                  Date().timeIntervalSince(start) < maxTrackingDuration
            else {
                if reorderActive {
                    onReorderEnded()
                }
                break
            }
            if !reorderActive && Date().timeIntervalSince(start) >= longPressDuration {
                reorderActive = true
                onReorderBegan(item.id)
            }
            let nextEvent = window?.nextEvent(
            if NSEvent.pressedMouseButtons & (1 << 0) == 0 {
                if reorderActive {
                    onReorderEnded()
                } else {
                    onActivate(item.id)
                }
                break
            }
            let nextEvent = window.nextEvent(
                matching: [.leftMouseDragged, .leftMouseUp],
                until: Date().addingTimeInterval(0.04),
                inMode: .eventTracking,
@@ -543,7 +565,7 @@
    }
    private func updateAppearance() {
        let background = TagColor.nsColor(for: item.colorIndex)
        let background = TagColor.nsColor(for: item.colorIndex, customColor: item.customColor)
        let dragScale: CGFloat = isDragging ? 1.04 : 1.0
        layer?.backgroundColor = background.cgColor
        layer?.cornerRadius = orientation == .horizontal ? 7 : 6
@@ -555,7 +577,7 @@
        layer?.setAffineTransform(CGAffineTransform(scaleX: dragScale, y: dragScale))
        alphaValue = dragModeActive ? (isDragging ? 1.0 : 0.62) : 1.0
        let textColor: NSColor = (item.colorIndex == 0 || item.colorIndex == 5) ? .labelColor : .white
        let textColor: NSColor = TagColor.prefersDarkText(for: background) ? .labelColor : .white
        let paragraph = NSMutableParagraphStyle()
        paragraph.alignment = alignment
        if orientation == .vertical {