void initialize(SceneUIElement parent, IContainerBoundsProvider boundsProvider, IChildren <SceneUIElement> children) { this.StandardDepth = 0.0f; this.parentElement = parent; this.childSet = children; Solver = new PinnedBoxes2DLayoutSolver( new BoxContainer(boundsProvider)); items = new List <LayoutItem>(); }
public PinnedBoxesLayout(Cockpit parent, PinnedBoxesLayoutSolver solver) { this.StandardDepth = 1.0f; this.Cockpit = parent; Solver = solver; items = new List <LayoutItem>(); }
/// <summary> /// constructs func that returns box point in 2D layout space of the passed solver /// (eg if laying out on a 3D plane, for example) /// </summary> public static Func <Vector2f> InLayoutSpaceBoxPointF(IBoxModelElement element, BoxPosition pos, PinnedBoxesLayoutSolver solver, Vector2f vDelta) { Func <Vector2f> f = () => { Vector2f solverPos = solver.GetLayoutCenter(element as SceneUIElement); Vector2f size = element.Size2D; AxisAlignedBox2f box = new AxisAlignedBox2f(solverPos, size.x * 0.5f, size.y * 0.5f); return(BoxModel.GetBoxPosition(ref box, pos) + vDelta); }; return(f); }