private void GetZMost(ref int zMost) { if (OwnerRegion == null) { return; } IRegions regions = OwnerRegion.GetChildRegions(_viewGuid); foreach (IRegion region in regions) { IRegionStyle regionStyle = region.GetRegionStyle(_viewGuid); // If region is hamburger menu, use the button location and size to caculate. if (region is IHamburgerMenu) { IHamburgerMenu menu = region as IHamburgerMenu; regionStyle = menu.MenuButton.GetRegionStyle(_viewGuid); } if (regionStyle != null) { zMost = Math.Max(regionStyle.Z, zMost); } } }
private void GetBottomMost(ref double bottomMost) { if (OwnerRegion == null) { return; } IRegions regions = OwnerRegion.GetChildRegions(_viewGuid); foreach (IRegion region in regions) { IRegionStyle regionStyle = region.GetRegionStyle(_viewGuid); // If region is hamburger menu, use the button location and size to caculate. if (region is IHamburgerMenu) { IHamburgerMenu menu = region as IHamburgerMenu; regionStyle = menu.MenuButton.GetRegionStyle(_viewGuid); } if (regionStyle != null) { if (regionStyle.Rotate == 0) { bottomMost = Math.Max(regionStyle.Y + regionStyle.Height, bottomMost); } else { double x = regionStyle.X; double y = regionStyle.Y; double xc = (regionStyle.X * 2 + regionStyle.Width) / 2; double yc = (regionStyle.Y * 2 + regionStyle.Height) / 2; double angle = Math.Abs(regionStyle.Rotate) % 180; if (angle > 90) { angle = 180 - angle; } double Kc = Math.Cos(angle * Math.PI / 180); double Ks = Math.Sin(angle * Math.PI / 180); double yr = yc - (Ks * (xc - x) + Kc * (yc - y)); double height = regionStyle.Height + (y - yr) * 2; bottomMost = Math.Max(yr + height, bottomMost); } } } }