浏览代码

Merge branch 'shiyun/skia' of https://github.com/Unity-Technologies/com.unity.uiwidgets into shiyun/skia

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
49b9850d
共有 2 个文件被更改,包括 46 次插入43 次删除
  1. 45
      com.unity.uiwidgets/Runtime/rendering/list_body.cs
  2. 44
      com.unity.uiwidgets/Runtime/rendering/list_wheel_viewport.cs

45
com.unity.uiwidgets/Runtime/rendering/list_body.cs


}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
D.assert(() => {
switch (mainAxis) {
case Axis.horizontal:

break;
}
throw new UIWidgetsError(
"RenderListBody must have unlimited space along its main axis.\n" +
"RenderListBody does not clip or resize its children, so it must be " +
"placed in a parent that does not constrain the main " +
"axis. You probably want to put the RenderListBody inside a " +
"RenderViewport with a matching main axis.");
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("RenderListBody must have unlimited space along its main axis."),
new ErrorDescription(
"RenderListBody does not clip or resize its children, so it must be " +
"placed in a parent that does not constrain the main axis."
),
new ErrorHint(
"You probably want to put the RenderListBody inside a " +
"RenderViewport with a matching main axis."
)
});
});
D.assert(() => {

break;
}
throw new UIWidgetsError(
"RenderListBody must have a bounded constraint for its cross axis.\n" +
"RenderListBody forces its children to expand to fit the RenderListBody\"s container, " +
"so it must be placed in a parent that constrains the cross " +
"axis to a finite dimension. If you are attempting to nest a RenderListBody with " +
"one direction inside one of another direction, you will want to " +
"wrap the inner one inside a box that fixes the dimension in that direction, " +
"for example, a RenderIntrinsicWidth or RenderIntrinsicHeight object. " +
"This is relatively expensive, however."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("RenderListBody must have a bounded constraint for its cross axis."),
new ErrorDescription(
"RenderListBody forces its children to expand to fit the RenderListBody's container, " +
"so it must be placed in a parent that constrains the cross " +
"axis to a finite dimension."
),
// TODO(jacobr): this hint is a great candidate to promote to being an
// automated quick fix in the future.
new ErrorHint(
"If you are attempting to nest a RenderListBody with " +
"one direction inside one of another direction, you will want to " +
"wrap the inner one inside a box that fixes the dimension in that direction, " +
"for example, a RenderIntrinsicWidth or RenderIntrinsicHeight object. " +
"This is relatively expensive, however." // (that's why we don't do it automatically)
)
});
});
float mainAxisExtent = 0.0f;

44
com.unity.uiwidgets/Runtime/rendering/list_wheel_viewport.cs


minWidth: 0.0f
);
float visibleHeight = size.height;
float visibleHeight = size.height * _squeeze;
if (renderChildrenOutsideViewport) {
visibleHeight *= 2;
}

float fractionalY = (untransformedPaintingCoordinates.dy + _itemExtent / 2.0f) / size.height;
float angle = -(fractionalY - 0.5f) * 2.0f * _maxVisibleRadian;
float angle = -(fractionalY - 0.5f) * 2.0f * _maxVisibleRadian / squeeze;
if (angle > Mathf.PI / 2.0f || angle < -Mathf.PI / 2.0f) {
return;
}

Offset offsetToCenter =
new Offset(untransformedPaintingCoordinates.dx, -deltaY - _topScrollMarginExtent);
if (!useMagnifier) {
bool shouldApplyOffCenterDim = overAndUnderCenterOpacity < 1;
if (useMagnifier || shouldApplyOffCenterDim) {
_paintChildWithMagnifier(context, offset, child, transform, offsetToCenter, untransformedPaintingCoordinates);
} else {
else {
_paintChildWithMagnifier(
context,
offset,
child,
transform,
offsetToCenter,
untransformedPaintingCoordinates
);
}
}
void _paintChildWithMagnifier(

magnifierTopLinePosition);
context.pushClipRect(
false,
needsCompositing,
false,
needsCompositing,
context2.paintChild(
child,
offset2 + untransformedPaintingCoordinates);
context2.paintChild(child, offset2 + untransformedPaintingCoordinates);
false,
needsCompositing,
offset,
untransformedPaintingCoordinates.dy <= magnifierTopLinePosition
? topHalfRect

Matrix4 cylindricalTransform,
Offset offsetToCenter
) {
context.pushTransform(
false,
offset,
cylindricalTransform,
// this._centerOriginTransform(cylindricalTransform),
(PaintingContext _context, Offset _offset) => { _context.paintChild(child, _offset + offsetToCenter); }
);
PaintingContextCallback painter = (PaintingContext _context, Offset _offset) => {
_context.paintChild(
child,
_offset + offsetToCenter
);
};
}
public override Rect describeApproximatePaintClip(RenderObject child) {

ListWheelParentData parentData = (ListWheelParentData) child.parentData;
float targetOffset = parentData.offset.dy;
Matrix4 transform = target.getTransformTo(this);
Matrix4 transform = target.getTransformTo(child);
Rect bounds = MatrixUtils.transformRect(transform, rect);
Rect targetRect = bounds.translate(0.0f, (size.height - itemExtent) / 2);

正在加载...
取消
保存