Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

fix detail button opacity animations #90

Merged
merged 7 commits into from
Nov 21, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
give detail buttons 50% opacity untill highlighting cell, as discusse…
…d in #77
  • Loading branch information
jurre committed Nov 21, 2013
commit a112895d1feb58322c1f21a769f6750290b0c926
81 changes: 42 additions & 39 deletions Alcatraz/PluginWindow.xib
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A2093" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1080" defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
Expand All @@ -23,19 +23,19 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="200" y="250" width="500" height="618"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1050"/>
<view key="contentView" id="126">
<rect key="frame" x="0.0" y="0.0" width="500" height="618"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="23">
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="76" horizontalPageScroll="10" verticalLineScroll="76" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="23">
<rect key="frame" x="0.0" y="20" width="500" height="560"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" copiesOnScroll="NO" id="2OX-MH-qJ4">
<rect key="frame" x="0.0" y="0.0" width="500" height="560"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="24">
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="74" rowSizeStyle="automatic" viewBased="YES" id="24">
<rect key="frame" x="0.0" y="0.0" width="500" height="560"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
Expand Down Expand Up @@ -125,59 +125,62 @@
<binding destination="315" name="title" keyPath="objectValue.name" id="966"/>
</connections>
</button>
<button hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1051" customClass="ATZDetailItemButton">
<rect key="frame" x="410" y="37" width="20" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="1338"/>
<constraint firstAttribute="height" constant="26" id="1366"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="link_icon" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="1052">
<behavior key="behavior" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openPackageWebsitePressed:" target="-2" id="1138"/>
</connections>
</button>
<button hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1057" customClass="ATZDetailItemButton">
<rect key="frame" x="382" y="37" width="20" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="1320"/>
<constraint firstAttribute="width" constant="20" id="1342"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="eye_icon" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="1059">
<behavior key="behavior" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="displayScreenshotPressed:" target="-2" id="1243"/>
</connections>
</button>
<box autoresizesSubviews="NO" verticalHuggingPriority="750" alphaValue="0.5" title="Box" boxType="separator" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="58h-17-rJo">
<rect key="frame" x="3" y="68" width="448" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<customView focusRingType="none" appearanceType="lightContent" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R0c-wL-QhR">
<rect key="frame" x="367" y="37" width="83" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1051" customClass="ATZDetailItemButton">
<rect key="frame" x="43" y="0.0" width="20" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="1338"/>
<constraint firstAttribute="height" constant="26" id="1366"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="link_icon" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="1052">
<behavior key="behavior" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openPackageWebsitePressed:" target="-2" id="1138"/>
</connections>
</button>
<button ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1057" customClass="ATZDetailItemButton">
<rect key="frame" x="15" y="0.0" width="20" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="1320"/>
<constraint firstAttribute="width" constant="20" id="1342"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="eye_icon" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="1059">
<behavior key="behavior" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="displayScreenshotPressed:" target="-2" id="1243"/>
</connections>
</button>
</subviews>
</customView>
</subviews>
<constraints>
<constraint firstItem="390" firstAttribute="leading" secondItem="315" secondAttribute="leading" constant="3" id="393"/>
<constraint firstAttribute="trailing" secondItem="390" secondAttribute="trailing" constant="22" id="543"/>
<constraint firstItem="959" firstAttribute="leading" secondItem="315" secondAttribute="leading" constant="3" id="972"/>
<constraint firstItem="959" firstAttribute="top" secondItem="315" secondAttribute="top" constant="12" id="1009"/>
<constraint firstItem="390" firstAttribute="top" secondItem="959" secondAttribute="bottom" constant="8" symbolic="YES" id="1201"/>
<constraint firstItem="1051" firstAttribute="baseline" secondItem="1057" secondAttribute="baseline" id="1337"/>
<constraint firstItem="1051" firstAttribute="leading" secondItem="1057" secondAttribute="trailing" constant="8" symbolic="YES" id="1344"/>
<constraint firstItem="58h-17-rJo" firstAttribute="leading" secondItem="315" secondAttribute="leading" constant="3" id="2Dl-P4-fJU"/>
<constraint firstAttribute="trailing" secondItem="58h-17-rJo" secondAttribute="trailing" constant="3" id="EJ3-5f-biw"/>
<constraint firstItem="1051" firstAttribute="top" secondItem="58h-17-rJo" secondAttribute="bottom" constant="7" id="aLc-ta-eDL"/>
<constraint firstAttribute="trailing" secondItem="1051" secondAttribute="trailing" constant="24" id="efB-Bb-Wfg"/>
<constraint firstItem="58h-17-rJo" firstAttribute="top" secondItem="315" secondAttribute="top" constant="3" id="lSK-4r-CE4"/>
</constraints>
<connections>
<outlet property="buttonContainerView" destination="R0c-wL-QhR" id="fLG-aw-Qfv"/>
<outlet property="screenshotButton" destination="1057" id="1242"/>
<outlet property="websiteButton" destination="1051" id="1149"/>
</connections>
Expand Down Expand Up @@ -353,7 +356,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES" HUD="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="285"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1050"/>
<view key="contentView" id="1348">
<rect key="frame" x="0.0" y="0.0" width="480" height="285"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down
4 changes: 2 additions & 2 deletions Alcatraz/Views/ATZDetailItemButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#import "ATZDetailItemButton.h"

