Skip to content

Commit d2d3752

Browse files
committed
updated
1 parent f0456ea commit d2d3752

File tree

6 files changed

+7
-65
lines changed

6 files changed

+7
-65
lines changed

Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"location" : "https://github.com/flocked/FZUIKit.git",
2626
"state" : {
2727
"branch" : "main",
28-
"revision" : "2d9103d4c655594313d77b220191afe9ca6de036"
28+
"revision" : "b7587758799644fec18437527526b5f964a8900e"
2929
}
3030
}
3131
],

Example/Example/TableSidebarViewController.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ class TableSidebarViewController: NSViewController {
4646
/// Enables deleting selected rows via backspace key.
4747
dataSource.deletingHandlers.canDelete = { selectedItems in return selectedItems }
4848

49-
dataSource.draggingHandlers.canDrag = { items in return true }
50-
dataSource.draggingHandlers.pasteboardContent = { item in return ["Fun"] }
51-
52-
dataSource.droppingHandlers.canDrop = { !$0.content.strings.isEmpty }
53-
dataSource.droppingHandlers.items = { $0.content.strings.compactMap({ SidebarItem($0, symbolName: "photo") }) }
54-
dataSource.droppingHandlers.didDrop = { dropInfo, items, transaction in
55-
Swift.print("didDrop")
56-
}
57-
5849
/// Swipe row actions for deleting and favoriting an item.
5950
dataSource.rowActionProvider = { swippedItem, edge in
6051
if edge == .leading {

Sources/AdvancedCollectionTableView/Configuration/Configurations/NSListContentConfiguration/Accessory/Accessories/TextStackAccessory.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,5 @@ struct TextStackAccessory {
112112
public var trailingTextProperties: TextProperties = .primary
113113

114114
/// The spacing between the leading and trailing text.
115-
public var leadingToTrailingTextSpacing: CGFloat = 4.0
116-
117-
var trailingText: String?
115+
public var leadingToTrailingTextSpacing: CGFloat = 4.0
118116
}

Sources/AdvancedCollectionTableView/DiffableDataSource/NSCollectionView/CollectionViewDiffableDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ open class CollectionViewDiffableDataSource<Section: Identifiable & Hashable, El
10741074
public var animates: Bool = true
10751075

10761076
/// A Boolean value that indicates whether the items for the proposed drop elements are previewed.
1077-
public var previewDroppedElements = true
1077+
public var previewDroppedElements = false
10781078

10791079
/// The handler that determines whether the proposed drop can be dropped to an element.
10801080
public var canDropInto: ((_ dropInfo: DropInfo, _ element: Element) -> Bool)?

Sources/AdvancedCollectionTableView/DiffableDataSource/NSOutlineView/OutlineViewDiffableDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ public class OutlineViewDiffableDataSource<ItemIdentifierType: Hashable>: NSObje
10601060
public var animates: Bool = false
10611061

10621062
/// A Boolean value that indicates whether the rows for the proposed drop items are previewed.
1063-
public var previewDroppedItems = true
1063+
public var previewDroppedItems = false
10641064

10651065
/// A Boolean value that indicates whether the dropped items are previewed.
10661066
public var previewItems = true

Sources/AdvancedCollectionTableView/DiffableDataSource/NSTableView/TableViewDiffableDataSource.swift

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,7 @@ open class TableViewDiffableDataSource<Section, Item>: NSObject, NSTableViewData
320320
public func previewImage(for item: Item) -> NSImage? {
321321
let columns = tableView.tableColumns
322322
guard !columns.isEmpty else { return nil }
323-
324-
Swift.print("previewImage", columns.count, columns.compactMap({ previewImage(for: item, tableColumn: $0, useColumnWidth: $0 !== columns.last!)?.size}).alignHorizontal(alignment: .top), NSImage(combineHorizontalAlt: columns.compactMap({ previewImage(for: item, tableColumn: $0, useColumnWidth: $0 !== columns.last!) }), alignment: .top)?.size ?? "nil")
325-
return NSImage(combineHorizontalAlt: columns.compactMap({ previewImage(for: item, tableColumn: $0, useColumnWidth: $0 !== columns.last!) }), alignment: .top)
323+
return NSImage(combineHorizontal: columns.compactMap({ previewImage(for: item, tableColumn: $0, useColumnWidth: $0 !== columns.last!) }), alignment: .top)
326324
}
327325

328326
/// Returns a preview image of the table cell for the specified item and table column.
@@ -332,8 +330,7 @@ open class TableViewDiffableDataSource<Section, Item>: NSObject, NSTableViewData
332330

333331
/// Returns a preview image of the table row for the specified items.
334332
public func previewImage(for items: [Item]) -> NSImage? {
335-
Swift.print("previewImage", items.count)
336-
return NSImage(combineVerticalAlt: items.compactMap({ previewImage(for: $0)}).reversed(), alignment: .left)
333+
return NSImage(combineVertical: items.compactMap({ previewImage(for: $0)}).reversed(), alignment: .left)
337334
}
338335

339336
private func previewImage(for item: Item, tableColumn: NSTableColumn, useColumnWidth: Bool) -> NSImage? {
@@ -1309,7 +1306,7 @@ open class TableViewDiffableDataSource<Section, Item>: NSObject, NSTableViewData
13091306
public var animates: Bool = true
13101307

13111308
/// A Boolean value that indicates whether the rows for the proposed drop items are previewed.
1312-
public var previewDroppedItems = true
1309+
public var previewDroppedItems = false
13131310

13141311
/// The handler that determines whether the proposed drop can be dropped to an item.
13151312
public var canDropInto: ((_ dropInfo: DropInfo, _ item: Item) -> Bool)?
@@ -1468,47 +1465,3 @@ extension CGRect {
14681465
return sqrt(dx * dx + dy * dy)
14691466
}
14701467
}
1471-
1472-
extension NSUIImage {
1473-
/**
1474-
Creates a new image by combining the specified images.
1475-
1476-
- Parameters:
1477-
- images: The images to combine.
1478-
- orientation: The orientation of the images when combining them.
1479-
- alignment: The alignment of the images when combining them.
1480-
- Returns: The combined images, or `nil` if the images couldn't be combined.
1481-
*/
1482-
public convenience init?(combineVerticalAlt images: [NSUIImage], alignment: HorizontalAlignment = .center) {
1483-
guard let image = NSUIImage.combined(images: images, vertical: true, alignment: alignment.rawValue) else { return nil }
1484-
self.init(size: image.size)
1485-
lockFocus()
1486-
defer { unlockFocus() }
1487-
image.draw(at: .zero, from: CGRect(origin: .zero, size: image.size), operation: .copy, fraction: 1.0)
1488-
}
1489-
1490-
public convenience init?(combineHorizontalAlt images: [NSUIImage], alignment: VerticalAlignment = .center) {
1491-
guard let image = NSUIImage.combined(images: images, vertical: false, alignment: alignment.rawValue) else { return nil }
1492-
self.init(size: image.size)
1493-
lockFocus()
1494-
defer { unlockFocus() }
1495-
image.draw(at: .zero, from: CGRect(origin: .zero, size: image.size), operation: .copy, fraction: 1.0)
1496-
}
1497-
1498-
private static func combined(images: [NSUIImage], vertical: Bool, alignment: Int) -> NSUIImage? {
1499-
guard !images.isEmpty else { return nil }
1500-
let rects = vertical ? images.map({$0.size}).alignVertical(alignment: .init(rawValue: alignment)!) : images.map({$0.size}).alignHorizontal(alignment: .init(rawValue: alignment)!)
1501-
let finalImage = NSUIImage(size: rects.union().size)
1502-
finalImage.lockFocus()
1503-
defer { finalImage.unlockFocus() }
1504-
var currentPoint: CGPoint = .zero
1505-
for value in zip(images, rects) {
1506-
let image = value.0
1507-
let drawRect = value.1
1508-
image.draw(in: drawRect)
1509-
currentPoint = vertical ? CGPoint(x: currentPoint.x, y: currentPoint.y + image.size.height) : CGPoint(x: currentPoint.x + image.size.width, y: currentPoint.y)
1510-
}
1511-
Swift.print("combined", finalImage.size, vertical, alignment, images.compactMap({$0.size}), rects, rects.union().size, NSGraphicsContext.current?.imageInterpolation.rawValue)
1512-
return finalImage
1513-
}
1514-
}

0 commit comments

Comments
 (0)