public CalloutPositionedInfo(PartialRectangle rectangle, RectangleEdge targetEdge, RectangleEdge alignmentEdge, CalloutBeakPositionedInfo beakPosition) { ElementRectangle = rectangle; TargetEdge = targetEdge; AlignmentEdge = alignmentEdge; BeakPosition = beakPosition; }
public CalloutBeakPositionedInfo(PartialRectangle elementRectangle, RectangleEdge targetEdge, RectangleEdge closestEdge) { ElementRectangle = elementRectangle; TargetEdge = targetEdge; AlignmentEdge = RectangleEdge.None; ClosestEdge = closestEdge; }
private async Task <PartialRectangle> FinalizeElementPositionAsync(Rectangle elementRectangle, /* hostElement, */ RectangleEdge targetEdge, Rectangle bounds, RectangleEdge alignmentEdge) { var hostRectangle = await JSRuntime.InvokeAsync <Rectangle>("BlazorFabricBaseComponent.measureElementRect", RootElementReference); //Debug.WriteLine($"HostRect: {hostRectangle.left}, {hostRectangle.top}, {hostRectangle.right}, {hostRectangle.bottom}"); var elementEdge = CoverTarget ? targetEdge : (RectangleEdge)((int)targetEdge * -1); //elementEdgeString var returnEdge = FinalizeReturnEdge(elementRectangle, alignmentEdge != RectangleEdge.None ? alignmentEdge : GetFlankingEdges(targetEdge).positiveEdge, bounds); //HOW TO DO THE PARTIAL STUFF? Might need to set other sides to -1 var returnValue = new PartialRectangle(); switch (elementEdge) { case RectangleEdge.Bottom: returnValue.bottom = GetRelativeEdgeDifference(elementRectangle, hostRectangle, elementEdge); break; case RectangleEdge.Left: returnValue.left = GetRelativeEdgeDifference(elementRectangle, hostRectangle, elementEdge); break; case RectangleEdge.Right: returnValue.right = GetRelativeEdgeDifference(elementRectangle, hostRectangle, elementEdge); break; case RectangleEdge.Top: returnValue.top = GetRelativeEdgeDifference(elementRectangle, hostRectangle, elementEdge); break; } switch (returnEdge) { case RectangleEdge.Bottom: returnValue.bottom = GetRelativeEdgeDifference(elementRectangle, hostRectangle, returnEdge); break; case RectangleEdge.Left: returnValue.left = GetRelativeEdgeDifference(elementRectangle, hostRectangle, returnEdge); break; case RectangleEdge.Right: returnValue.right = GetRelativeEdgeDifference(elementRectangle, hostRectangle, returnEdge); break; case RectangleEdge.Top: returnValue.top = GetRelativeEdgeDifference(elementRectangle, hostRectangle, returnEdge); break; } return(returnValue); }
private CalloutBeakPositionedInfo FinalizeBeakPosition(ElementPosition elementPosition, Rectangle positionedBeak, Rectangle bounds) { var targetEdge = (RectangleEdge)((int)elementPosition.TargetEdge * -1); var actualElement = new Rectangle(0, elementPosition.ElementRectangle.width, 0, elementPosition.ElementRectangle.height); PartialRectangle returnValue = new PartialRectangle(); var returnEdge = FinalizeReturnEdge( elementPosition.ElementRectangle, elementPosition.AlignmentEdge != RectangleEdge.None ? elementPosition.AlignmentEdge : GetFlankingEdges(targetEdge).positiveEdge, bounds); switch (targetEdge) { case RectangleEdge.Bottom: returnValue.bottom = GetEdgeValue(positionedBeak, targetEdge); break; case RectangleEdge.Left: returnValue.left = GetEdgeValue(positionedBeak, targetEdge); break; case RectangleEdge.Right: returnValue.right = GetEdgeValue(positionedBeak, targetEdge); break; case RectangleEdge.Top: returnValue.top = GetEdgeValue(positionedBeak, targetEdge); break; } switch (returnEdge) { case RectangleEdge.Bottom: returnValue.bottom = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); break; case RectangleEdge.Left: returnValue.left = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); break; case RectangleEdge.Right: returnValue.right = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); break; case RectangleEdge.Top: returnValue.top = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); break; } return(new CalloutBeakPositionedInfo( returnValue, GetClosestEdge(elementPosition.TargetEdge, positionedBeak, actualElement), targetEdge)); }
public CalloutPositionedInfo() { BeakPosition = new CalloutBeakPositionedInfo(); ElementRectangle = new PartialRectangle(); }