Remember artworks size in the artwork selector view
This commit is contained in:
3 files changed
+22
-13
No files matched your search
@@ -205,9 +205,9 @@ final class ArtworkSelectorController: NSViewController, NSCollectionViewDataSou
|
||||
}
|
||||
|
||||
override func viewWillAppear() {
|
||||
if let layout = imageBrowser.collectionViewLayout as? NSCollectionViewFlowLayout {
|
||||
layout.itemSize = standardSize
|
||||
}
|
||||
let zoomValue = Prefs.artworkSelectorZoomLevel
|
||||
setZoomValue(zoomValue)
|
||||
slider.floatValue = zoomValue
|
||||
}
|
||||
|
||||
@IBAction func loadMoreArtwork(_ sender: Any) {
|
||||
@@ -216,23 +216,28 @@ final class ArtworkSelectorController: NSViewController, NSCollectionViewDataSou
|
||||
|
||||
// MARK: - User Interface
|
||||
|
||||
@IBAction func zoomSliderDidChange(_ sender: Any) {
|
||||
func setZoomValue(_ newZoomValue: Float) {
|
||||
if let layout = imageBrowser.collectionViewLayout as? NSCollectionViewFlowLayout {
|
||||
if slider.floatValue == 50 {
|
||||
if newZoomValue == 50 {
|
||||
layout.itemSize = standardSize
|
||||
} else if slider.floatValue < 50 {
|
||||
let zoomValue = (CGFloat(slider.floatValue) + 50) / 100
|
||||
} else if newZoomValue < 50 {
|
||||
let zoomValue = (CGFloat(newZoomValue) + 50) / 100
|
||||
layout.itemSize = NSSize(width: Int(standardSize.width * zoomValue),
|
||||
height: Int((standardSize.height - 32) * zoomValue + 32))
|
||||
|
||||
} else {
|
||||
let zoomValue = pow((CGFloat(slider.floatValue) + 50) / 100, 2.4)
|
||||
let zoomValue = pow((CGFloat(newZoomValue) + 50) / 100, 2.4)
|
||||
layout.itemSize = NSSize(width: Int(standardSize.width * zoomValue),
|
||||
height: Int((standardSize.height - 32) * zoomValue + 32))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func zoomSliderDidChange(_ sender: Any) {
|
||||
setZoomValue(slider.floatValue)
|
||||
Prefs.artworkSelectorZoomLevel = slider.floatValue
|
||||
}
|
||||
|
||||
fileprivate func reloadItem(_ item: ArtworkImageObject) {
|
||||
let selectionIndexPaths = imageBrowser.selectionIndexPaths
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23504"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -19,7 +19,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="128" height="171"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField wantsLayer="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wkh-6c-0tU" customClass="ArtworkSelectorViewItemLabel" customModule="Subler" customModuleProvider="target">
|
||||
<textField wantsLayer="YES" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wkh-6c-0tU" customClass="ArtworkSelectorViewItemLabel" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="-4" y="17" width="136" height="15"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" alignment="center" title="Label" usesSingleLineMode="YES" id="TsL-Ak-xnf">
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
@@ -27,7 +27,7 @@
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField wantsLayer="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fGU-Kh-WjD">
|
||||
<textField wantsLayer="YES" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fGU-Kh-WjD">
|
||||
<rect key="frame" x="-4" y="4" width="136" height="13"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" alignment="center" title="Label" usesSingleLineMode="YES" id="ggX-Q2-CZ0">
|
||||
<font key="font" metaFont="system" size="10"/>
|
||||
|
||||
+5
-1
@@ -151,6 +151,9 @@ enum Prefs {
|
||||
|
||||
@Stored(key: "SBForceHvc1", defaultValue: true)
|
||||
static var forceHvc1: Bool
|
||||
|
||||
@Stored(key: "SBArtworkSelectorZoomLevel", defaultValue: 50)
|
||||
static var artworkSelectorZoomLevel: Float
|
||||
}
|
||||
|
||||
enum MetadataPrefs {
|
||||
@@ -158,7 +161,8 @@ enum MetadataPrefs {
|
||||
static func register() {
|
||||
ud.register(defaults: [_setMovieFormat, _setTVShowFormat,
|
||||
_movieImporter, _movieiTunesStoreLanguage,
|
||||
_tvShowImporter, _tvShowiTunesStoreLanguage, _tvShowTheTVDBLanguage, _tvShowTheMovieDBLanguage,
|
||||
_tvShowImporter, _tvShowiTunesStoreLanguage,
|
||||
_tvShowTheTVDBLanguage, _tvShowTheMovieDBLanguage,
|
||||
_keepEmptyAnnotations, _keepImportedFilesMetadata])
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user