Skip to content

Commit

Permalink
fix background view
Browse files Browse the repository at this point in the history
  • Loading branch information
vvkeep committed Jul 14, 2021
1 parent 8549b24 commit ee3e8cf
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 12 deletions.
18 changes: 12 additions & 6 deletions JSONConverter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
8EC079DC268993D400000F68 /* an-old-hope.min.css in Resources */ = {isa = PBXBuildFile; fileRef = 8EC07979268993D400000F68 /* an-old-hope.min.css */; };
8EC079DD268993D400000F68 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 8EC0797B268993D400000F68 /* LICENSE */; };
8EC079DE268993D400000F68 /* highlight.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 8EC0797C268993D400000F68 /* highlight.min.js */; };
8EC3AAC2269E9EAD00CE0262 /* CustomBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EC3AAC1269E9EAD00CE0262 /* CustomBackgroundView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -282,6 +283,7 @@
8EC07979268993D400000F68 /* an-old-hope.min.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "an-old-hope.min.css"; sourceTree = "<group>"; };
8EC0797B268993D400000F68 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
8EC0797C268993D400000F68 /* highlight.min.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = highlight.min.js; sourceTree = "<group>"; };
8EC3AAC1269E9EAD00CE0262 /* CustomBackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBackgroundView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -486,6 +488,7 @@
isa = PBXGroup;
children = (
8E542C2E25130C160053C1E0 /* PanGestureIndicatorView.swift */,
8EC3AAC1269E9EAD00CE0262 /* CustomBackgroundView.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -868,6 +871,7 @@
7B7D5AE624FA520800A54D27 /* Date+Extension.swift in Sources */,
7B45DAFE202A95BF007E8D56 /* JSONBuilder.swift in Sources */,
8EC07980268993D400000F68 /* HTMLUtils.swift in Sources */,
8EC3AAC2269E9EAD00CE0262 /* CustomBackgroundView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1031,17 +1035,18 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = JSONConverter/JSONConverter.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 7DDW7FQJ8R;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = JSONConverter/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 2.0.4;
PRODUCT_BUNDLE_IDENTIFIER = com.devyao.JSONConverter;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "JSONConverter/JSONConverter-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -1054,17 +1059,18 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = JSONConverter/JSONConverter.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 7DDW7FQJ8R;
DEVELOPMENT_TEAM = 897BNGH9W3;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = JSONConverter/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 2.0.4;
PRODUCT_BUNDLE_IDENTIFIER = com.devyao.JSONConverter;
PRODUCT_BUNDLE_IDENTIFIER = com.devyaochen.JSONConverter;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = JSONConverter_mac_appstore_profile;
SWIFT_OBJC_BRIDGING_HEADER = "JSONConverter/JSONConverter-Bridging-Header.h";
SWIFT_VERSION = 5.0;
};
Expand Down
56 changes: 56 additions & 0 deletions JSONConverter/Assets.xcassets/LineColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.570",
"green" : "0.570",
"red" : "0.570"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.921",
"green" : "0.921",
"red" : "0.921"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.261",
"green" : "0.261",
"red" : "0.261"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097.2"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -138,18 +139,18 @@
<constraint firstItem="xE3-MR-b0j" firstAttribute="leading" secondItem="VOt-ZW-E3V" secondAttribute="leading" id="vvm-1c-L9w"/>
</constraints>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Rs5-vR-4VE" userLabel="Bottom Tool Bar">
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Rs5-vR-4VE" userLabel="Bottom Tool Bar" customClass="CustomBackgroundView" customModule="JSONConverter" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="999" height="50"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zHm-8W-mp8">
<rect key="frame" x="909" y="6" width="82" height="36"/>
<rect key="frame" x="908" y="6" width="84" height="37"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="KHU-BC-zzf"/>
<constraint firstAttribute="height" constant="25" id="Ks7-GQ-6N8"/>
</constraints>
<buttonCell key="cell" type="push" title="转换" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="uWG-Sb-jzp">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="label" size="13"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="saveBtnAction:" target="-2" id="cXI-8X-NTi"/>
Expand Down Expand Up @@ -186,7 +187,7 @@
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="setting" imagePosition="only" alignment="center" inset="2" id="bJ5-2Y-TL5">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="label" size="13"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="settingAction:" target="-2" id="9y4-PN-kgw"/>
Expand Down
19 changes: 19 additions & 0 deletions JSONConverter/Classes/View/CustomBackgroundView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CustomBackgroundView.swift
// JSONConverter
//
// Created by DevYao on 2021/7/14.
// Copyright © 2021 姚巍. All rights reserved.
//

import Cocoa

class CustomBackgroundView: NSView {

override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
let color = NSColor(named: "LineColor")
color?.setFill()
bounds.fill()
}
}
7 changes: 7 additions & 0 deletions JSONConverter/Classes/View/PanGestureIndicatorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ class PanGestureIndicatorView: NSView {
let area = NSTrackingArea(rect: self.bounds, options: [.enabledDuringMouseDrag, .mouseEnteredAndExited, .mouseMoved, .activeInKeyWindow, .inVisibleRect], owner: self, userInfo: nil)
addTrackingArea(area)
}

override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
let color = NSColor(named: "LineColor")
color?.setFill()
bounds.fill()
}

override func mouseEntered(with event: NSEvent) {
super.mouseEntered(with: event)
Expand Down

0 comments on commit ee3e8cf

Please sign in to comment.