#define MIN_ALPHA 0.5f
#define MAX_ALPHA 0.8f
#define MAX_ALPHA 1.0f

@implementation ATZDetailItemButton

Expand All @@ -40,7 +40,7 @@ - (void)resetCursorRects {
}

- (void)awakeFromNib {
self.alphaValue = 0.0f;
self.alphaValue = MIN_ALPHA;
[self createTrackingArea];
}

Expand Down
1 change: 1 addition & 0 deletions Alcatraz/Views/ATZPackageTableCellView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@

@property (assign) IBOutlet NSButton *screenshotButton;
@property (assign) IBOutlet NSButton *websiteButton;
@property (assign) IBOutlet NSView *buttonContainerView;

@end
28 changes: 10 additions & 18 deletions Alcatraz/Views/ATZPackageTableCellView.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#import "ATZPackageTableCellView.h"
#import "ATZPackage.h"
#import <Quartz/Quartz.h>

@interface ATZPackageTableCellView()
@property (assign) BOOL isHighlighted;
Expand All @@ -31,32 +32,23 @@ @interface ATZPackageTableCellView()
@implementation ATZPackageTableCellView

- (void)awakeFromNib {
[self.buttonContainerView setWantsLayer:YES];
[self createTrackingArea];
}

- (void)setButtonsVisible:(BOOL)visible animated:(BOOL)animated {
float alphaValue = visible ? 0.5f : 0.0f;

id websiteButton = animated ? self.websiteButton.animator : self.websiteButton;
id screenshotButton = animated ? self.screenshotButton.animator : self.screenshotButton;

if (visible) {
[self.websiteButton setToolTip:[(ATZPackage *)self.objectValue website]];
[self.websiteButton setHidden:!visible];
[self.screenshotButton setHidden:!visible];
}

float alphaValue = visible ? 1.0f : 0.5f;

id buttonsContainerView = animated ? self.buttonContainerView.animator : self.buttonContainerView;

[buttonsContainerView setAlphaValue: alphaValue];

if (![(ATZPackage *)self.objectValue screenshotPath]) [self.screenshotButton setHidden:YES];

if (!self.isHighlighted) {
[websiteButton setAlphaValue:alphaValue];
[screenshotButton setAlphaValue:alphaValue];
if (visible) self.isHighlighted = YES;
}
}

- (void)viewWillDraw {
if (!self.isHighlighted) [self setButtonsVisible:NO animated:NO];
[self.websiteButton setToolTip:[(ATZPackage *)self.objectValue website]];
[self setButtonsVisible:self.isHighlighted animated:NO];
}

- (void)mouseEntered:(NSEvent *)theEvent {
Expand Down