[Palette Editor] Fix adding color not select the added color.

This commit is contained in:
Tanasart 2025-03-02 08:26:16 +07:00
parent 19defce2c5
commit 36bd03c00d
4 changed files with 6 additions and 13 deletions

View file

@ -62,15 +62,8 @@ function __PaletteColor(_color = c_black) constructor {
var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8));
dia.onModify = function(txt) /*=>*/ {
var file = file_text_open_write(txt + ".hex");
for(var i = 0; i < array_length(palette); i++) {
var cc = palette[i];
var r = number_to_hex(color_get_red(cc));
var g = number_to_hex(color_get_green(cc));
var b = number_to_hex(color_get_blue(cc));
var a = number_to_hex(color_get_alpha(cc));
file_text_write_string(file, $"{r}{g}{b}{a}\n");
}
for(var i = 0; i < array_length(palette); i++)
file_text_write_string(file, $"{color_get_hex(palette[i])}\n");
file_text_close(file);
__initPalette();
};

View file

@ -368,8 +368,8 @@ draggable = true;
bx -= ui(32);
if(buttonInstant(THEME.button_hide_fill, bx, by, ui(28), ui(28), mouse_ui, sHOVER, _foc, "", THEME.add_16) == 2) {
palette[array_length(palette)] = cola(c_black);
index_selecting = [ array_length(palette), 1 ];
palette[array_length(palette)] = cola(c_black);
refreshPaletteObject();
onApply(palette);

View file

@ -43,8 +43,8 @@
LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_09_0;
SAVE_VERSION = 1_18_09_1;
VERSION_STRING = MAC? "1.18.003m" : "1.18.10.003";
BUILD_NUMBER = 118101.003;
VERSION_STRING = MAC? "1.18.003m" : "1.18.10.004";
BUILD_NUMBER = 118101.004;
PREF_VERSION = 1_17_1;
var _vsp = string_split(VERSION_STRING, ".");

View file

@ -39,7 +39,7 @@ function color_get_hex(color, alpha = true) {
var b = arr? round(color[2] * 256) : color_get_blue(color);
var a = arr? round(color[3] * 256) : color_get_alpha(color);
return number_to_hex(r) + number_to_hex(g) + number_to_hex(b) + (alpha && is_int64(color)? number_to_hex(a) : "");
return $"{number_to_hex(r)}{number_to_hex(g)}{number_to_hex(b)}{alpha && is_int64(color)? number_to_hex(a) : ""}";
}
function color_from_rgb(str) {