Skip to content

Commit

Permalink
Correct scroll on 10.8 and 10.9, closes #81
Browse files Browse the repository at this point in the history
  • Loading branch information
bmichotte committed Jul 15, 2015
1 parent efe787e commit 282e15e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
11 changes: 10 additions & 1 deletion app/controllers/manager/deck_manager_layout.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class DeckManagerLayout < MK::WindowLayout

include OSXHelper

def layout
frame_width = CGRectGetWidth(NSScreen.mainScreen.frame) - 100
frame_height = CGRectGetHeight(NSScreen.mainScreen.frame) - 100
Expand Down Expand Up @@ -77,6 +79,9 @@ def layout
add NSScrollView, :table_scroll_view do
drawsBackground false
autoresizing_mask NSViewWidthSizable | NSViewHeightSizable
unless is_10_10?
has_vertical_scroller true
end

table = add NSTableView, :table_view do
row_height 37
Expand Down Expand Up @@ -110,7 +115,11 @@ def layout
end

constraints do
width.equals(220)
_width = 220
unless is_10_10?
_width += 15
end
width.equals(_width)
top_right.equals x: 0, y: 0
height.equals(:superview)
end
Expand Down
11 changes: 10 additions & 1 deletion app/controllers/trackers/tracker_layout.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class TrackerLayout < MK::WindowLayout

include OSXHelper

KFrameWidth = 220.0
KFrameHeight = 700.0
KRowHeight = 37.0
Expand Down Expand Up @@ -45,6 +47,10 @@ def layout
width = KFrameWidth
end

unless is_10_10?
width += 15
end

content_min_size [width, 200]
content_max_size [width, CGRectGetHeight(NSScreen.mainScreen.frame)]

Expand All @@ -66,13 +72,16 @@ def layout
end

add NSScrollView, :table_scroll_view do
drawsBackground false
document_view add NSTableView, :table_view
end
end

def table_scroll_view_style
background_color :clear.nscolor
drawsBackground false
unless is_10_10?
has_vertical_scroller true
end

constraints do
height.equals(:superview)
Expand Down
10 changes: 8 additions & 2 deletions app/utilities/osx_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
class OSXHelper
def self.window
module OSXHelper

def is_10_10?
info = NSProcessInfo.processInfo.operatingSystemVersion
info.majorVersion >= 10 and info.minorVersion >= 10
end

def window_frame
windows = CGWindowListCopyWindowInfo(KCGWindowListOptionOnScreenOnly | KCGWindowListExcludeDesktopElements, KCGNullWindowID)

hearthstone_window = nil
Expand Down
1 change: 1 addition & 0 deletions versions.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Add an option to hide the opponent tracker
- Correct a crash when importing hearthstats decks
- Correct an error with the deck selection from menu
- Correct scroll on 10.8 and 10.9

#### 0.11.3
- Correct a bug when importing old hearthstats decks
Expand Down

0 comments on commit 282e15e

Please sign in to comment.