protected override void OnUpdate() { if (_isDragging) { var mousePos = Utils.MousePosition(); var pos = ContentPosition; var uv = (mousePos - pos) / new Vec2(ImageWidth, ImageHeight); uv.x = Utils.Clamp01(uv.x); uv.y = Utils.Clamp01(uv.y); _sampledColor = _tex.GetPixel((int)(uv.x * _tex.Width), (int)((1 - uv.y) * _tex.Height)); if (_setValueCallback != null) { _setValueCallback(_sampledColor); } Value = uv; } }
public ElementStyle Font(float size, Col color) { Set(Styles.FontColor, color); Set(Styles.FontSize, size); return(this); }
public ElementStyle FontColor(Col color) { Set(Styles.FontColor, color); return(this); }
public ElementStyle Border(Col color, Dim dim) { Set(Styles.Border, dim); Set(Styles.BorderColor, color); return(this); }
public ElementStyle Border(Col color, float dim = 1) { Set(Styles.Border, new Dim(dim)); Set(Styles.BorderColor, color); return(this); }
public ElementStyle Background(Col color) { Set(Styles.BackgroundColor, color); return(this); }
public static Color FromCol(Col col) { return(new Color(col.r, col.g, col.b, col.a)); }
public static void RGBToHSV(Col color, out float h, out float s, out float v) { Color.RGBToHSV(color, out h, out s, out v); }