mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 13:15:35 +03:00
add examples + fix gestures and rendering
This commit is contained in:
parent
83421226b5
commit
a785ae3f17
@ -8,34 +8,38 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
970AB811D179560D74930D39 /* Pods_Example_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5184A00051CAC5E360198B48 /* Pods_Example_macOS.framework */; };
|
||||
A72862CB1F4308A50033893D /* AnimationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A72862CA1F4308A50033893D /* AnimationsViewController.swift */; };
|
||||
A72862CE1F430DF00033893D /* EasingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A72862CC1F430DF00033893D /* EasingViewController.swift */; };
|
||||
A753C9E81F3DB18A006615A4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A753C9E71F3DB18A006615A4 /* AppDelegate.swift */; };
|
||||
A753C9EA1F3DB18A006615A4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A753C9E91F3DB18A006615A4 /* ViewController.swift */; };
|
||||
A753C9EC1F3DB18A006615A4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A753C9EB1F3DB18A006615A4 /* Assets.xcassets */; };
|
||||
A753C9EF1F3DB18A006615A4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A753C9ED1F3DB18A006615A4 /* Main.storyboard */; };
|
||||
A753C9F71F3DB615006615A4 /* tiger.svg in Resources */ = {isa = PBXBuildFile; fileRef = A753C9F61F3DB615006615A4 /* tiger.svg */; };
|
||||
A75939A21F41C54E000CE329 /* ShapesExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A75939A11F41C54E000CE329 /* ShapesExampleView.swift */; };
|
||||
A75939A51F41C571000CE329 /* MorphingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A75939A41F41C571000CE329 /* MorphingView.swift */; };
|
||||
A75939A81F41C5A8000CE329 /* TransformExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A75939A71F41C5A8000CE329 /* TransformExampleView.swift */; };
|
||||
A768EAD81F42C98E00F22A17 /* EventsExampleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A768EAD71F42C98E00F22A17 /* EventsExampleController.swift */; };
|
||||
A768EADC1F42CC7C00F22A17 /* EasingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A768EADB1F42CC7C00F22A17 /* EasingView.swift */; };
|
||||
A768EADE1F42CCBC00F22A17 /* AnimationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A768EADD1F42CCBC00F22A17 /* AnimationsView.swift */; };
|
||||
A768EAE21F42EDAE00F22A17 /* tiger.svg in Resources */ = {isa = PBXBuildFile; fileRef = A768EAE11F42EDAE00F22A17 /* tiger.svg */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
5184A00051CAC5E360198B48 /* Pods_Example_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A72862CA1F4308A50033893D /* AnimationsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AnimationsViewController.swift; path = Examples/Animations/AnimationsViewController.swift; sourceTree = "<group>"; };
|
||||
A72862CC1F430DF00033893D /* EasingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EasingViewController.swift; path = Examples/Easing/EasingViewController.swift; sourceTree = "<group>"; };
|
||||
A753C9E41F3DB18A006615A4 /* Example-macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A753C9E71F3DB18A006615A4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
A753C9E91F3DB18A006615A4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
A753C9EB1F3DB18A006615A4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
A753C9EE1F3DB18A006615A4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
A753C9F01F3DB18A006615A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
A753C9F61F3DB615006615A4 /* tiger.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = tiger.svg; sourceTree = "<group>"; };
|
||||
A75939A11F41C54E000CE329 /* ShapesExampleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ShapesExampleView.swift; path = Examples/Shapes/ShapesExampleView.swift; sourceTree = "<group>"; };
|
||||
A75939A41F41C571000CE329 /* MorphingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MorphingView.swift; path = Examples/Morphing/MorphingView.swift; sourceTree = "<group>"; };
|
||||
A75939A71F41C5A8000CE329 /* TransformExampleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TransformExampleView.swift; path = Examples/Transform/TransformExampleView.swift; sourceTree = "<group>"; };
|
||||
A768EAD71F42C98E00F22A17 /* EventsExampleController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EventsExampleController.swift; path = Examples/Events/EventsExampleController.swift; sourceTree = "<group>"; };
|
||||
A768EADB1F42CC7C00F22A17 /* EasingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EasingView.swift; path = Examples/Easing/EasingView.swift; sourceTree = "<group>"; };
|
||||
A768EADD1F42CCBC00F22A17 /* AnimationsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AnimationsView.swift; path = Examples/Animations/AnimationsView.swift; sourceTree = "<group>"; };
|
||||
A768EAE11F42EDAE00F22A17 /* tiger.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = tiger.svg; path = "Example-macOS/Assets/SVG/tiger.svg"; sourceTree = "<group>"; };
|
||||
B752613023F25BBB88A17503 /* Pods-Example-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example-macOS/Pods-Example-macOS.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
BEA3A0212E620A41C8362253 /* Pods-Example-macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-macOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example-macOS/Pods-Example-macOS.release.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@ -72,6 +76,7 @@
|
||||
A753C9DB1F3DB18A006615A4 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A768EADF1F42ED9700F22A17 /* Assets */,
|
||||
A753C9E61F3DB18A006615A4 /* Example-macOS */,
|
||||
A753C9E51F3DB18A006615A4 /* Products */,
|
||||
4F8946156C3F28DC7B262776 /* Pods */,
|
||||
@ -93,10 +98,9 @@
|
||||
A759399F1F41C51A000CE329 /* Examples */,
|
||||
A753C9E71F3DB18A006615A4 /* AppDelegate.swift */,
|
||||
A753C9E91F3DB18A006615A4 /* ViewController.swift */,
|
||||
A753C9EB1F3DB18A006615A4 /* Assets.xcassets */,
|
||||
A753C9ED1F3DB18A006615A4 /* Main.storyboard */,
|
||||
A753C9EB1F3DB18A006615A4 /* Assets.xcassets */,
|
||||
A753C9F01F3DB18A006615A4 /* Info.plist */,
|
||||
A753C9F61F3DB615006615A4 /* tiger.svg */,
|
||||
);
|
||||
path = "Example-macOS";
|
||||
sourceTree = "<group>";
|
||||
@ -107,7 +111,6 @@
|
||||
A75939A01F41C544000CE329 /* Shapes */,
|
||||
A75939A61F41C58D000CE329 /* Transform */,
|
||||
A768EADA1F42CBF600F22A17 /* Animations */,
|
||||
A768EAD91F42CBDC00F22A17 /* SVG */,
|
||||
A75939A91F41CE45000CE329 /* Easing */,
|
||||
A75939A31F41C566000CE329 /* Morphing */,
|
||||
A768EAD61F42C97900F22A17 /* Events */,
|
||||
@ -143,6 +146,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A768EADB1F42CC7C00F22A17 /* EasingView.swift */,
|
||||
A72862CC1F430DF00033893D /* EasingViewController.swift */,
|
||||
);
|
||||
name = Easing;
|
||||
sourceTree = "<group>";
|
||||
@ -155,21 +159,31 @@
|
||||
name = Events;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A768EAD91F42CBDC00F22A17 /* SVG */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = SVG;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A768EADA1F42CBF600F22A17 /* Animations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A768EADD1F42CCBC00F22A17 /* AnimationsView.swift */,
|
||||
A72862CA1F4308A50033893D /* AnimationsViewController.swift */,
|
||||
);
|
||||
name = Animations;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A768EADF1F42ED9700F22A17 /* Assets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A768EAE01F42EDA300F22A17 /* SVG */,
|
||||
);
|
||||
name = Assets;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A768EAE01F42EDA300F22A17 /* SVG */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A768EAE11F42EDAE00F22A17 /* tiger.svg */,
|
||||
);
|
||||
name = SVG;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -233,7 +247,7 @@
|
||||
files = (
|
||||
A753C9EC1F3DB18A006615A4 /* Assets.xcassets in Resources */,
|
||||
A753C9EF1F3DB18A006615A4 /* Main.storyboard in Resources */,
|
||||
A753C9F71F3DB615006615A4 /* tiger.svg in Resources */,
|
||||
A768EAE21F42EDAE00F22A17 /* tiger.svg in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -297,6 +311,8 @@
|
||||
A75939A21F41C54E000CE329 /* ShapesExampleView.swift in Sources */,
|
||||
A753C9E81F3DB18A006615A4 /* AppDelegate.swift in Sources */,
|
||||
A768EAD81F42C98E00F22A17 /* EventsExampleController.swift in Sources */,
|
||||
A72862CE1F430DF00033893D /* EasingViewController.swift in Sources */,
|
||||
A72862CB1F4308A50033893D /* AnimationsViewController.swift in Sources */,
|
||||
A768EADE1F42CCBC00F22A17 /* AnimationsView.swift in Sources */,
|
||||
A75939A81F41C5A8000CE329 /* TransformExampleView.swift in Sources */,
|
||||
A768EADC1F42CC7C00F22A17 /* EasingView.swift in Sources */,
|
||||
|
729
Example-macOS/Example-macOS/Assets/SVG/tiger.svg
Normal file
729
Example-macOS/Example-macOS/Assets/SVG/tiger.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 94 KiB |
@ -58,596 +58,21 @@
|
||||
</menuItem>
|
||||
<menuItem title="File" id="dMs-cI-mzQ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="File" id="bib-Uj-vzu">
|
||||
<items>
|
||||
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
|
||||
<connections>
|
||||
<action selector="newDocument:" target="Ady-hI-5gd" id="4Si-XN-c54"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
|
||||
<connections>
|
||||
<action selector="openDocument:" target="Ady-hI-5gd" id="bVn-NM-KNZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open Recent" id="tXI-mr-wws">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
|
||||
<items>
|
||||
<menuItem title="Clear Menu" id="vNY-rz-j42">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="clearRecentDocuments:" target="Ady-hI-5gd" id="Daa-9d-B3U"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
|
||||
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
|
||||
<connections>
|
||||
<action selector="performClose:" target="Ady-hI-5gd" id="HmO-Ls-i7Q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
|
||||
<connections>
|
||||
<action selector="saveDocument:" target="Ady-hI-5gd" id="teZ-XB-qJY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
|
||||
<connections>
|
||||
<action selector="saveDocumentAs:" target="Ady-hI-5gd" id="mDf-zr-I0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
|
||||
<connections>
|
||||
<action selector="revertDocumentToSaved:" target="Ady-hI-5gd" id="iJ3-Pv-kwq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
|
||||
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
|
||||
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="runPageLayout:" target="Ady-hI-5gd" id="Din-rz-gC5"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
|
||||
<connections>
|
||||
<action selector="print:" target="Ady-hI-5gd" id="qaZ-4w-aoO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Edit" id="5QF-Oa-p0T">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
|
||||
<connections>
|
||||
<action selector="undo:" target="Ady-hI-5gd" id="M6e-cu-g7V"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
|
||||
<connections>
|
||||
<action selector="redo:" target="Ady-hI-5gd" id="oIA-Rs-6OD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
|
||||
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
|
||||
<connections>
|
||||
<action selector="cut:" target="Ady-hI-5gd" id="YJe-68-I9s"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
|
||||
<connections>
|
||||
<action selector="copy:" target="Ady-hI-5gd" id="G1f-GL-Joy"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
|
||||
<connections>
|
||||
<action selector="paste:" target="Ady-hI-5gd" id="UvS-8e-Qdg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteAsPlainText:" target="Ady-hI-5gd" id="cEh-KX-wJQ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="pa3-QI-u2k">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="delete:" target="Ady-hI-5gd" id="0Mk-Ml-PaM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="Ady-hI-5gd" id="VNm-Mi-diN"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
|
||||
<menuItem title="Find" id="4EN-yA-p0u">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
||||
<items>
|
||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="cD7-Qs-BN4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="WD3-Gg-5AJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="NDo-RZ-v9R"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="HOh-sY-3ay"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="U76-nv-p5D"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
|
||||
<connections>
|
||||
<action selector="centerSelectionInVisibleArea:" target="Ady-hI-5gd" id="IOG-6D-g5B"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
|
||||
<items>
|
||||
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
|
||||
<connections>
|
||||
<action selector="showGuessPanel:" target="Ady-hI-5gd" id="vFj-Ks-hy3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
|
||||
<connections>
|
||||
<action selector="checkSpelling:" target="Ady-hI-5gd" id="fz7-VC-reM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
|
||||
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleContinuousSpellChecking:" target="Ady-hI-5gd" id="7w6-Qz-0kB"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleGrammarChecking:" target="Ady-hI-5gd" id="muD-Qn-j4w"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticSpellingCorrection:" target="Ady-hI-5gd" id="2lM-Qi-WAP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Substitutions" id="9ic-FL-obx">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
|
||||
<items>
|
||||
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontSubstitutionsPanel:" target="Ady-hI-5gd" id="oku-mr-iSq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
|
||||
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleSmartInsertDelete:" target="Ady-hI-5gd" id="3IJ-Se-DZD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticQuoteSubstitution:" target="Ady-hI-5gd" id="ptq-xd-QOA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDashSubstitution:" target="Ady-hI-5gd" id="oCt-pO-9gS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Links" id="cwL-P1-jid">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticLinkDetection:" target="Ady-hI-5gd" id="Gip-E3-Fov"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Data Detectors" id="tRr-pd-1PS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDataDetection:" target="Ady-hI-5gd" id="R1I-Nq-Kbl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticTextReplacement:" target="Ady-hI-5gd" id="DvP-Fe-Py6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Transformations" id="2oI-Rn-ZJC">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
|
||||
<items>
|
||||
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="uppercaseWord:" target="Ady-hI-5gd" id="sPh-Tk-edu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowercaseWord:" target="Ady-hI-5gd" id="iUZ-b5-hil"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="capitalizeWord:" target="Ady-hI-5gd" id="26H-TL-nsh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Speech" id="xrE-MZ-jX0">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
|
||||
<items>
|
||||
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="startSpeaking:" target="Ady-hI-5gd" id="654-Ng-kyl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="stopSpeaking:" target="Ady-hI-5gd" id="dX8-6p-jy9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Format" id="jxT-CU-nIS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
|
||||
<items>
|
||||
<menuItem title="Font" id="Gi5-1S-RQB">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
|
||||
<items>
|
||||
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq"/>
|
||||
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27"/>
|
||||
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq"/>
|
||||
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
|
||||
<connections>
|
||||
<action selector="underline:" target="Ady-hI-5gd" id="FYS-2b-JAY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL"/>
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST"/>
|
||||
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
|
||||
<menuItem title="Kern" id="jBQ-r6-VK2">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="GUa-eO-cwY">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardKerning:" target="Ady-hI-5gd" id="6dk-9l-Ckg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="cDB-IK-hbR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffKerning:" target="Ady-hI-5gd" id="U8a-gz-Maa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Tighten" id="46P-cB-AYj">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="tightenKerning:" target="Ady-hI-5gd" id="hr7-Nz-8ro"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Loosen" id="ogc-rX-tC1">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="loosenKerning:" target="Ady-hI-5gd" id="8i4-f9-FKE"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Ligatures" id="o6e-r0-MWq">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="agt-UL-0e3">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardLigatures:" target="Ady-hI-5gd" id="7uR-wd-Dx6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="J7y-lM-qPV">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffLigatures:" target="Ady-hI-5gd" id="iX2-gA-Ilz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use All" id="xQD-1f-W4t">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useAllLigatures:" target="Ady-hI-5gd" id="KcB-kA-TuK"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Baseline" id="OaQ-X3-Vso">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="3Om-Ey-2VK">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unscript:" target="Ady-hI-5gd" id="0vZ-95-Ywn"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Superscript" id="Rqc-34-cIF">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="superscript:" target="Ady-hI-5gd" id="3qV-fo-wpU"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Subscript" id="I0S-gh-46l">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="subscript:" target="Ady-hI-5gd" id="Q6W-4W-IGz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Raise" id="2h7-ER-AoG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="raiseBaseline:" target="Ady-hI-5gd" id="4sk-31-7Q9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Lower" id="1tx-W0-xDw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowerBaseline:" target="Ady-hI-5gd" id="OF1-bc-KW4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
|
||||
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
|
||||
<connections>
|
||||
<action selector="orderFrontColorPanel:" target="Ady-hI-5gd" id="mSX-Xz-DV3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
|
||||
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyFont:" target="Ady-hI-5gd" id="GJO-xA-L4q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteFont:" target="Ady-hI-5gd" id="JfD-CL-leO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Text" id="Fal-I4-PZk">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Text" id="d9c-me-L2H">
|
||||
<items>
|
||||
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
|
||||
<connections>
|
||||
<action selector="alignLeft:" target="Ady-hI-5gd" id="zUv-R1-uAa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
|
||||
<connections>
|
||||
<action selector="alignCenter:" target="Ady-hI-5gd" id="spX-mk-kcS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Justify" id="J5U-5w-g23">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="alignJustified:" target="Ady-hI-5gd" id="ljL-7U-jND"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
|
||||
<connections>
|
||||
<action selector="alignRight:" target="Ady-hI-5gd" id="r48-bG-YeY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
|
||||
<menuItem title="Writing Direction" id="H1b-Si-o9J">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
|
||||
<items>
|
||||
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="YGs-j5-SAR">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionNatural:" target="Ady-hI-5gd" id="qtV-5e-UBP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="Lbh-J2-qVU">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="S0X-9S-QSf"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="jFq-tB-4Kx">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="5fk-qB-AqJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
|
||||
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="Nop-cj-93Q">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionNatural:" target="Ady-hI-5gd" id="lPI-Se-ZHp"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="BgM-ve-c93">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="caW-Bv-w94"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="RB4-Sm-HuC">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="EXD-6r-ZUu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
|
||||
<menuItem title="Show Ruler" id="vLm-3I-IUL">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleRuler:" target="Ady-hI-5gd" id="FOx-HJ-KwY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyRuler:" target="Ady-hI-5gd" id="71i-fW-3W2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteRuler:" target="Ady-hI-5gd" id="cSh-wd-qM2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleToolbarShown:" target="Ady-hI-5gd" id="BXY-wc-z0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="runToolbarCustomizationPalette:" target="Ady-hI-5gd" id="pQI-g3-MTW"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
|
||||
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleSourceList:" target="Ady-hI-5gd" id="iwa-gc-5KM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleFullScreen:" target="Ady-hI-5gd" id="dU3-MA-1Rq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="Ady-hI-5gd" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="Ady-hI-5gd" id="DRN-fu-gQh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="Example-macOS Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
@ -658,52 +83,261 @@
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Example_macOS" customModuleProvider="target"/>
|
||||
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="58" y="-207"/>
|
||||
<point key="canvasLocation" x="58" y="-294"/>
|
||||
</scene>
|
||||
<!--Window Controller-->
|
||||
<scene sceneID="R2V-B0-nI4">
|
||||
<objects>
|
||||
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
|
||||
<window key="window" title="Macaw-Example" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="480" height="480"/>
|
||||
<rect key="contentRect" x="196" y="240" width="600" height="500"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||
<value key="minSize" type="size" width="600" height="500"/>
|
||||
<value key="maxSize" type="size" width="600" height="500"/>
|
||||
</window>
|
||||
<connections>
|
||||
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
|
||||
<segue destination="hdB-7F-R9Q" kind="relationship" relationship="window.shadowedContentViewController" id="2sy-Hm-TOK"/>
|
||||
</connections>
|
||||
</windowController>
|
||||
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="57" y="120"/>
|
||||
<point key="canvasLocation" x="57" y="91"/>
|
||||
</scene>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="hIz-AP-VOD">
|
||||
<!--Tab View Controller-->
|
||||
<scene sceneID="HCD-4m-c8h">
|
||||
<objects>
|
||||
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="Example_macOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
|
||||
<tabViewController selectedTabViewItemIndex="0" id="hdB-7F-R9Q" sceneMemberID="viewController">
|
||||
<tabViewItems>
|
||||
<tabViewItem identifier="" id="3QN-7z-LrX"/>
|
||||
<tabViewItem id="1e3-gs-UK8"/>
|
||||
<tabViewItem id="Kue-lk-AJ2"/>
|
||||
<tabViewItem id="lLO-HO-JXp"/>
|
||||
<tabViewItem id="cOY-ae-H1s"/>
|
||||
<tabViewItem id="h85-ch-mEO"/>
|
||||
<tabViewItem id="fd7-0D-v5P"/>
|
||||
</tabViewItems>
|
||||
<tabView key="tabView" type="noTabsNoBorder" id="2WP-RT-S1E">
|
||||
<rect key="frame" x="-57" y="5" width="615" height="95"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<font key="font" metaFont="message"/>
|
||||
<tabViewItems/>
|
||||
</tabView>
|
||||
<connections>
|
||||
<segue destination="GQJ-Hp-Pf9" kind="relationship" relationship="tabItems" id="NpD-f5-aHg"/>
|
||||
<segue destination="jao-64-FWC" kind="relationship" relationship="tabItems" id="2YP-Vc-nYb"/>
|
||||
<segue destination="mWu-e3-ocB" kind="relationship" relationship="tabItems" id="Elo-Zo-5ec"/>
|
||||
<segue destination="iWh-Ne-7Ns" kind="relationship" relationship="tabItems" id="b7l-i9-xc7"/>
|
||||
<segue destination="6Ok-1N-J6E" kind="relationship" relationship="tabItems" id="Oei-AM-VA1"/>
|
||||
<segue destination="Rn8-Li-WZ2" kind="relationship" relationship="tabItems" id="XnE-5e-LQB"/>
|
||||
<segue destination="9aj-uf-eJX" kind="relationship" relationship="tabItems" id="dm1-xg-c0C"/>
|
||||
</connections>
|
||||
</tabViewController>
|
||||
<customObject id="vzO-zk-Zwd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="58" y="541"/>
|
||||
</scene>
|
||||
<!--Shapes-->
|
||||
<scene sceneID="X9O-0j-kca">
|
||||
<objects>
|
||||
<viewController title="Shapes" id="GQJ-Hp-Pf9" sceneMemberID="viewController">
|
||||
<view key="view" id="To1-Fe-AtI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="05R-gU-uKp" customClass="ShapesExampleView" customModule="Example_macOS" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="D3z-wL-l2P" customClass="ShapesExampleView" customModule="Example_macOS" customModuleProvider="target">
|
||||
<rect key="frame" x="125" y="0.0" width="350" height="480"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="350" id="2E2-Lj-XMk"/>
|
||||
</constraints>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="05R-gU-uKp" secondAttribute="bottom" id="3ff-8i-gMj"/>
|
||||
<constraint firstAttribute="trailing" secondItem="05R-gU-uKp" secondAttribute="trailing" id="GGY-rK-xao"/>
|
||||
<constraint firstItem="05R-gU-uKp" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" id="Yxg-Lv-nJ1"/>
|
||||
<constraint firstItem="05R-gU-uKp" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="dVI-sb-Nhb"/>
|
||||
<constraint firstAttribute="bottom" secondItem="D3z-wL-l2P" secondAttribute="bottom" id="8Im-Qx-btY"/>
|
||||
<constraint firstItem="D3z-wL-l2P" firstAttribute="top" secondItem="To1-Fe-AtI" secondAttribute="top" constant="20" id="8w2-gW-Wjf"/>
|
||||
<constraint firstItem="D3z-wL-l2P" firstAttribute="centerX" secondItem="To1-Fe-AtI" secondAttribute="centerX" id="Sg0-C8-DDx"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="EYN-Mf-krY" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="57" y="1044"/>
|
||||
</scene>
|
||||
<!--Animations-->
|
||||
<scene sceneID="mQS-s7-7Qq">
|
||||
<objects>
|
||||
<viewController title="Animations" id="mWu-e3-ocB" customClass="AnimationsViewController" customModule="Example_macOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" id="K6m-Lx-cTz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1Rb-D3-XW9" customClass="AnimationsView" customModule="Example_macOS" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
</customView>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bPP-dr-CnF">
|
||||
<rect key="frame" x="260" y="39" width="80" height="19"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="3MY-fR-U9d"/>
|
||||
<constraint firstAttribute="width" constant="80" id="Te3-mr-Bce"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="roundRect" title="Start" bezelStyle="roundedRect" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="wkK-UK-u12">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="startAnimationsAction:" target="mWu-e3-ocB" id="8K1-bW-xw9"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="bPP-dr-CnF" secondAttribute="bottom" constant="40" id="94k-Vi-ybb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1Rb-D3-XW9" secondAttribute="trailing" id="9cE-er-ZBS"/>
|
||||
<constraint firstItem="1Rb-D3-XW9" firstAttribute="leading" secondItem="K6m-Lx-cTz" secondAttribute="leading" id="J8j-Tu-jSk"/>
|
||||
<constraint firstItem="1Rb-D3-XW9" firstAttribute="top" secondItem="K6m-Lx-cTz" secondAttribute="top" id="SdM-su-R3z"/>
|
||||
<constraint firstItem="bPP-dr-CnF" firstAttribute="centerX" secondItem="K6m-Lx-cTz" secondAttribute="centerX" id="eod-st-ImC"/>
|
||||
<constraint firstAttribute="bottom" secondItem="1Rb-D3-XW9" secondAttribute="bottom" id="iJZ-ip-cKT"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="mainView" destination="05R-gU-uKp" id="IHx-rY-SpS"/>
|
||||
<outlet property="actionButton" destination="bPP-dr-CnF" id="2Ql-Wv-czh"/>
|
||||
<outlet property="animationsView" destination="1Rb-D3-XW9" id="Qgh-aE-e3M"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
<customObject id="ggI-l3-NeJ" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="57" y="755"/>
|
||||
<point key="canvasLocation" x="828" y="1037"/>
|
||||
</scene>
|
||||
<!--Easing-->
|
||||
<scene sceneID="UPp-EA-zFu">
|
||||
<objects>
|
||||
<viewController title="Easing" id="6Ok-1N-J6E" customClass="EasingViewController" customModule="Example_macOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" id="8S8-en-dQ9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="rMi-Lt-xst" customClass="EasingView" customModule="Example_macOS" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="rMi-Lt-xst" firstAttribute="leading" secondItem="8S8-en-dQ9" secondAttribute="leading" id="E6d-Fs-XSu"/>
|
||||
<constraint firstItem="rMi-Lt-xst" firstAttribute="top" secondItem="8S8-en-dQ9" secondAttribute="top" id="F4Q-5G-KAY"/>
|
||||
<constraint firstAttribute="bottom" secondItem="rMi-Lt-xst" secondAttribute="bottom" id="STw-fO-vXO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="rMi-Lt-xst" secondAttribute="trailing" id="YpZ-0X-Eb4"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="easingView" destination="rMi-Lt-xst" id="1Lm-UJ-vZD"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<customObject id="97s-Ny-kLm" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="57" y="1631"/>
|
||||
</scene>
|
||||
<!--Tranform-->
|
||||
<scene sceneID="BDK-cT-fde">
|
||||
<objects>
|
||||
<viewController title="Tranform" id="jao-64-FWC" sceneMemberID="viewController">
|
||||
<view key="view" id="LOa-Et-9Z8">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="CHZ-ou-3pJ" customClass="TransformExampleView" customModule="Example_macOS" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="CHZ-ou-3pJ" firstAttribute="top" secondItem="LOa-Et-9Z8" secondAttribute="top" id="MQ2-71-Q8T"/>
|
||||
<constraint firstAttribute="bottom" secondItem="CHZ-ou-3pJ" secondAttribute="bottom" id="j0W-Jy-EsB"/>
|
||||
<constraint firstAttribute="trailing" secondItem="CHZ-ou-3pJ" secondAttribute="trailing" id="xaj-cY-w1R"/>
|
||||
<constraint firstItem="CHZ-ou-3pJ" firstAttribute="leading" secondItem="LOa-Et-9Z8" secondAttribute="leading" id="yJd-5F-Abz"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="qef-Rz-hXA" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-701" y="1037"/>
|
||||
</scene>
|
||||
<!--Morhing-->
|
||||
<scene sceneID="Plb-hR-bEv">
|
||||
<objects>
|
||||
<viewController title="Morhing" id="Rn8-Li-WZ2" sceneMemberID="viewController">
|
||||
<view key="view" id="ZyY-lN-6hI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="tFf-Vb-fQM" customClass="MorphingView" customModule="Example_macOS" customModuleProvider="target">
|
||||
<rect key="frame" x="200" y="150" width="200" height="200"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="200" id="O3r-f7-WR6"/>
|
||||
<constraint firstAttribute="width" constant="200" id="akU-YZ-kuF"/>
|
||||
</constraints>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="tFf-Vb-fQM" firstAttribute="centerX" secondItem="ZyY-lN-6hI" secondAttribute="centerX" id="3vl-dy-NeQ"/>
|
||||
<constraint firstItem="tFf-Vb-fQM" firstAttribute="centerY" secondItem="ZyY-lN-6hI" secondAttribute="centerY" id="p6G-C4-Mkb"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="hfo-iR-W9t" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-701" y="1631"/>
|
||||
</scene>
|
||||
<!--SVG-->
|
||||
<scene sceneID="ZLO-Eh-m1d">
|
||||
<objects>
|
||||
<viewController title="SVG" id="iWh-Ne-7Ns" sceneMemberID="viewController">
|
||||
<view key="view" id="Vz6-zz-0Xw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="yvE-72-Fe6" customClass="SVGView" customModule="Macaw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="fileName" value="tiger"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="yvE-72-Fe6" secondAttribute="trailing" id="4UL-4W-9YN"/>
|
||||
<constraint firstItem="yvE-72-Fe6" firstAttribute="leading" secondItem="Vz6-zz-0Xw" secondAttribute="leading" id="Xi8-t8-OlL"/>
|
||||
<constraint firstAttribute="bottom" secondItem="yvE-72-Fe6" secondAttribute="bottom" id="l48-pg-5Kp"/>
|
||||
<constraint firstItem="yvE-72-Fe6" firstAttribute="top" secondItem="Vz6-zz-0Xw" secondAttribute="top" id="nQP-Ld-hzQ"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="SgK-6P-fu5" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="828" y="1631"/>
|
||||
</scene>
|
||||
<!--Events-->
|
||||
<scene sceneID="kTj-Ru-vPq">
|
||||
<objects>
|
||||
<viewController title="Events" id="9aj-uf-eJX" customClass="EventsExampleController" customModule="Example_macOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" id="Fg0-AZ-zer">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="3dq-O5-WZ6" customClass="MacawView" customModule="Macaw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="3dq-O5-WZ6" secondAttribute="trailing" id="FzC-3s-Kku"/>
|
||||
<constraint firstItem="3dq-O5-WZ6" firstAttribute="leading" secondItem="Fg0-AZ-zer" secondAttribute="leading" id="PUF-Il-bp3"/>
|
||||
<constraint firstItem="3dq-O5-WZ6" firstAttribute="top" secondItem="Fg0-AZ-zer" secondAttribute="top" id="Utd-UH-Vzg"/>
|
||||
<constraint firstAttribute="bottom" secondItem="3dq-O5-WZ6" secondAttribute="bottom" id="eNi-iP-YzC"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="macawView" destination="3dq-O5-WZ6" id="diH-cZ-09G"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<customObject id="RA2-nh-XE7" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="57" y="2256"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
@ -1,119 +1,118 @@
|
||||
import Macaw
|
||||
/*
|
||||
|
||||
class AnimationsView: MacawView {
|
||||
|
||||
var animation: Animation?
|
||||
var ballNodes = [Group]()
|
||||
var onComplete: (() -> ()) = {}
|
||||
|
||||
let n = 100
|
||||
let speed = 20.0
|
||||
let r = 10.0
|
||||
|
||||
var animation: Animation?
|
||||
var ballNodes = [Group]()
|
||||
var onComplete: (() -> ()) = {}
|
||||
|
||||
let n = 100
|
||||
let speed = 20.0
|
||||
let r = 10.0
|
||||
|
||||
let ballColors = [
|
||||
Color(val: 0x1abc9c),
|
||||
Color(val: 0x2ecc71),
|
||||
Color(val: 0x3498db),
|
||||
Color(val: 0x9b59b6),
|
||||
Color(val: 0xf1c40f),
|
||||
Color(val: 0xe67e22),
|
||||
Color(val: 0xe67e22),
|
||||
Color(val: 0xe74c3c)
|
||||
]
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(node: Group(), coder: aDecoder)
|
||||
}
|
||||
|
||||
func startAnimation() {
|
||||
if let animation = self.animation {
|
||||
animation.play()
|
||||
}
|
||||
}
|
||||
|
||||
func prepareAnimation() {
|
||||
ballNodes.removeAll()
|
||||
|
||||
let ballColors = [
|
||||
Color(val: 0x1abc9c),
|
||||
Color(val: 0x2ecc71),
|
||||
Color(val: 0x3498db),
|
||||
Color(val: 0x9b59b6),
|
||||
Color(val: 0xf1c40f),
|
||||
Color(val: 0xe67e22),
|
||||
Color(val: 0xe67e22),
|
||||
Color(val: 0xe74c3c)
|
||||
]
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(node: Group(), coder: aDecoder)
|
||||
}
|
||||
|
||||
func startAnimation() {
|
||||
if let animation = self.animation {
|
||||
animation.play()
|
||||
}
|
||||
}
|
||||
|
||||
func prepareAnimation() {
|
||||
ballNodes.removeAll()
|
||||
|
||||
var animations = [Animation]()
|
||||
|
||||
let screenBounds = UIScreen.main.bounds
|
||||
let startPos = Transform.move(
|
||||
dx: Double(screenBounds.width / 2) - r,
|
||||
dy: Double(screenBounds.height / 2) - r
|
||||
)
|
||||
|
||||
var velocities = [Point]()
|
||||
var positions = [Point]()
|
||||
|
||||
func posForTime(_ t: Double, index: Int) -> Point {
|
||||
|
||||
let prevPos = positions[index]
|
||||
var velocity = velocities[index]
|
||||
|
||||
var pos = prevPos.add(velocity)
|
||||
|
||||
// Borders
|
||||
if pos.x < Double(self.bounds.width) / -2.0 || pos.x > Double(self.bounds.width) / 2.0 {
|
||||
velocity = Point(x: -1.0 * velocity.x, y: velocity.y)
|
||||
velocities[index] = velocity
|
||||
pos = prevPos.add(velocity)
|
||||
}
|
||||
|
||||
if pos.y < Double(self.bounds.height) / -2.0 || pos.y > Double(self.bounds.height) / 2.0 {
|
||||
velocity = Point(x: velocity.x, y: -1.0 * velocity.y)
|
||||
velocities[index] = velocity
|
||||
pos = prevPos.add(velocity)
|
||||
}
|
||||
|
||||
return pos
|
||||
}
|
||||
|
||||
for i in 0 ... (n - 1) {
|
||||
// Node
|
||||
let circle = Circle(cx: r, cy: r, r: r)
|
||||
let shape = Shape(
|
||||
form: circle,
|
||||
fill: ballColors[Int(arc4random() % 7)]
|
||||
)
|
||||
|
||||
let ballGroup = Group(contents: [shape])
|
||||
ballNodes.append(ballGroup)
|
||||
|
||||
// Animation
|
||||
let velocity = Point(
|
||||
x: -0.5 * speed + speed * Double(arc4random() % 1000) / 1000.0,
|
||||
y: -0.5 * speed + speed * Double(arc4random() % 1000) / 1000.0)
|
||||
velocities.append(velocity)
|
||||
positions.append(Point(x: 0.0, y: 0.0))
|
||||
|
||||
let anim = ballGroup.placeVar.animation({ (t) -> Transform in
|
||||
let pos = posForTime(t, index: i)
|
||||
positions[i] = pos
|
||||
return Transform().move(
|
||||
dx: pos.x,
|
||||
dy: pos.y)
|
||||
}, during: 3.0)
|
||||
|
||||
animations.append([
|
||||
anim,
|
||||
ballGroup.opacityVar.animation((0.1 >> 1.0).t(3.0))
|
||||
].combine())
|
||||
}
|
||||
|
||||
animation = animations.combine().autoreversed().onComplete {
|
||||
self.completeAnimation()
|
||||
}
|
||||
|
||||
let node = Group(contents: ballNodes)
|
||||
node.place = Transform().move(dx: startPos.dx, dy: startPos.dy)
|
||||
self.node = node
|
||||
}
|
||||
|
||||
func completeAnimation() {
|
||||
self.node = Group()
|
||||
self.prepareAnimation()
|
||||
self.onComplete()
|
||||
}
|
||||
var animations = [Animation]()
|
||||
|
||||
let screenBounds = self.bounds
|
||||
let startPos = Transform.move(
|
||||
dx: Double(screenBounds.width / 2) - r,
|
||||
dy: Double(screenBounds.height / 2) - r
|
||||
)
|
||||
|
||||
var velocities = [Point]()
|
||||
var positions = [Point]()
|
||||
|
||||
func posForTime(_ t: Double, index: Int) -> Point {
|
||||
|
||||
let prevPos = positions[index]
|
||||
var velocity = velocities[index]
|
||||
|
||||
var pos = prevPos.add(velocity)
|
||||
|
||||
// Borders
|
||||
if pos.x < Double(self.bounds.width) / -2.0 || pos.x > Double(self.bounds.width) / 2.0 {
|
||||
velocity = Point(x: -1.0 * velocity.x, y: velocity.y)
|
||||
velocities[index] = velocity
|
||||
pos = prevPos.add(velocity)
|
||||
}
|
||||
|
||||
if pos.y < Double(self.bounds.height) / -2.0 || pos.y > Double(self.bounds.height) / 2.0 {
|
||||
velocity = Point(x: velocity.x, y: -1.0 * velocity.y)
|
||||
velocities[index] = velocity
|
||||
pos = prevPos.add(velocity)
|
||||
}
|
||||
|
||||
return pos
|
||||
}
|
||||
|
||||
for i in 0 ... (n - 1) {
|
||||
// Node
|
||||
let circle = Circle(cx: r, cy: r, r: r)
|
||||
let shape = Shape(
|
||||
form: circle,
|
||||
fill: ballColors[Int(arc4random() % 7)]
|
||||
)
|
||||
|
||||
let ballGroup = Group(contents: [shape])
|
||||
ballNodes.append(ballGroup)
|
||||
|
||||
// Animation
|
||||
let velocity = Point(
|
||||
x: -0.5 * speed + speed * Double(arc4random() % 1000) / 1000.0,
|
||||
y: -0.5 * speed + speed * Double(arc4random() % 1000) / 1000.0)
|
||||
velocities.append(velocity)
|
||||
positions.append(Point(x: 0.0, y: 0.0))
|
||||
|
||||
let anim = ballGroup.placeVar.animation({ (t) -> Transform in
|
||||
let pos = posForTime(t, index: i)
|
||||
positions[i] = pos
|
||||
return Transform().move(
|
||||
dx: pos.x,
|
||||
dy: pos.y)
|
||||
}, during: 3.0)
|
||||
|
||||
animations.append([
|
||||
anim,
|
||||
ballGroup.opacityVar.animation((0.1 >> 1.0).t(3.0))
|
||||
].combine())
|
||||
}
|
||||
|
||||
animation = animations.combine().autoreversed().onComplete {
|
||||
self.completeAnimation()
|
||||
}
|
||||
|
||||
let node = Group(contents: ballNodes)
|
||||
node.place = Transform().move(dx: startPos.dx, dy: startPos.dy)
|
||||
self.node = node
|
||||
}
|
||||
|
||||
func completeAnimation() {
|
||||
self.node = Group()
|
||||
self.prepareAnimation()
|
||||
self.onComplete()
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// AnimationsViewController.swift
|
||||
// Example-macOS
|
||||
//
|
||||
// Created by Daniil Manin on 8/15/17.
|
||||
//
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class AnimationsViewController: NSViewController {
|
||||
|
||||
@IBOutlet weak var animationsView: AnimationsView!
|
||||
@IBOutlet weak var actionButton: NSButton!
|
||||
|
||||
override func viewDidAppear() {
|
||||
super.viewDidAppear()
|
||||
|
||||
animationsView?.onComplete = {
|
||||
self.actionButton?.isEnabled = true
|
||||
}
|
||||
animationsView?.prepareAnimation()
|
||||
}
|
||||
|
||||
override func viewDidDisappear() {
|
||||
super.viewDidDisappear()
|
||||
|
||||
self.actionButton?.isEnabled = true
|
||||
}
|
||||
|
||||
@IBAction func startAnimationsAction(_ sender: Any) {
|
||||
animationsView?.startAnimation()
|
||||
actionButton?.isEnabled = false
|
||||
}
|
||||
}
|
@ -1,44 +1,44 @@
|
||||
import Macaw
|
||||
|
||||
class EasingView: MacawView {
|
||||
var mAnimations = [Animation]()
|
||||
var circlesNodes = [Group]()
|
||||
var animation: Animation!
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
let screenSize = CGRect(origin: CGPoint.zero, size: CGSize(width: 600.0, height: 500.0))
|
||||
let centerX = Double(screenSize.width / 2)
|
||||
|
||||
var anims = [Animation]()
|
||||
var circlesNodes = [Group]()
|
||||
var animation: Animation!
|
||||
let fromStroke = Stroke(fill: Color.black, width: 3)
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
let screenSize: CGRect = NSScreen.main()!.frame
|
||||
let centerX = Double(screenSize.width / 2)
|
||||
|
||||
let fromStroke = Stroke(fill: Color.black, width: 3)
|
||||
|
||||
let all = [Easing.ease, Easing.linear, Easing.easeIn, Easing.easeOut, Easing.easeInOut]
|
||||
|
||||
for (i, easing) in all.enumerated() {
|
||||
let y = Double(150 + i * 120)
|
||||
let title = EasingView.title(easing: easing)
|
||||
let titleText = Text(text: title, align: .mid, place: .move(dx: centerX, dy: y - 70))
|
||||
|
||||
let fromCircle = Circle(cx: centerX - 100, cy: y, r: 25).stroke(with: fromStroke)
|
||||
let toPlace = fromCircle.place.move(dx: 200, dy: 0)
|
||||
|
||||
let toAnimation = fromCircle.placeVar.animation(to: toPlace).easing(easing)
|
||||
|
||||
anims.append([toAnimation.autoreversed()].sequence())
|
||||
circlesNodes.append(Group(contents: [fromCircle, titleText]))
|
||||
}
|
||||
|
||||
animation = anims.combine().cycle()
|
||||
super.init(node: circlesNodes.group(), coder: aDecoder)
|
||||
let all = [Easing.ease, Easing.linear, Easing.easeIn, Easing.easeOut, Easing.easeInOut]
|
||||
|
||||
for (i, easing) in all.enumerated() {
|
||||
let y = Double(75 + i * 80)
|
||||
let title = EasingView.title(easing: easing)
|
||||
let titleText = Text(text: title, align: .mid, place: .move(dx: centerX, dy: y - 45))
|
||||
|
||||
let fromCircle = Circle(cx: centerX - 100, cy: y, r: 25).stroke(with: fromStroke)
|
||||
let toPlace = fromCircle.place.move(dx: 200, dy: 0)
|
||||
|
||||
let toAnimation = fromCircle.placeVar.animation(to: toPlace).easing(easing)
|
||||
|
||||
mAnimations.append([toAnimation.autoreversed()].sequence())
|
||||
circlesNodes.append(Group(contents: [titleText]))
|
||||
circlesNodes.append(Group(contents: [fromCircle]))
|
||||
}
|
||||
|
||||
fileprivate static func title(easing: Easing) -> String {
|
||||
switch easing {
|
||||
case .ease: return "Ease"
|
||||
case .linear: return "Linear"
|
||||
case .easeIn: return "Ease In"
|
||||
case .easeOut: return "Ease Out"
|
||||
case .easeInOut: return "Ease InOut"
|
||||
}
|
||||
animation = mAnimations.combine().cycle()
|
||||
super.init(node: circlesNodes.group(), coder: aDecoder)
|
||||
}
|
||||
|
||||
fileprivate static func title(easing: Easing) -> String {
|
||||
switch easing {
|
||||
case .ease: return "Ease"
|
||||
case .linear: return "Linear"
|
||||
case .easeIn: return "Ease In"
|
||||
case .easeOut: return "Ease Out"
|
||||
case .easeInOut: return "Ease InOut"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
//
|
||||
// EasingViewController.swift
|
||||
// Example-macOS
|
||||
//
|
||||
// Created by Daniil Manin on 8/15/17.
|
||||
//
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class EasingViewController: NSViewController {
|
||||
@IBOutlet weak var easingView: EasingView!
|
||||
|
||||
override func viewDidAppear() {
|
||||
super.viewDidAppear()
|
||||
easingView.animation.play()
|
||||
}
|
||||
|
||||
override func viewWillDisappear() {
|
||||
super.viewDidDisappear()
|
||||
easingView.animation.stop()
|
||||
}
|
||||
}
|
@ -7,144 +7,121 @@
|
||||
//
|
||||
|
||||
import Macaw
|
||||
/*
|
||||
class EventsExampleController: UIViewController {
|
||||
|
||||
|
||||
@IBOutlet weak var macawView: MacawView?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
macawView?.node = loadScene()
|
||||
}
|
||||
|
||||
|
||||
enum PanelTool {
|
||||
case ellipse
|
||||
case rectangle
|
||||
}
|
||||
|
||||
var selectedTool: PanelTool?
|
||||
|
||||
private func loadScene() -> Node {
|
||||
return [
|
||||
createCanvas(),
|
||||
createPanel(),
|
||||
].group()
|
||||
}
|
||||
|
||||
private func createPanel() -> Node {
|
||||
let panel = Shape(form: Rect(x: 10.0, y: 10.0, w: 80.0, h: 120.0), fill: Color.white, stroke: Stroke(fill: Color.black, width: 1.0))
|
||||
|
||||
|
||||
let panelGroup = [
|
||||
panel,
|
||||
createTools()
|
||||
].group()
|
||||
|
||||
panelGroup.onPan { event in
|
||||
panelGroup.place = panelGroup.place.move(dx: event.dx, dy: event.dy)
|
||||
}
|
||||
|
||||
return panelGroup
|
||||
class EventsExampleController: NSViewController {
|
||||
|
||||
@IBOutlet weak var macawView: MacawView?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
macawView?.node = loadScene()
|
||||
}
|
||||
|
||||
enum PanelTool {
|
||||
case ellipse
|
||||
case rectangle
|
||||
}
|
||||
|
||||
var selectedTool: PanelTool?
|
||||
|
||||
private func loadScene() -> Node {
|
||||
|
||||
return [createCanvas(), createPanel()].group()
|
||||
}
|
||||
|
||||
private func createPanel() -> Node {
|
||||
let panel = Shape(form: Rect(x: 10.0, y: 10.0, w: 80.0, h: 120.0), fill: Color.clear, stroke: Stroke(fill: Color.black, width: 1.0))
|
||||
let panelGroup = [panel, createTools()].group()
|
||||
|
||||
panelGroup.onPan { event in
|
||||
panelGroup.place = panelGroup.place.move(dx: event.dx, dy: event.dy)
|
||||
}
|
||||
|
||||
private func createCanvas() -> Node {
|
||||
let canvas = Shape(form: Rect(x: 0.0, y: 0.0,
|
||||
w: Double(macawView!.bounds.width),
|
||||
h: Double(macawView!.bounds.height)),
|
||||
fill: Color.white)
|
||||
let objectsGroup = Group(contents:[])
|
||||
return panelGroup
|
||||
}
|
||||
|
||||
private func createCanvas() -> Node {
|
||||
let canvas = Shape(form: Rect(x: 0.0, y: 0.0,
|
||||
w: Double(macawView!.bounds.width),
|
||||
h: Double(macawView!.bounds.height)),
|
||||
fill: Color.clear)
|
||||
let objectsGroup = Group(contents:[])
|
||||
|
||||
var startPoint = Point()
|
||||
var currentFigure: Shape?
|
||||
|
||||
canvas.onTap { event in
|
||||
guard let tool = self.selectedTool else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let loc = event.location else {
|
||||
return
|
||||
}
|
||||
|
||||
startPoint = loc
|
||||
switch tool {
|
||||
case .ellipse:
|
||||
currentFigure = Shape(form: Ellipse(cx: startPoint.x, cy: startPoint.y, rx: 0.0, ry: 0.0))
|
||||
|
||||
var startPoint = Point()
|
||||
var currentFigure: Shape?
|
||||
|
||||
canvas.onTouchPressed { event in
|
||||
guard let tool = self.selectedTool else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let loc = event.points.first?.location else {
|
||||
return
|
||||
}
|
||||
|
||||
startPoint = loc
|
||||
switch tool {
|
||||
case .ellipse:
|
||||
currentFigure = Shape(form: Ellipse(cx: startPoint.x, cy: startPoint.y, rx: 0.0, ry: 0.0))
|
||||
break
|
||||
|
||||
case .rectangle:
|
||||
currentFigure = Shape(form: Rect(x: startPoint.x, y: startPoint.y, w: 0.0, h: 0.0))
|
||||
break
|
||||
}
|
||||
|
||||
var updatedContents = objectsGroup.contents
|
||||
updatedContents.append(currentFigure!)
|
||||
|
||||
objectsGroup.contents = updatedContents
|
||||
}
|
||||
|
||||
canvas.onTouchMoved { event in
|
||||
guard let tool = self.selectedTool else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let loc = event.points.first?.location else {
|
||||
return
|
||||
}
|
||||
|
||||
let width = loc.x - startPoint.x
|
||||
let height = loc.y - startPoint.y
|
||||
|
||||
switch tool {
|
||||
case .ellipse:
|
||||
|
||||
currentFigure?.form = Ellipse(
|
||||
cx: startPoint.x + width / 2.0,
|
||||
cy: startPoint.y + height / 2.0,
|
||||
rx: width / 2.0,
|
||||
ry: height / 2.0)
|
||||
break
|
||||
|
||||
case .rectangle:
|
||||
currentFigure?.form = Rect(x: startPoint.x, y: startPoint.y, w: width, h: height)
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return [
|
||||
canvas,
|
||||
objectsGroup
|
||||
].group()
|
||||
case .rectangle:
|
||||
currentFigure = Shape(form: Rect(x: startPoint.x, y: startPoint.y, w: 0.0, h: 0.0))
|
||||
}
|
||||
|
||||
var updatedContents = objectsGroup.contents
|
||||
updatedContents.append(currentFigure!)
|
||||
|
||||
objectsGroup.contents = updatedContents
|
||||
}
|
||||
|
||||
private func createTools() -> Node {
|
||||
let ellipseTool = Shape(form: Ellipse(cx: 50.0, cy: 50.0, rx: 25, ry: 15),
|
||||
fill: Color.white,
|
||||
stroke: Stroke(fill: Color.black, width: 1.0))
|
||||
let rectTool = Shape(form: Rect(x: 25.0, y: 75.0, w: 50.0, h: 30.0),
|
||||
fill: Color.white,
|
||||
stroke: Stroke(fill: Color.black, width: 1.0))
|
||||
canvas.onPan { event in
|
||||
guard let tool = self.selectedTool else {
|
||||
return
|
||||
}
|
||||
|
||||
let width = event.dx
|
||||
let height = event.dy
|
||||
|
||||
switch tool {
|
||||
case .ellipse:
|
||||
currentFigure?.form = Ellipse(
|
||||
cx: startPoint.x + width / 2.0,
|
||||
cy: startPoint.y + height / 2.0,
|
||||
rx: width / 2.0,
|
||||
ry: height / 2.0)
|
||||
|
||||
ellipseTool.onTap { _ in
|
||||
self.selectedTool = .ellipse
|
||||
ellipseTool.stroke = Stroke(fill: Color.blue, width: 2.0)
|
||||
rectTool.stroke = Stroke(fill: Color.black, width: 1.0)
|
||||
}
|
||||
|
||||
rectTool.onTap { _ in
|
||||
self.selectedTool = .rectangle
|
||||
rectTool.stroke = Stroke(fill: Color.blue, width: 2.0)
|
||||
ellipseTool.stroke = Stroke(fill: Color.black, width: 1.0)
|
||||
}
|
||||
|
||||
return [
|
||||
ellipseTool,
|
||||
rectTool
|
||||
].group()
|
||||
case .rectangle:
|
||||
currentFigure?.form = Rect(x: startPoint.x, y: startPoint.y, w: width, h: height)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return [canvas, objectsGroup].group()
|
||||
}
|
||||
|
||||
private func createTools() -> Node {
|
||||
let ellipseTool = Shape(form: Ellipse(cx: 50.0, cy: 50.0, rx: 25, ry: 15),
|
||||
fill: Color.clear,
|
||||
stroke: Stroke(fill: Color.black, width: 1.0))
|
||||
|
||||
let rectTool = Shape(form: Rect(x: 25.0, y: 75.0, w: 50.0, h: 30.0),
|
||||
fill: Color.clear,
|
||||
stroke: Stroke(fill: Color.black, width: 1.0))
|
||||
|
||||
ellipseTool.onTap { _ in
|
||||
self.selectedTool = .ellipse
|
||||
ellipseTool.stroke = Stroke(fill: Color.blue, width: 2.0)
|
||||
rectTool.stroke = Stroke(fill: Color.black, width: 1.0)
|
||||
}
|
||||
|
||||
rectTool.onTap { _ in
|
||||
self.selectedTool = .rectangle
|
||||
rectTool.stroke = Stroke(fill: Color.blue, width: 2.0)
|
||||
ellipseTool.stroke = Stroke(fill: Color.black, width: 1.0)
|
||||
}
|
||||
|
||||
return [ellipseTool, rectTool].group()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -9,32 +9,32 @@
|
||||
import Macaw
|
||||
|
||||
class MorphingView: MacawView {
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(node: MorphingView.newScene(), coder: aDecoder)
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(node: MorphingView.newScene(), coder: aDecoder)
|
||||
}
|
||||
|
||||
class func newScene() -> Node {
|
||||
let stroke = Stroke(width: 15.0, cap: .round)
|
||||
|
||||
let contents1 = [
|
||||
Shape(form: Line(x1: 50.0, y1: 50.0, x2: 75.0, y2: 25.0), stroke: stroke),
|
||||
Shape(form: Line(x1: 50.0, y1: 50.0, x2: 125.0, y2: 50.0), stroke: stroke),
|
||||
Shape(form: Line(x1: 50.0, y1: 50.0, x2: 75.0, y2: 75.0), stroke: stroke),
|
||||
]
|
||||
|
||||
let contents2 = [
|
||||
Shape(form: Line(x1: 50.0, y1: 10.0, x2: 165.0, y2: 10.0), stroke: stroke),
|
||||
Shape(form: Line(x1: 50.0, y1: 50.0, x2: 165.0, y2: 50.0), stroke: stroke),
|
||||
Shape(form: Line(x1: 50.0, y1: 90.0, x2: 165.0, y2: 90.0), stroke: stroke),
|
||||
]
|
||||
|
||||
var switched = false
|
||||
let group = contents1.group()
|
||||
group.onTap { e in
|
||||
group.contentsVar.animate(to: switched ? contents1 : contents2)
|
||||
switched = !switched
|
||||
}
|
||||
|
||||
class func newScene() -> Node {
|
||||
let stroke = Stroke(width: 15.0, cap: .round)
|
||||
|
||||
let contents1 = [
|
||||
Shape(form: Line(x1: 150.0, y1: 150.0, x2: 175.0, y2: 125.0), stroke: stroke),
|
||||
Shape(form: Line(x1: 150.0, y1: 150.0, x2: 225.0, y2: 150.0), stroke: stroke),
|
||||
Shape(form: Line( x1: 150.0, y1: 150.0, x2: 175.0, y2: 175.0), stroke: stroke),
|
||||
]
|
||||
|
||||
let contents2 = [
|
||||
Shape(form: Line(x1: 130.0, y1: 110.0, x2: 245.0, y2: 110.0), stroke: stroke),
|
||||
Shape(form: Line(x1: 130.0, y1: 150.0, x2: 245.0, y2: 150.0), stroke: stroke),
|
||||
Shape(form: Line(x1: 130.0, y1: 190.0, x2: 245.0, y2: 190.0), stroke: stroke),
|
||||
]
|
||||
|
||||
var switched = false
|
||||
let group = contents1.group()
|
||||
group.onTap { e in
|
||||
group.contentsVar.animate(to: switched ? contents1 : contents2)
|
||||
switched = !switched
|
||||
}
|
||||
return group
|
||||
}
|
||||
return group
|
||||
}
|
||||
}
|
||||
|
@ -9,71 +9,71 @@
|
||||
import Macaw
|
||||
|
||||
class ShapesExampleView: MacawView {
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
let text1 = ShapesExampleView.newText("Point", .move(dx: 100, dy: 40))
|
||||
let point = Point(x: 100, y: 50).stroke(fill: Color.black, width: 7, cap: .round)
|
||||
|
||||
let text2 = ShapesExampleView.newText("Line", .move(dx: 250, dy: 40))
|
||||
let line = Line(x1: 200, y1: 50, x2: 300, y2: 50).stroke(fill: Color.black, width: 4)
|
||||
|
||||
let text3 = ShapesExampleView.newText("Polyline", .move(dx: 100, dy: 90))
|
||||
let polyline = Polyline(points: [100, 100, 150, 150, 50, 150]).stroke(fill: Color.navy, dashes: [3, 3])
|
||||
|
||||
let text4 = ShapesExampleView.newText("Polygon", .move(dx: 250, dy: 90))
|
||||
let polygon = Polygon(points: [250, 100, 300, 150, 200, 150]).fill(with: Color.blue)
|
||||
|
||||
let text5 = ShapesExampleView.newText("Rect", .move(dx: 100, dy: 200))
|
||||
let rect = Rect(x: 50, y: 200, w: 100, h: 50).fill(with: LinearGradient(
|
||||
x2: 1, y2: 1,
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0xFFAE27)),
|
||||
Stop(offset: 1, color: Color(val: 0xDE496D))
|
||||
]
|
||||
))
|
||||
|
||||
let text6 = ShapesExampleView.newText("RoundRect", .move(dx: 250, dy: 200))
|
||||
let round = Rect(x: 200, y: 200, w: 100, h: 50).round(rx: 10, ry: 10).fill(with: LinearGradient(
|
||||
x2: 1, y2: 1,
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0xDE496D)),
|
||||
Stop(offset: 0.5, color: Color(val: 0xAB49DE)),
|
||||
Stop(offset: 1, color: Color(val: 0x4954DE))
|
||||
]
|
||||
))
|
||||
|
||||
let text7 = ShapesExampleView.newText("Circle", .move(dx: 75, dy: 300))
|
||||
let circle = Circle(cx: 75, cy: 325, r: 25).fill(with: RadialGradient(
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0xF5027C)),
|
||||
Stop(offset: 1, color: Color(val: 0x850143))
|
||||
]
|
||||
))
|
||||
|
||||
let text8 = ShapesExampleView.newText("Ellipse", .move(dx: 175, dy: 300))
|
||||
let ellipse = Ellipse(cx: 175, cy: 325, rx: 50, ry: 25).fill(with: RadialGradient(
|
||||
fx: 0.05, fy: 0.05, r: 0.65,
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0x00ee00)),
|
||||
Stop(offset: 1, color: Color(val: 0x006600))
|
||||
]
|
||||
))
|
||||
|
||||
let text9 = ShapesExampleView.newText("Arc", .move(dx: 275, dy: 300))
|
||||
let arc = Circle(cx: 250, cy: 300, r: 50).arc(shift: 0, extent: Double.pi / 2.0).stroke(fill: Color.green)
|
||||
|
||||
let group = Group(
|
||||
contents: [
|
||||
point, line, polyline, polygon, rect, round, circle, ellipse, arc,
|
||||
text1, text2, text3, text4, text5, text6, text7, text8, text9
|
||||
]
|
||||
)
|
||||
|
||||
super.init(node: group, coder: aDecoder)
|
||||
}
|
||||
|
||||
fileprivate static func newText(_ text: String, _ place: Transform, baseline: Baseline = .bottom) -> Text {
|
||||
return Text(text: text, fill: Color.black, align: .mid, baseline: baseline, place: place)
|
||||
}
|
||||
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
let text1 = ShapesExampleView.newText("Point", .move(dx: 100, dy: 40))
|
||||
let point = Point(x: 100, y: 50).stroke(fill: Color.black, width: 7, cap: .round)
|
||||
|
||||
let text2 = ShapesExampleView.newText("Line", .move(dx: 250, dy: 40))
|
||||
let line = Line(x1: 200, y1: 50, x2: 300, y2: 50).stroke(fill: Color.black, width: 4)
|
||||
|
||||
let text3 = ShapesExampleView.newText("Polyline", .move(dx: 100, dy: 90))
|
||||
let polyline = Polyline(points: [100, 100, 150, 150, 50, 150]).stroke(fill: Color.navy, dashes: [3, 3])
|
||||
|
||||
let text4 = ShapesExampleView.newText("Polygon", .move(dx: 250, dy: 90))
|
||||
let polygon = Polygon(points: [250, 100, 300, 150, 200, 150]).fill(with: Color.blue)
|
||||
|
||||
let text5 = ShapesExampleView.newText("Rect", .move(dx: 100, dy: 200))
|
||||
let rect = Rect(x: 50, y: 210, w: 100, h: 50).fill(with: LinearGradient(
|
||||
x2: 1, y2: 1,
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0xFFAE27)),
|
||||
Stop(offset: 1, color: Color(val: 0xDE496D))
|
||||
]
|
||||
))
|
||||
|
||||
let text6 = ShapesExampleView.newText("RoundRect", .move(dx: 250, dy: 200))
|
||||
let round = Rect(x: 200, y: 210, w: 100, h: 50).round(rx: 10, ry: 10).fill(with: LinearGradient(
|
||||
x2: 1, y2: 1,
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0xDE496D)),
|
||||
Stop(offset: 0.5, color: Color(val: 0xAB49DE)),
|
||||
Stop(offset: 1, color: Color(val: 0x4954DE))
|
||||
]
|
||||
))
|
||||
|
||||
let text7 = ShapesExampleView.newText("Circle", .move(dx: 75, dy: 300))
|
||||
let circle = Circle(cx: 75, cy: 335, r: 25).fill(with: RadialGradient(
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0xF5027C)),
|
||||
Stop(offset: 1, color: Color(val: 0x850143))
|
||||
]
|
||||
))
|
||||
|
||||
let text8 = ShapesExampleView.newText("Ellipse", .move(dx: 175, dy: 300))
|
||||
let ellipse = Ellipse(cx: 175, cy: 335, rx: 50, ry: 25).fill(with: RadialGradient(
|
||||
fx: 0.05, fy: 0.05, r: 0.65,
|
||||
stops: [
|
||||
Stop(offset: 0, color: Color(val: 0x00ee00)),
|
||||
Stop(offset: 1, color: Color(val: 0x006600))
|
||||
]
|
||||
))
|
||||
|
||||
let text9 = ShapesExampleView.newText("Arc", .move(dx: 275, dy: 300))
|
||||
let arc = Circle(cx: 250, cy: 310, r: 50).arc(shift: 0, extent: Double.pi / 2.0).stroke(fill: Color.green)
|
||||
|
||||
let group = Group(
|
||||
contents: [
|
||||
point, line, polyline, polygon, rect, round, circle, ellipse, arc,
|
||||
text1, text2, text3, text4, text5, text6, text7, text8, text9
|
||||
]
|
||||
)
|
||||
|
||||
super.init(node: group, coder: aDecoder)
|
||||
}
|
||||
|
||||
fileprivate static func newText(_ text: String, _ place: Transform, baseline: Baseline = .bottom) -> Text {
|
||||
return Text(text: text, fill: Color.black, align: .mid, baseline: baseline, place: place)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,60 +10,61 @@ import Foundation
|
||||
import Macaw
|
||||
|
||||
class TransformExampleView: MacawView {
|
||||
|
||||
fileprivate static let transforms = [Transform.scale(sx: 2, sy: 2),
|
||||
Transform.move(dx: 100, dy: 30),
|
||||
Transform.rotate(angle: Double.pi / 4.0, x: 150, y: 80),
|
||||
Transform.rotate(angle: Double.pi / 4.0)]
|
||||
|
||||
fileprivate static let titles = ["Transform.scale(sx: 2, sy: 2)",
|
||||
"Transform.move(dx: 100, dy: 30)",
|
||||
"Transform.rotate(angle: M_PI_4, x: 150, y: 80)",
|
||||
"Transform.rotate(angle: M_PI_4)"]
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(node: TransformExampleView.newScene(), coder: aDecoder)
|
||||
}
|
||||
|
||||
fileprivate static func newScene() -> Node {
|
||||
let shape = Shape(form: Rect(x: 0, y: 0, w: 50, h: 50), fill: Color.blue)
|
||||
let textes = Group(place: .move(dx: 50, dy: 275))
|
||||
for (i, item) in titles.enumerated() {
|
||||
let place = Transform.move(dx: 0, dy: Double(i * 25))
|
||||
textes.contents.append(Text(text: item, baseline: .bottom, place: place, opacity: 0))
|
||||
}
|
||||
var combines: [Transform] = [Transform.identity]
|
||||
for transform in transforms {
|
||||
combines.append(GeomUtils.concat(t1: transform, t2: combines.last!))
|
||||
}
|
||||
var state = 0
|
||||
|
||||
shape.onTouchPressed { _ in
|
||||
if (state < textes.contents.count) {
|
||||
textes.contents[state].opacityVar.animate(from: 0.0, to: 1.0, during: 0.6)
|
||||
} else {
|
||||
for item in textes.contents {
|
||||
item.opacityVar.animate(from: 1.0, to: 0.0, during: 0.6)
|
||||
}
|
||||
}
|
||||
state = (state + 1) % 5;
|
||||
shape.placeVar.animate(to: combines[state], during: 0.6)
|
||||
|
||||
fileprivate static let transforms = [Transform.scale(sx: 2, sy: 2),
|
||||
Transform.move(dx: 100, dy: 30),
|
||||
Transform.rotate(angle: Double.pi / 4.0, x: 150, y: 80),
|
||||
Transform.rotate(angle: Double.pi / 4.0)]
|
||||
|
||||
fileprivate static let titles = ["Transform.scale(sx: 2, sy: 2)",
|
||||
"Transform.move(dx: 100, dy: 30)",
|
||||
"Transform.rotate(angle: M_PI_4, x: 150, y: 80)",
|
||||
"Transform.rotate(angle: M_PI_4)"]
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(node: TransformExampleView.newScene(), coder: aDecoder)
|
||||
}
|
||||
|
||||
fileprivate static func newScene() -> Node {
|
||||
let shape = Shape(form: Rect(x: 0, y: 0, w: 50, h: 50), fill: Color.blue)
|
||||
let textes = Group(place: .move(dx: 50, dy: 275))
|
||||
for (i, item) in titles.enumerated() {
|
||||
let place = Transform.move(dx: 0, dy: Double(i * 25))
|
||||
textes.contents.append(Text(text: item, baseline: .bottom, place: place, opacity: 0))
|
||||
}
|
||||
var combines: [Transform] = [Transform.identity]
|
||||
for transform in transforms {
|
||||
combines.append(GeomUtils.concat(t1: transform, t2: combines.last!))
|
||||
}
|
||||
var state = 0
|
||||
|
||||
shape.onTap { _ in
|
||||
if (state < textes.contents.count) {
|
||||
textes.contents[state].opacityVar.animate(from: 0.0, to: 1.0, during: 0.6)
|
||||
} else {
|
||||
for item in textes.contents {
|
||||
item.opacityVar.animate(from: 1.0, to: 0.0, during: 0.6)
|
||||
}
|
||||
|
||||
return Group(contents: [newAxes(), shape, textes], place: .move(dx: 10, dy: 10))
|
||||
}
|
||||
|
||||
fileprivate static func newAxes() -> Node {
|
||||
var items: [Node] = []
|
||||
let gray = Color(val: 0xF0F0F0)
|
||||
for i in 1...20 {
|
||||
let shift = Double(i) * 50.0
|
||||
items.append(Line(x1: -50, y1: shift, x2: 1000, y2: shift).stroke(fill: gray))
|
||||
items.append(Line(x1: shift, y1: -50, x2: shift, y2: 1000).stroke(fill: gray))
|
||||
}
|
||||
items.append(Line(x1: -10, y1: 0, x2: 1000, y2: 0).stroke())
|
||||
items.append(Line(x1: 0, y1: -10, x2: 0, y2: 1000).stroke())
|
||||
return Group(contents: items)
|
||||
}
|
||||
|
||||
}
|
||||
state = (state + 1) % 5;
|
||||
shape.placeVar.animate(to: combines[state], during: 0.6)
|
||||
}
|
||||
|
||||
let group = Group(contents: [newAxes(), shape, textes], place: .move(dx: 10, dy: 10))
|
||||
return group
|
||||
}
|
||||
|
||||
fileprivate static func newAxes() -> Node {
|
||||
var items: [Node] = []
|
||||
|
||||
for i in 1...20 {
|
||||
let shift = Double(i) * 50.0
|
||||
items.append(Line(x1: -50, y1: shift, x2: 1000, y2: shift).stroke(fill: Color.gray))
|
||||
items.append(Line(x1: shift, y1: -50, x2: shift, y2: 1000).stroke(fill: Color.gray))
|
||||
}
|
||||
|
||||
items.append(Line(x1: -10, y1: 0, x2: 1000, y2: 0).stroke())
|
||||
items.append(Line(x1: 0, y1: -10, x2: 0, y2: 1000).stroke())
|
||||
return Group(contents: items)
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ open class Group: Node {
|
||||
}
|
||||
|
||||
override public func nodesBy(tag: String) -> [Node] {
|
||||
|
||||
var result = [Node]()
|
||||
contents.forEach { child in
|
||||
result.append(contentsOf: child.nodesBy(tag: tag))
|
||||
|
@ -94,11 +94,15 @@ import Foundation
|
||||
var mLayer: CALayer? {
|
||||
return self.layer
|
||||
}
|
||||
|
||||
|
||||
var mGestureRecognizers: [MGestureRecognizer]? {
|
||||
return self.gestureRecognizers
|
||||
}
|
||||
|
||||
func removeGestureRecognizers() {
|
||||
self.gestureRecognizers?.removeAll()
|
||||
}
|
||||
|
||||
open override func touchesBegan(_ touches: Set<MTouch>, with event: MEvent?) {
|
||||
self.mTouchesBegan(touches, with: event)
|
||||
}
|
||||
|
@ -149,6 +149,10 @@ import Foundation
|
||||
|
||||
var contentMode: MViewContentMode = .scaleToFill
|
||||
|
||||
func removeGestureRecognizers() {
|
||||
self.gestureRecognizers.removeAll()
|
||||
}
|
||||
|
||||
func didMoveToSuperview() {
|
||||
super.viewDidMoveToSuperview()
|
||||
}
|
||||
|
@ -139,6 +139,7 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
rotationRecognizer.cancelsTouchesInView = false
|
||||
pinchRecognizer.cancelsTouchesInView = false
|
||||
|
||||
self.removeGestureRecognizers()
|
||||
self.addGestureRecognizer(tapRecognizer)
|
||||
self.addGestureRecognizer(panRecognizer)
|
||||
self.addGestureRecognizer(rotationRecognizer)
|
||||
@ -289,7 +290,6 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
}
|
||||
|
||||
open override func mTouchesMoved(_ touches: Set<MTouch>, with event: MEvent?) {
|
||||
|
||||
if !self.node.shouldCheckForMoved() {
|
||||
return
|
||||
}
|
||||
@ -327,7 +327,6 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
}
|
||||
|
||||
private func touchesEnded(touches: Set<MTouch>, event: MEvent?) {
|
||||
|
||||
guard let _ = renderer else {
|
||||
return
|
||||
}
|
||||
@ -359,11 +358,9 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
// MARK: - Tap
|
||||
|
||||
func handleTap(recognizer: MTapGestureRecognizer) {
|
||||
#if os(iOS)
|
||||
if !self.node.shouldCheckForTap() {
|
||||
return
|
||||
}
|
||||
#endif
|
||||
|
||||
guard let renderer = renderer else {
|
||||
return
|
||||
@ -410,7 +407,6 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
if recognizer.state == .began {
|
||||
let location = recognizer.location(in: self)
|
||||
|
||||
|
||||
localContext { ctx in
|
||||
guard let foundNode = renderer.findNodeAt(location: location, ctx: ctx) else {
|
||||
return
|
||||
@ -560,5 +556,4 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
public func gestureRecognizer(_ gestureRecognizer: MGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: MGestureRecognizer) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user