private static void layoutBaseline(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, int sizeType, int spanCount) { AboveBelow aboveBelow = getBaselineAboveBelow(compWraps, sizeType, true); int blRowSize = aboveBelow.sum(); CC cc = compWraps.get(0).cc; // Align for the whole baseline component array UnitValue align = cc.getVertical().getAlign(); if (spanCount == 1 && align == null) align = dc.getAlignOrDefault(false); if (align == UnitValue.BASELINE_IDENTITY) align = UnitValue.CENTER; int offset = start + aboveBelow.maxAbove + (align != null ? Math.max(0, align.getPixels(size - blRowSize, parent, null)) : 0); for (CompWrap cw : compWraps) { cw.y += offset; if (cw.y + cw.h > start + size) cw.h = start + size - cw.y; } }
for (int cwIx = 0; cwIx < cell.compWraps.size(); cwIx++) { CompWrap cw = cell.compWraps.get(cwIx); boolean rowBaselineAlign = (isRows && lc.isTopToBottom() && dc.getAlignOrDefault(!isRows) == UnitValue.BASELINE_IDENTITY); // Disable baseline for bottomToTop since I can not verify it working. boolean isBaseline = isRows && cw.isBaselineAlign(rowBaselineAlign);
private static void layoutParallel(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, boolean fromEnd) { int[][] sizes = new int[compWraps.size()][]; // [compIx][gapBef,compSize,gapAft] for (int i = 0; i < sizes.length; i++) { CompWrap cw = compWraps.get(i); DimConstraint cDc = cw.cc.getDimConstraint(isHor); ResizeConstraint[] resConstr = new ResizeConstraint[] { cw.isPushGap(isHor, true) ? GAP_RC_CONST_PUSH : GAP_RC_CONST, cDc.resize, cw.isPushGap(isHor, false) ? GAP_RC_CONST_PUSH : GAP_RC_CONST, }; int[][] sz = new int[][] { cw.getGaps(isHor, true), cw.getSizes(isHor), cw.getGaps(isHor, false) }; Float[] pushW = dc.isFill() ? GROW_100 : null; sizes[i] = LayoutUtil.calculateSerial(sz, resConstr, pushW, LayoutUtil.PREF, size); } UnitValue rowAlign = dc.getAlignOrDefault(isHor); setCompWrapBounds(parent, sizes, compWraps, rowAlign, start, size, isHor, fromEnd); }
private static void layoutSerial(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, int spanCount, boolean fromEnd) { FlowSizeSpec fss = mergeSizesGapsAndResConstrs( getComponentResizeConstraints(compWraps, isHor), getComponentGapPush(compWraps, isHor), getComponentSizes(compWraps, isHor), getGaps(compWraps, isHor)); Float[] pushW = dc.isFill() ? GROW_100 : null; int[] sizes = LayoutUtil.calculateSerial(fss.sizes, fss.resConstsInclGaps, pushW, LayoutUtil.PREF, size); setCompWrapBounds(parent, sizes, compWraps, dc.getAlignOrDefault(isHor), start, size, isHor, fromEnd); }