2017-01-05 07:09:19 -08:00
|
|
|
/**
|
2016-09-22 16:22:34 -07:00
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
namespace Facebook.Yoga
|
2016-09-22 16:22:34 -07:00
|
|
|
{
|
2017-03-06 11:29:52 -08:00
|
|
|
#if WINDOWS_UWP_ARM
|
|
|
|
using YogaValueType = IntPtr;
|
|
|
|
#else
|
|
|
|
using YogaValueType = YogaValue;
|
|
|
|
#endif
|
|
|
|
|
2016-09-22 16:22:34 -07:00
|
|
|
internal static class Native
|
|
|
|
{
|
2016-12-16 00:06:49 -08:00
|
|
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
2016-10-06 06:04:54 -07:00
|
|
|
private const string DllName = "__Internal";
|
|
|
|
#else
|
2016-12-02 11:18:16 -08:00
|
|
|
private const string DllName = "yoga";
|
2016-10-06 06:04:54 -07:00
|
|
|
#endif
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2016-12-23 08:29:31 -08:00
|
|
|
internal class YGNodeHandle : SafeHandle
|
|
|
|
{
|
2017-02-16 11:07:51 -08:00
|
|
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
|
|
|
private GCHandle _managed;
|
|
|
|
#endif
|
|
|
|
|
2016-12-23 08:29:31 -08:00
|
|
|
private YGNodeHandle() : base(IntPtr.Zero, true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool IsInvalid
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return this.handle == IntPtr.Zero;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool ReleaseHandle()
|
|
|
|
{
|
2017-02-16 11:07:51 -08:00
|
|
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
|
|
|
if (_managed.IsAllocated)
|
|
|
|
{
|
|
|
|
_managed.Free();
|
|
|
|
}
|
|
|
|
#endif
|
2016-12-23 08:29:31 -08:00
|
|
|
Native.YGNodeFree(this.handle);
|
|
|
|
GC.KeepAlive(this);
|
|
|
|
return true;
|
|
|
|
}
|
2017-02-16 11:07:51 -08:00
|
|
|
|
|
|
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
|
|
|
public void SetContext(YogaNode node)
|
|
|
|
{
|
|
|
|
if (!_managed.IsAllocated)
|
|
|
|
{
|
|
|
|
_managed = GCHandle.Alloc(node, GCHandleType.Weak);
|
|
|
|
Native.YGNodeSetContext(this.handle, GCHandle.ToIntPtr(_managed));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static YogaNode GetManaged(IntPtr ygNodePtr)
|
|
|
|
{
|
|
|
|
var node =
|
|
|
|
GCHandle.FromIntPtr(Native.YGNodeGetContext(ygNodePtr)).Target as YogaNode;
|
|
|
|
if (node == null)
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException("YogaNode is already deallocated");
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
#endif
|
2016-12-23 08:29:31 -08:00
|
|
|
}
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
internal class YGConfigHandle : SafeHandle
|
|
|
|
{
|
|
|
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
|
|
|
private GCHandle _managed;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
private YGConfigHandle() : base(IntPtr.Zero, true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool IsInvalid
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return this.handle == IntPtr.Zero;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool ReleaseHandle()
|
|
|
|
{
|
|
|
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
|
|
|
if (_managed.IsAllocated)
|
|
|
|
{
|
|
|
|
_managed.Free();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
Native.YGConfigFree(this.handle);
|
|
|
|
GC.KeepAlive(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-02 11:18:16 -08:00
|
|
|
public static extern void YGInteropSetLogger(
|
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger.Func func);
|
2016-10-19 11:01:24 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YGNodeHandle YGNodeNew();
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern YGNodeHandle YGNodeNewWithConfig(YGConfigHandle config);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-07 05:12:11 -08:00
|
|
|
public static extern void YGNodeFree(IntPtr node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeReset(YGNodeHandle node);
|
2016-10-24 10:35:41 -07:00
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern YGConfigHandle YGConfigNew();
|
|
|
|
|
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void YGConfigFree(IntPtr node);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-03 04:40:18 -08:00
|
|
|
public static extern int YGNodeGetInstanceCount();
|
2016-11-15 17:36:23 -08:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-01 09:19:55 -08:00
|
|
|
public static extern void YGConfigSetExperimentalFeatureEnabled(
|
|
|
|
YGConfigHandle config,
|
2016-12-02 05:47:43 -08:00
|
|
|
YogaExperimentalFeature feature,
|
2016-11-14 03:27:33 -08:00
|
|
|
bool enabled);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-01 09:19:55 -08:00
|
|
|
public static extern bool YGConfigIsExperimentalFeatureEnabled(
|
|
|
|
YGConfigHandle config,
|
2016-12-02 05:47:43 -08:00
|
|
|
YogaExperimentalFeature feature);
|
2016-10-07 11:07:50 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-02-16 11:07:51 -08:00
|
|
|
public static extern void YGNodeInsertChild(
|
|
|
|
YGNodeHandle node,
|
|
|
|
YGNodeHandle child,
|
|
|
|
uint index);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeRemoveChild(YGNodeHandle node, YGNodeHandle child);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-02-16 11:07:51 -08:00
|
|
|
public static extern void YGNodeCalculateLayout(
|
|
|
|
YGNodeHandle node,
|
|
|
|
float availableWidth,
|
|
|
|
float availableHeight,
|
|
|
|
YogaDirection parentDirection);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeMarkDirty(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-10-05 02:33:57 -07:00
|
|
|
[return: MarshalAs(UnmanagedType.I1)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern bool YGNodeIsDirty(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeCopyStyle(YGNodeHandle dstNode, YGNodeHandle srcNode);
|
2016-11-17 09:10:47 -08:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#region YG_NODE_PROPERTY
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-03 04:40:18 -08:00
|
|
|
public static extern void YGNodeSetMeasureFunc(
|
2016-12-23 08:29:31 -08:00
|
|
|
YGNodeHandle node,
|
2016-12-02 11:18:16 -08:00
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] YogaMeasureFunc measureFunc);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-01-07 09:06:06 -08:00
|
|
|
public static extern void YGNodeSetBaselineFunc(
|
|
|
|
YGNodeHandle node,
|
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] YogaBaselineFunc baselineFunc);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-02-16 11:07:51 -08:00
|
|
|
public static extern void YGNodeSetHasNewLayout(
|
|
|
|
YGNodeHandle node,
|
|
|
|
[MarshalAs(UnmanagedType.I1)] bool hasNewLayout);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-10-05 02:33:57 -07:00
|
|
|
[return: MarshalAs(UnmanagedType.I1)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern bool YGNodeGetHasNewLayout(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#endregion
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#region YG_NODE_STYLE_PROPERTY
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetDirection(YGNodeHandle node, YogaDirection direction);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaDirection YGNodeStyleGetDirection(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetFlexDirection(YGNodeHandle node, YogaFlexDirection flexDirection);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaFlexDirection YGNodeStyleGetFlexDirection(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetJustifyContent(YGNodeHandle node, YogaJustify justifyContent);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaJustify YGNodeStyleGetJustifyContent(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetAlignContent(YGNodeHandle node, YogaAlign alignContent);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaAlign YGNodeStyleGetAlignContent(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetAlignItems(YGNodeHandle node, YogaAlign alignItems);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaAlign YGNodeStyleGetAlignItems(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetAlignSelf(YGNodeHandle node, YogaAlign alignSelf);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaAlign YGNodeStyleGetAlignSelf(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetPositionType(YGNodeHandle node, YogaPositionType positionType);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaPositionType YGNodeStyleGetPositionType(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetFlexWrap(YGNodeHandle node, YogaWrap flexWrap);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaWrap YGNodeStyleGetFlexWrap(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetOverflow(YGNodeHandle node, YogaOverflow flexWrap);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaOverflow YGNodeStyleGetOverflow(YGNodeHandle node);
|
2017-02-06 09:31:22 -08:00
|
|
|
|
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void YGNodeStyleSetDisplay(YGNodeHandle node, YogaDisplay display);
|
|
|
|
|
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern YogaDisplay YGNodeStyleGetDisplay(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetFlex(YGNodeHandle node, float flex);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetFlexGrow(YGNodeHandle node, float flexGrow);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeStyleGetFlexGrow(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetFlexShrink(YGNodeHandle node, float flexShrink);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeStyleGetFlexShrink(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetFlexBasis(YGNodeHandle node, float flexBasis);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetFlexBasisPercent(YGNodeHandle node, float flexBasis);
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void YGNodeStyleSetFlexBasisAuto(YGNodeHandle node);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetFlexBasis(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetWidth(YGNodeHandle node, float width);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetWidthPercent(YGNodeHandle node, float width);
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void YGNodeStyleSetWidthAuto(YGNodeHandle node);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetWidth(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetHeight(YGNodeHandle node, float height);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetHeightPercent(YGNodeHandle node, float height);
|
2017-03-01 09:19:55 -08:00
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void YGNodeStyleSetHeightAuto(YGNodeHandle node);
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetHeight(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetMinWidth(YGNodeHandle node, float minWidth);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetMinWidthPercent(YGNodeHandle node, float minWidth);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetMinWidth(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetMinHeight(YGNodeHandle node, float minHeight);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetMinHeightPercent(YGNodeHandle node, float minHeight);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetMinHeight(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetMaxWidth(YGNodeHandle node, float maxWidth);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetMaxWidthPercent(YGNodeHandle node, float maxWidth);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetMaxWidth(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetMaxHeight(YGNodeHandle node, float maxHeight);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetMaxHeightPercent(YGNodeHandle node, float maxHeight);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetMaxHeight(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetAspectRatio(YGNodeHandle node, float aspectRatio);
|
2016-11-21 10:12:26 -08:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeStyleGetAspectRatio(YGNodeHandle node);
|
2016-11-21 10:12:26 -08:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#endregion
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#region YG_NODE_STYLE_EDGE_PROPERTY
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetPosition(YGNodeHandle node, YogaEdge edge, float position);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetPositionPercent(YGNodeHandle node, YogaEdge edge, float position);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetPosition(YGNodeHandle node, YogaEdge edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetMargin(YGNodeHandle node, YogaEdge edge, float margin);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetMarginPercent(YGNodeHandle node, YogaEdge edge, float margin);
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void YGNodeStyleSetMarginAuto(YGNodeHandle node, YogaEdge edge);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetMargin(YGNodeHandle node, YogaEdge edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetPadding(YGNodeHandle node, YogaEdge edge, float padding);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
public static extern void YGNodeStyleSetPaddingPercent(YGNodeHandle node, YogaEdge edge, float padding);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2017-03-06 11:29:52 -08:00
|
|
|
public static extern YogaValueType YGNodeStyleGetPadding(YGNodeHandle node, YogaEdge edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern void YGNodeStyleSetBorder(YGNodeHandle node, YogaEdge edge, float border);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeStyleGetBorder(YGNodeHandle node, YogaEdge edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#endregion
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#region YG_NODE_LAYOUT_PROPERTY
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeLayoutGetLeft(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeLayoutGetTop(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeLayoutGetRight(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeLayoutGetBottom(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeLayoutGetWidth(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern float YGNodeLayoutGetHeight(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-01-15 15:16:10 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern float YGNodeLayoutGetMargin(YGNodeHandle node, YogaEdge edge);
|
|
|
|
|
2017-01-05 12:48:11 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern float YGNodeLayoutGetPadding(YGNodeHandle node, YogaEdge edge);
|
|
|
|
|
2017-01-05 07:09:19 -08:00
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
2016-12-23 08:29:31 -08:00
|
|
|
public static extern YogaDirection YGNodeLayoutGetDirection(YGNodeHandle node);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#endregion
|
2017-02-16 11:07:51 -08:00
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#region IOS
|
2017-02-16 11:07:51 -08:00
|
|
|
|
|
|
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr YGNodeGetContext(IntPtr node);
|
|
|
|
|
|
|
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void YGNodeSetContext(IntPtr node, IntPtr managed);
|
|
|
|
#endif
|
|
|
|
|
2017-03-06 11:29:52 -08:00
|
|
|
#endregion
|
2016-09-22 16:22:34 -07:00
|
|
|
}
|
2017-01-05 12:48:11 -08:00
|
|
|
}
|