Hide the collection view items labels when they are not needed

This commit is contained in:
Damiano Galassi committed 2024-07-01 17:49:47 +02:00
1 parent a751ccb9ee
commit a40a3bfe3c
4 files changed
+61 -37

No files matched your search

+12 -12
View File
@@ -25,15 +25,15 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="1">
<rect key="frame" x="0.0" y="0.0" width="769" height="306"/>
<rect key="frame" x="0.0" y="0.0" width="769" height="279"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<tabView controlSize="small" translatesAutoresizingMaskIntoConstraints="NO" id="10">
<rect key="frame" x="-11" y="-12" width="791" height="313"/>
<rect key="frame" x="-11" y="-12" width="791" height="286"/>
<tabViewItems>
<tabViewItem label="Metadata" identifier="1" id="11">
<view key="view" id="12">
<rect key="frame" x="10" y="25" width="771" height="86"/>
<rect key="frame" x="10" y="25" width="771" height="252"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton toolTip="Add a new metadata item" translatesAutoresizingMaskIntoConstraints="NO" id="30">
@@ -90,13 +90,13 @@
<accessibility description="Sets"/>
</popUpButton>
<scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r4i-wT-qDC">
<rect key="frame" x="17" y="36" width="737" height="44"/>
<rect key="frame" x="17" y="36" width="737" height="206"/>
<clipView key="contentView" id="cQT-bX-0YB">
<rect key="frame" x="1" y="1" width="735" height="42"/>
<rect key="frame" x="1" y="1" width="735" height="204"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" columnReordering="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" rowSizeStyle="automatic" headerView="qXU-xB-xRF" viewBased="YES" floatsGroupRows="NO" id="qg5-r0-E4V" customClass="ExpandedTableView" customModule="Subler" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="735" height="88"/>
<rect key="frame" x="0.0" y="0.0" width="735" height="181"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -325,7 +325,7 @@
</tabViewItem>
<tabViewItem label="Artwork" identifier="Item 1" id="15">
<view key="view" id="16">
<rect key="frame" x="10" y="25" width="771" height="275"/>
<rect key="frame" x="10" y="25" width="771" height="248"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="223">
@@ -366,16 +366,16 @@
</connections>
</slider>
<scrollView wantsLayer="YES" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WUe-C3-hRA">
<rect key="frame" x="17" y="36" width="737" height="233"/>
<rect key="frame" x="17" y="36" width="737" height="206"/>
<clipView key="contentView" id="jau-dn-6LI">
<rect key="frame" x="1" y="1" width="735" height="231"/>
<rect key="frame" x="1" y="1" width="735" height="204"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView selectable="YES" allowsMultipleSelection="YES" id="HHe-zs-flI" customClass="CollectionView" customModule="Subler" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="735" height="231"/>
<rect key="frame" x="0.0" y="0.0" width="735" height="204"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="ofy-8i-tTx">
<size key="itemSize" width="280" height="260"/>
<size key="itemSize" width="280" height="224"/>
<edgeInsets key="sectionInset" left="16" right="16" top="16" bottom="16"/>
</collectionViewFlowLayout>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -391,7 +391,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="bD2-5M-Iiz">
<rect key="frame" x="720" y="1" width="16" height="231"/>
<rect key="frame" x="720" y="1" width="16" height="204"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
@@ -59,7 +59,7 @@ class MovieViewController: PropertyView, NSTableViewDataSource, ExpandedTableVie
// Artwork tab
private var artworks: [MP42MetadataItem]
private let standardSize = NSSize(width: 154, height: 192)
private let standardSize = NSSize(width: 280, height: 224)
@IBOutlet var removeArtworkButton: NSButton!
@IBOutlet var artworksView: CollectionView!
@@ -949,9 +949,9 @@ class MovieViewController: PropertyView, NSTableViewDataSource, ExpandedTableVie
let artwork = artworks[index]
collectionViewItem.image = artwork.imageValue?.image
collectionViewItem.title = nil
collectionViewItem.subtitle = nil
collectionViewItem.target = self
collectionViewItem.title = ""
collectionViewItem.subtitle = ""
return collectionViewItem
}
@@ -1235,12 +1235,12 @@ class MovieViewController: PropertyView, NSTableViewDataSource, ExpandedTableVie
} else if floatValue < 50 {
let zoomValue = (floatValue + 50) / 100
layout.itemSize = NSSize(width: Int(standardSize.width * zoomValue),
height: Int((standardSize.height - 32) * zoomValue + 32))
height: Int(standardSize.height * zoomValue))
} else {
let zoomValue = pow((floatValue + 50) / 100, 2.4)
layout.itemSize = NSSize(width: Int(standardSize.width * zoomValue),
height: Int((standardSize.height - 32) * zoomValue + 32))
height: Int(standardSize.height * zoomValue))
}
}
}