/// <summary> /// Checks if the bounds is at least partially inside it's parent bounds by checking if any of the 4 corner points is inside /// </summary> /// <returns></returns> public bool PartiallyInside(ElementBounds boundingBounds) { return (boundingBounds.PointInside(absX, absY) || boundingBounds.PointInside(absX + OuterWidth, absY) || boundingBounds.PointInside(absX, absY + OuterHeight) || boundingBounds.PointInside(absX + OuterWidth, absY + OuterHeight) ); }
public override void OnMouseWheel(ICoreClientAPI api, MouseWheelEventArgs args) { if (expanded && visibleBounds.PointInside(api.Input.MouseX, api.Input.MouseY)) { scrollbar.OnMouseWheel(api, args); } }
public override void RenderInteractiveElements(float deltaTime) { api.Render.Render2DTexturePremultipliedAlpha(textureId, innerBounds); int mouseX = api.Input.MouseX; int mouseY = api.Input.MouseY; double diff; if (innerBounds.PointInside(mouseX, mouseY)) { foreach (ConfigItem item in items) { diff = mouseY - (item.posY + innerBounds.absY); if (item.Type != EnumItemType.Title && diff > 0 && diff < item.height) { api.Render.Render2DTexturePremultipliedAlpha(hoverTexture.TextureId, (int)innerBounds.absX, (int)innerBounds.absY + (int)item.posY, innerBounds.InnerWidth, item.height); } } } }
/// <summary> /// Whether or not the point on screen is inside the Element's area. /// </summary> /// <param name="posX">The X Position of the point.</param> /// <param name="posY">The Y Position of the point.</param> /// <returns></returns> public virtual bool IsPositionInside(int posX, int posY) { return((InsideClipBounds == null || InsideClipBounds.PointInside(posX, posY)) && Bounds.PointInside(posX, posY)); }