Skip to content

Commit

Permalink
fixed fixed size image
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Feb 29, 2024
1 parent d6a1b17 commit f1a2e72
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 34 deletions.
40 changes: 21 additions & 19 deletions XCreds/MainLoginWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ class MainLoginWindowController: NSWindowController,NSWindowDelegate {

let backgroundImage = DefaultsHelper.backgroundImage()
TCSLogWithMark()
if let backgroundImage = backgroundImage {
backgroundImage.size=screenRect.size
self.backgroundImageView.image=backgroundImage
self.backgroundImageView.imageScaling = .scaleProportionallyUpOrDown

self.backgroundImageView.frame=NSMakeRect(screenRect.origin.x, screenRect.origin.y, screenRect.size.width, screenRect.size.height-100)

}
self.window?.level = .normal

if self.controlsViewController==nil {
Expand Down Expand Up @@ -180,27 +172,37 @@ class MainLoginWindowController: NSWindowController,NSWindowDelegate {
}

fileprivate func createBackground() {
TCSLogWithMark()

let backgroundImage = DefaultsHelper.backgroundImage()
let screenRect = NSScreen.screens[0].frame
TCSLogWithMark()
var newHeight = screenRect.height
var newWidth = screenRect.width

if let backgroundImage = backgroundImage {
TCSLogWithMark()
backgroundImageView.image?.size=screenRect.size
TCSLogWithMark()

backgroundImageView.image=backgroundImage
TCSLogWithMark()
if UserDefaults.standard.bool(forKey: PrefKeys.shouldLoginWindowBackgroundImageFillScreen.rawValue) == false {
let ratio = backgroundImage.size.width/backgroundImage.size.height
newHeight = screenRect.size.height
newWidth = screenRect.size.height * ratio

if newWidth > screenRect.size.width {
newWidth = screenRect.size.width
newHeight = screenRect.size.width / ratio
}

}


backgroundImage.size=screenRect.size
TCSLogWithMark()

backgroundImage.size.height = newHeight
backgroundImage.size.width = newWidth
backgroundImageView.image=backgroundImage

backgroundImageView.imageScaling = .scaleProportionallyUpOrDown
TCSLogWithMark()
backgroundImageView.frame=NSMakeRect(screenRect.origin.x, screenRect.origin.y, screenRect.size.width, screenRect.size.height-100)
TCSLogWithMark()

}
TCSLogWithMark()

}
func recenterCenterView() {
Expand Down
2 changes: 1 addition & 1 deletion XCreds/PreferencesWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="560" y="551" width="494" height="173"/>
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
<rect key="screenRect" x="0.0" y="0.0" width="1496" height="910"/>
<view key="contentView" wantsLayer="YES" id="ZbF-tC-vpZ">
<rect key="frame" x="0.0" y="0.0" width="494" height="173"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down
6 changes: 0 additions & 6 deletions XCredsLoginPlugIn/LoginWindow/SignInWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ protocol UpdateCredentialsFeedbackProtocol {

self.view.wantsLayer=true
self.view.layer?.backgroundColor = CGColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 0.4)

if UserDefaults.standard.bool(forKey: PrefKeys.shouldLoginWindowBackgroundImageFillScreen.rawValue) == true {

self.view.layer?.contentsGravity = CALayerContentsGravity.resizeAspectFill
}

localOnlyCheckBox.isEnabled=true
localOnlyView.isHidden=false
// make things look better
Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6374;
CURRENT_PROJECT_VERSION = 6399;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1477,7 +1477,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6374;
CURRENT_PROJECT_VERSION = 6399;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1598,7 +1598,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6374;
CURRENT_PROJECT_VERSION = 6399;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1635,7 +1635,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6374;
CURRENT_PROJECT_VERSION = 6399;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1785,7 +1785,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6374;
CURRENT_PROJECT_VERSION = 6399;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1827,7 +1827,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6374;
CURRENT_PROJECT_VERSION = 6399;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<key>auth_mech_fixup.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>6</integer>
</dict>
<key>authrights.xcscheme_^#shared#^_</key>
<dict>
Expand All @@ -42,7 +42,7 @@
<key>test.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>6</integer>
<integer>7</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down

0 comments on commit f1a2e72

Please sign in to comment.