Skip to content

Commit

Permalink
Add some colors to the initial view (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 4, 2019
1 parent be90eec commit 19d5a3c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 1 deletion.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions Gifski/Assets.xcassets/BackgroundImage.imageset/Contents.json
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "mac",
"filename" : "BackgroundImage.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"filename" : "BackgroundImage@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
1 change: 1 addition & 0 deletions Gifski/Constants.swift
Expand Up @@ -11,4 +11,5 @@ extension Defaults.Keys {

struct Constants {
static let defaultWindowSize = CGSize(width: 360, height: 240)
static let backgroundImage = NSImage(named: "BackgroundImage")!
}
5 changes: 5 additions & 0 deletions Gifski/VideoDropView.swift
Expand Up @@ -67,6 +67,11 @@ class DropView: SSView {
override func draw(_ dirtyRect: CGRect) {
super.draw(dirtyRect)

// We only draw it when the drop view controller is the main view controller.
if window?.contentViewController is VideoDropViewController {
Constants.backgroundImage.draw(in: dirtyRect)
}

if isDraggingHighlighted {
highlightColor.set()
let path = NSBezierPath(rect: bounds)
Expand Down
3 changes: 2 additions & 1 deletion Gifski/VideoDropViewController.swift
Expand Up @@ -2,8 +2,9 @@ import AppKit

final class VideoDropViewController: NSViewController {
private let videoValidator = VideoValidator()

private lazy var videoDropView = with(VideoDropView()) {
$0.dropText = "Drop a Video to Convert to GIF"
$0.dropText = "Drop a Video"
$0.onComplete = { [weak self] url in
NSApp.activate(ignoringOtherApps: true)
self?.convert(url)
Expand Down
Binary file added Stuff/BackgroundImage.sketch
Binary file not shown.

0 comments on commit 19d5a3c

Please sign in to comment.