2023-04-05 20:13:27 +02:00
|
|
|
function preview_overlay_rotation(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _rad) {
|
2023-09-15 20:12:02 +02:00
|
|
|
var _val = getValue();
|
2023-01-17 08:11:55 +01:00
|
|
|
var hover = -1;
|
|
|
|
if(is_array(_val)) return hover;
|
|
|
|
|
|
|
|
var _ax = _x + lengthdir_x(_rad, _val);
|
|
|
|
var _ay = _y + lengthdir_y(_rad, _val);
|
2023-04-09 21:24:16 +02:00
|
|
|
draw_sprite_colored(THEME.anchor_rotate, 0, _ax, _ay, 1, _val - 90);
|
2023-01-17 08:11:55 +01:00
|
|
|
|
|
|
|
if(drag_type) {
|
|
|
|
draw_set_color(COLORS._main_accent);
|
|
|
|
draw_set_alpha(0.5);
|
2023-06-17 14:30:49 +02:00
|
|
|
draw_circle_prec(_x, _y, _rad, true);
|
2023-01-17 08:11:55 +01:00
|
|
|
draw_set_alpha(1);
|
|
|
|
|
2023-04-09 21:24:16 +02:00
|
|
|
draw_sprite_colored(THEME.anchor_rotate, 1, _ax, _ay, 1, _val - 90);
|
2023-01-17 08:11:55 +01:00
|
|
|
var angle = point_direction(_x, _y, _mx, _my);
|
|
|
|
if(key_mod_press(CTRL))
|
|
|
|
angle = round(angle / 15) * 15;
|
|
|
|
|
|
|
|
if(setValue( angle ))
|
|
|
|
UNDO_HOLDING = true;
|
|
|
|
|
|
|
|
if(mouse_release(mb_left)) {
|
|
|
|
drag_type = 0;
|
|
|
|
UNDO_HOLDING = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-18 14:58:55 +02:00
|
|
|
if(interact && active && point_in_circle(_mx, _my, _ax, _ay, 8)) {
|
2023-01-17 08:11:55 +01:00
|
|
|
draw_set_color(COLORS._main_accent);
|
|
|
|
draw_set_alpha(0.5);
|
2023-06-17 14:30:49 +02:00
|
|
|
draw_circle_prec(_x, _y, _rad, true);
|
2023-01-17 08:11:55 +01:00
|
|
|
draw_set_alpha(1);
|
|
|
|
hover = 1;
|
|
|
|
|
2023-04-09 21:24:16 +02:00
|
|
|
draw_sprite_colored(THEME.anchor_rotate, 1, _ax, _ay, 1, _val - 90);
|
2023-01-17 08:11:55 +01:00
|
|
|
if(mouse_press(mb_left, active)) {
|
|
|
|
drag_type = 1;
|
|
|
|
drag_mx = _mx;
|
|
|
|
drag_my = _my;
|
|
|
|
drag_sx = _ax;
|
|
|
|
drag_sy = _ay;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hover;
|
|
|
|
}
|