return hsl_to_rgb(v_x * 6 * eX + eY + v_y / 0.875 * eZ);
}
+vector color_hslimage(vector v, vector margin)
+{
+ vector pos;
+ v = rgb_to_hsl(v);
+ if (v_y)
+ {
+ pos_x = v_x / 6;
+ pos_y = v_z * 0.875;
+ }
+ else // grey scale
+ {
+ pos_x = v_z;
+ pos_y = 0.875 + 0.07;
+ }
+ pos_x = margin_x + pos_x * (1 - 2 * margin_x);
+ pos_y = margin_y + pos_y * (1 - 2 * margin_y);
+ return pos;
+}
+
float XonoticColorpicker_mouseDrag(entity me, vector coords)
{
float i;
{
me.cvarName = theCvar;
me.configureImage(me, me.image);
- me.prevcoords = '1 1 0';
+ me.prevcoords = color_hslimage(stov(cvar_string(theCvar)), me.imagemargin);
}
float XonoticColorpickerString_mousePress(entity me, vector coords)
sz = draw_PictureSize(strcat(me.src, "_selected"));
sz = globalToBoxSize(sz, draw_scale);
- if(me.disabled)
- me.prevcoords = '1 1 0';
- else
+ if(!me.disabled)
draw_Picture(me.imgOrigin + me.prevcoords - 0.5 * sz, strcat(me.src, "_selected"), sz, '1 1 1', 1);
draw_alpha = save;
}