Skip to content

Commit

Permalink
fix: layout regression introduced by eed0353
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.pontoise authored and lwouis committed Mar 10, 2020
1 parent 3fc899e commit bdc41be
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions alt-tab-macos/ui/main-window/CollectionViewItemView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cocoa

class CollectionViewItemView: NSView {
class CollectionViewItemView: NSStackView {
var window_: Window?
var thumbnail = NSImageView()
var appIcon = NSImageView()
Expand All @@ -15,12 +15,11 @@ class CollectionViewItemView: NSView {
convenience init() {
self.init(frame: .zero)
let hStackView = makeHStackView()
let vStackView = makeVStackView(hStackView)
setupView(hStackView)
let shadow = CollectionViewItemView.makeShadow(.gray)
thumbnail.shadow = shadow
appIcon.shadow = shadow
observeDragAndDrop()
subviews.append(vStackView)
}

private func observeDragAndDrop() {
Expand Down Expand Up @@ -151,18 +150,16 @@ class CollectionViewItemView: NSView {
return hStackView
}

private func makeVStackView(_ hStackView: NSStackView) -> NSStackView {
let vStackView = NSStackView()
vStackView.wantsLayer = true
vStackView.layer!.backgroundColor = .clear
vStackView.layer!.cornerRadius = Preferences.cellCornerRadius
vStackView.layer!.borderWidth = Preferences.cellBorderWidth
vStackView.layer!.borderColor = .clear
vStackView.edgeInsets = NSEdgeInsets(top: Preferences.intraCellPadding, left: Preferences.intraCellPadding, bottom: Preferences.intraCellPadding, right: Preferences.intraCellPadding)
vStackView.orientation = .vertical
vStackView.spacing = Preferences.intraCellPadding
vStackView.setViews([hStackView, thumbnail], in: .leading)
return vStackView
private func setupView(_ hStackView: NSStackView) {
wantsLayer = true
layer!.backgroundColor = .clear
layer!.cornerRadius = Preferences.cellCornerRadius
layer!.borderWidth = Preferences.cellBorderWidth
layer!.borderColor = .clear
edgeInsets = NSEdgeInsets(top: Preferences.intraCellPadding, left: Preferences.intraCellPadding, bottom: Preferences.intraCellPadding, right: Preferences.intraCellPadding)
orientation = .vertical
spacing = Preferences.intraCellPadding
setViews([hStackView, thumbnail], in: .leading)
}
}

Expand Down

0 comments on commit bdc41be

Please sign in to comment.