mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
function vectorBox(_size, _type, _onModify) constructor {
|
|
size = _size;
|
|
onModify = _onModify;
|
|
|
|
hover = false;
|
|
active = false;
|
|
|
|
axis = [ "x", "y", "z", "w" ];
|
|
onModifySingle[0] = function(val) { onModify(0, toNumber(val)); }
|
|
onModifySingle[1] = function(val) { onModify(1, toNumber(val)); }
|
|
onModifySingle[2] = function(val) { onModify(2, toNumber(val)); }
|
|
onModifySingle[3] = function(val) { onModify(3, toNumber(val)); }
|
|
|
|
extras = -1;
|
|
|
|
for(var i = 0; i < size; i++) {
|
|
tb[i] = new textBox(_type, onModifySingle[i]);
|
|
tb[i].slidable = true;
|
|
}
|
|
|
|
static draw = function(_x, _y, _w, _h, _data, _m) {
|
|
if(extras && instanceof(extras) == "buttonClass") {
|
|
extras.hover = hover;
|
|
extras.active = active;
|
|
|
|
extras.draw(_x + _w - 32, _y + _h / 2 - 32 / 2, 32, 32, _m, s_button_hide);
|
|
_w -= 40;
|
|
}
|
|
|
|
var ww = _w / size;
|
|
for(var i = 0; i < array_length(_data); i++) {
|
|
tb[i].hover = hover;
|
|
tb[i].active = active;
|
|
|
|
var bx = _x + ww * i;
|
|
tb[i].draw(bx + 24, _y, ww - 24, _h, _data[i], _m);
|
|
|
|
draw_set_text(f_p0, fa_left, fa_center, c_ui_blue_grey);
|
|
draw_text(bx + 8, _y + _h / 2, axis[i]);
|
|
}
|
|
hover = false;
|
|
active = false;
|
|
}
|
|
} |