예제 #1
0
        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;
            }
        }
예제 #2
0
 public ElementStyle Font(float size, Col color)
 {
     Set(Styles.FontColor, color);
     Set(Styles.FontSize, size);
     return(this);
 }
예제 #3
0
 public ElementStyle FontColor(Col color)
 {
     Set(Styles.FontColor, color);
     return(this);
 }
예제 #4
0
 public ElementStyle Border(Col color, Dim dim)
 {
     Set(Styles.Border, dim);
     Set(Styles.BorderColor, color);
     return(this);
 }
예제 #5
0
 public ElementStyle Border(Col color, float dim = 1)
 {
     Set(Styles.Border, new Dim(dim));
     Set(Styles.BorderColor, color);
     return(this);
 }
예제 #6
0
 public ElementStyle Background(Col color)
 {
     Set(Styles.BackgroundColor, color);
     return(this);
 }
예제 #7
0
 public static Color FromCol(Col col)
 {
     return(new Color(col.r, col.g, col.b, col.a));
 }
예제 #8
0
 public static void RGBToHSV(Col color, out float h, out float s, out float v)
 {
     Color.RGBToHSV(color, out h, out s, out v);
 }