-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from brezza92/b_dev_flexbox
B dev flexbox
- Loading branch information
Showing
39 changed files
with
6,266 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace System.Runtime.CompilerServices | ||
{ | ||
public class ExtensionAttribute : Attribute { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{9060957D-FF0B-4B14-BB87-EE24B5170365}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Marius.Yoga</RootNamespace> | ||
<AssemblyName>Marius.Yoga</AssemblyName> | ||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Extension.cs" /> | ||
<Compile Include="YogaArray.cs" /> | ||
<Compile Include="YogaCachedMeasurement.cs" /> | ||
<Compile Include="YogaCollectFlexItemsRowValues.cs" /> | ||
<Compile Include="YogaConfig.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="YogaDelegates.cs" /> | ||
<Compile Include="YogaLayout.cs" /> | ||
<Compile Include="YogaMath.cs" /> | ||
<Compile Include="YogaNode.Layout.cs" /> | ||
<Compile Include="YogaNode.cs" /> | ||
<Compile Include="YogaNode.Public.cs" /> | ||
<Compile Include="YogaNode.Spacing.cs" /> | ||
<Compile Include="YogaSize.cs" /> | ||
<Compile Include="YogaStyle.cs" /> | ||
<Compile Include="YogaValue.cs" /> | ||
<Compile Include="YogaAlign.cs" /> | ||
<Compile Include="YogaDimension.cs" /> | ||
<Compile Include="YogaDirection.cs" /> | ||
<Compile Include="YogaDisplay.cs" /> | ||
<Compile Include="YogaEdge.cs" /> | ||
<Compile Include="YogaExperimentalFeature.cs" /> | ||
<Compile Include="YogaFlexDirection.cs" /> | ||
<Compile Include="YogaJustify.cs" /> | ||
<Compile Include="YogaMeasureMode.cs" /> | ||
<Compile Include="YogaNodeType.cs" /> | ||
<Compile Include="YogaOverflow.cs" /> | ||
<Compile Include="YogaPositionType.cs" /> | ||
<Compile Include="YogaPrintOptions.cs" /> | ||
<Compile Include="YogaUnit.cs" /> | ||
<Compile Include="YogaExtensions.cs" /> | ||
<Compile Include="YogaWrap.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Marius.Layout")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Marius.Layout")] | ||
[assembly: AssemblyCopyright("Copyright © 2018")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("9060957d-ff0b-4b14-bb87-ee24b5170365")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* Copyright (c) 2018-present, Marius Klimantavičius | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
namespace Marius.Yoga | ||
{ | ||
public enum YogaAlign | ||
{ | ||
Auto, | ||
FlexStart, | ||
Center, | ||
FlexEnd, | ||
Stretch, | ||
Baseline, | ||
SpaceBetween, | ||
SpaceAround, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* Copyright (c) 2018-present, Marius Klimantavičius | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
using System; | ||
|
||
namespace Marius.Yoga | ||
{ | ||
public static class YogaArray | ||
{ | ||
public static YogaArray<T> From<T>(T[] other) | ||
{ | ||
var result = new T[other.Length]; | ||
for (var i = 0; i < result.Length; i++) | ||
result[i] = other[i]; | ||
return new YogaArray<T>(result); | ||
} | ||
|
||
public static YogaArray<T> From<T>(YogaArray<T> other) | ||
{ | ||
var result = new T[other.Length]; | ||
for (var i = 0; i < result.Length; i++) | ||
result[i] = other[i]; | ||
return new YogaArray<T>(result); | ||
} | ||
|
||
public static bool Equal(YogaArray<float> val1, YogaArray<float> val2) | ||
{ | ||
var areEqual = true; | ||
for (var i = 0; i < val1.Length && areEqual; ++i) | ||
areEqual = FloatsEqual(val1[i], val2[i]); | ||
|
||
return areEqual; | ||
} | ||
|
||
public static bool Equal(YogaArray<float?> val1, YogaArray<float?> val2) | ||
{ | ||
var areEqual = true; | ||
for (var i = 0; i < val1.Length && areEqual; ++i) | ||
areEqual = FloatsEqual(val1[i], val2[i]); | ||
|
||
return areEqual; | ||
} | ||
|
||
public static bool Equal(YogaArray<YogaValue> val1, YogaArray<YogaValue> val2) | ||
{ | ||
var areEqual = true; | ||
for (var i = 0; i < val1.Length && areEqual; ++i) | ||
areEqual = val1[i].Equals(val2[i]); | ||
|
||
return areEqual; | ||
} | ||
|
||
private static bool FloatsEqual(float? a, float? b) | ||
{ | ||
if (a != null && b != null) | ||
return Math.Abs(a.Value - b.Value) < 0.0001f; | ||
|
||
return a == null && b == null; | ||
} | ||
} | ||
|
||
public class YogaArray<T> | ||
{ | ||
private readonly T[] _array; | ||
|
||
public T this[int index] | ||
{ | ||
get { return _array[index]; } | ||
set { _array[index] = value; } | ||
} | ||
|
||
public T this[YogaEdge index] | ||
{ | ||
get { return _array[(int)index]; } | ||
set { _array[(int)index] = value; } | ||
} | ||
|
||
public T this[YogaFlexDirection index] | ||
{ | ||
get { return _array[(int)index]; } | ||
set { _array[(int)index] = value; } | ||
} | ||
|
||
public T this[YogaDimension index] | ||
{ | ||
get { return _array[(int)index]; } | ||
set { _array[(int)index] = value; } | ||
} | ||
|
||
public int Length | ||
{ | ||
get { return _array.Length; } | ||
} | ||
|
||
public YogaArray(int length) | ||
{ | ||
_array = new T[length]; | ||
} | ||
|
||
public YogaArray(params T[] values) | ||
{ | ||
_array = values; | ||
} | ||
|
||
public void CopyFrom(YogaArray<T> from) | ||
{ | ||
from._array.CopyTo(_array, 0); | ||
} | ||
|
||
public void Clear() | ||
{ | ||
for (var i = 0; i < _array.Length; i++) | ||
_array[i] = default(T); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
if (_array == null) | ||
return 0; | ||
|
||
var hashCode = 0; | ||
for (var i = 0; i < _array.Length; i++) | ||
hashCode = (hashCode << 5) ^ _array[i].GetHashCode(); | ||
|
||
return hashCode; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* Copyright (c) 2018-present, Marius Klimantavičius | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
using System; | ||
|
||
namespace Marius.Yoga | ||
{ | ||
public sealed class YogaCachedMeasurement | ||
{ | ||
public float? AvailableWidth; | ||
public float? AvailableHeight; | ||
public YogaMeasureMode WidthMeasureMode; | ||
public YogaMeasureMode HeightMeasureMode; | ||
|
||
public float? ComputedWidth; | ||
public float? ComputedHeight; | ||
|
||
public YogaCachedMeasurement() | ||
{ | ||
AvailableWidth = 0; | ||
AvailableHeight = 0; | ||
WidthMeasureMode = (YogaMeasureMode)(-1); | ||
HeightMeasureMode = (YogaMeasureMode)(-1); | ||
ComputedWidth = -1; | ||
ComputedHeight = -1; | ||
} | ||
|
||
public static bool operator ==(YogaCachedMeasurement self, YogaCachedMeasurement measurement) | ||
{ | ||
if (object.ReferenceEquals(self, measurement)) | ||
return true; | ||
|
||
if (object.ReferenceEquals(self, null) || object.ReferenceEquals(measurement, null)) | ||
return false; | ||
|
||
var isEqual = self.WidthMeasureMode == measurement.WidthMeasureMode && self.HeightMeasureMode == measurement.HeightMeasureMode; | ||
|
||
isEqual = isEqual && self.AvailableWidth == measurement.AvailableWidth; | ||
isEqual = isEqual && self.AvailableHeight == measurement.AvailableHeight; | ||
isEqual = isEqual && self.ComputedWidth == measurement.ComputedWidth; | ||
isEqual = isEqual && self.ComputedHeight == measurement.ComputedHeight; | ||
|
||
return isEqual; | ||
} | ||
|
||
public static bool operator !=(YogaCachedMeasurement self, YogaCachedMeasurement measurement) | ||
{ | ||
return !(self == measurement); | ||
} | ||
|
||
public void CopyFrom(YogaCachedMeasurement other) | ||
{ | ||
AvailableWidth = other.AvailableWidth; | ||
AvailableHeight = other.AvailableHeight; | ||
WidthMeasureMode = other.WidthMeasureMode; | ||
HeightMeasureMode = other.HeightMeasureMode; | ||
ComputedWidth = other.ComputedWidth; | ||
ComputedHeight = other.ComputedHeight; | ||
} | ||
|
||
public void Clear() | ||
{ | ||
AvailableWidth = 0; | ||
AvailableHeight = 0; | ||
WidthMeasureMode = (YogaMeasureMode)(-1); | ||
HeightMeasureMode = (YogaMeasureMode)(-1); | ||
ComputedWidth = -1; | ||
ComputedHeight = -1; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
var other = obj as YogaCachedMeasurement; | ||
return other == this; | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return AvailableWidth.GetHashCode() + | ||
AvailableHeight.GetHashCode() + | ||
WidthMeasureMode.GetHashCode() + | ||
HeightMeasureMode.GetHashCode() + | ||
ComputedWidth.GetHashCode() + | ||
ComputedHeight.GetHashCode(); | ||
|
||
} | ||
}; | ||
} |
Oops, something went wrong.