Efforts to adjust Screen Wrapping right at the launch

This commit is contained in:
tudnai 2022-12-20 12:15:35 +01:00
parent 38e5a1e634
commit 29bf3a5da5
3 changed files with 12 additions and 3 deletions

View File

@ -1811,7 +1811,7 @@ Gw
<rect key="frame" x="0.0" y="0.0" width="1152" height="736"/> <rect key="frame" x="0.0" y="0.0" width="1152" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textView editable="NO" selectable="NO" importsGraphics="NO" richText="NO" verticallyResizable="NO" baseWritingDirection="leftToRight" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="ccC-Wu-3za" userLabel="Text Display" customClass="DisplayView" customModule="Steve___" customModuleProvider="target"> <textView editable="NO" selectable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="NO" baseWritingDirection="leftToRight" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="ccC-Wu-3za" userLabel="Text Display" customClass="DisplayView" customModule="Steve___" customModuleProvider="target">
<rect key="frame" x="0.0" y="-512" width="1152" height="768"/> <rect key="frame" x="0.0" y="-512" width="1152" height="768"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@ -2368,6 +2368,7 @@ Gw
<connections> <connections>
<outlet property="scanlinesView" destination="dGn-a4-c1t" id="eqJ-YB-9cU"/> <outlet property="scanlinesView" destination="dGn-a4-c1t" id="eqJ-YB-9cU"/>
<outlet property="textDisplay" destination="ccC-Wu-3za" id="PB1-X7-azr"/> <outlet property="textDisplay" destination="ccC-Wu-3za" id="PB1-X7-azr"/>
<outlet property="textDisplayScroller" destination="ss1-M1-nGn" id="q4m-aP-Io6"/>
</connections> </connections>
</view> </view>
<connections> <connections>

View File

@ -25,6 +25,7 @@ import Cocoa
class MonitorView: NSView { class MonitorView: NSView {
@IBOutlet weak var textDisplayScroller: DisplayScrollView!
@IBOutlet var textDisplay: DisplayView! @IBOutlet var textDisplay: DisplayView!
@IBOutlet weak var scanlinesView: NSImageView! @IBOutlet weak var scanlinesView: NSImageView!
@ -43,6 +44,8 @@ class MonitorView: NSView {
} }
func adjustTextDisplaySize() { func adjustTextDisplaySize() {
textDisplayScroller.updateConstraints()
var textFrameSize = frame.size var textFrameSize = frame.size
if textDisplay_width_diff == nil { if textDisplay_width_diff == nil {
@ -92,7 +95,10 @@ class MonitorView: NSView {
// BUGFIX: I am not sure why but if I do not adjust the frame and bounds size // BUGFIX: I am not sure why but if I do not adjust the frame and bounds size
// couple of times, Cocoa miscalculates them // couple of times, Cocoa miscalculates them
if let textDisplay = textDisplay { if let textDisplay = textDisplay {
for _ in 0...15 { textDisplay.setFrameSize(textFrameSize)
textDisplay.setBoundsSize(MonitorView.textViewBounds)
DispatchQueue.main.async() {
// for _ in 0...15 {
textDisplay.setFrameSize(textFrameSize) textDisplay.setFrameSize(textFrameSize)
// textDisplay.setBoundsSize(MonitorView.textViewBounds) // textDisplay.setBoundsSize(MonitorView.textViewBounds)
// textDisplay.setFrameSize(scanlinesView.frame.size) // textDisplay.setFrameSize(scanlinesView.frame.size)

View File

@ -1734,7 +1734,9 @@ class ViewController: NSViewController {
textDisplay.setSelectedRange(NSRange()) textDisplay.setSelectedRange(NSRange())
textDisplay.window?.makeFirstResponder(self) textDisplay.window?.makeFirstResponder(self)
monitorView.adjustTextDisplaySize() DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.monitorView.adjustTextDisplaySize()
}
} }