diff --git a/src/box_edit.c b/src/box_edit.c index 5212df209..056b59f7a 100644 --- a/src/box_edit.c +++ b/src/box_edit.c @@ -148,6 +148,7 @@ static int on_drag(gesture3d_t *gest) static int on_gizmo_hover(gesture3d_t *gest) { + goxel_set_help_text("Drag to move"); g_data.snap_face = gest->user_key; g_data.flags |= FLAG_SNAP_GIZMO; return 0; @@ -159,7 +160,7 @@ static int on_gizmo_drag(gesture3d_t *gest) int face = gest->user_key; float box[4][4]; - goxel_set_help_text("Drag to move face"); + goxel_set_help_text("Drag to move"); g_data.flags |= FLAG_MOVING; if (gest->state == GESTURE3D_STATE_BEGIN) { diff --git a/src/goxel.h b/src/goxel.h index 12d596cd3..f6b94e14b 100644 --- a/src/goxel.h +++ b/src/goxel.h @@ -496,9 +496,6 @@ typedef struct goxel float tool_radius; bool pathtrace; // Render pathtraced mode. - // Some state for the tool iter functions. - int tool_drag_mode; // 0: move, 1: resize. - float selection[4][4]; // The selection box. volume_t *mask; // Global selection mask volume. int mask_mode; diff --git a/src/gui/layers_panel.c b/src/gui/layers_panel.c index 20cc6f5b5..2594216fb 100644 --- a/src/gui/layers_panel.c +++ b/src/gui/layers_panel.c @@ -155,7 +155,6 @@ void gui_layers_panel(void) gui_bbox(layer->box); if (layer->shape) { - tool_gui_drag_mode(&goxel.tool_drag_mode); tool_gui_shape(&layer->shape); gui_color("##color", layer->color); } diff --git a/src/tools.c b/src/tools.c index a09b924c3..7c0bce30d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -186,25 +186,3 @@ int tool_gui_color(void) } return 0; } - -int tool_gui_drag_mode(int *mode) -{ - int ret = 0; - bool b; - - gui_group_begin(_(ADJUSTEMENTS)); - gui_row_begin(2); - b = *mode == 0; - if (gui_selectable(_(MOVE), &b, NULL, 0)) { - *mode = 0; - ret = 1; - } - b = *mode == 1; - if (gui_selectable(_(RESIZE), &b, NULL, 0)) { - *mode = 1; - ret = 1; - } - gui_row_end(); - gui_group_end(); - return ret; -} diff --git a/src/tools.h b/src/tools.h index e98f82a0c..c6fe0741e 100644 --- a/src/tools.h +++ b/src/tools.h @@ -86,6 +86,5 @@ int tool_gui_shape(const shape_t **shape); int tool_gui_radius(void); int tool_gui_smoothness(void); int tool_gui_color(void); -int tool_gui_drag_mode(int *mode); #endif // TOOLS_H diff --git a/src/tools/move.c b/src/tools/move.c index 2733aaa17..30ddba66e 100644 --- a/src/tools/move.c +++ b/src/tools/move.c @@ -92,12 +92,11 @@ static void update_view(void) bool first; uint8_t color[4] = {255, 0, 0, 255}; float box[4][4]; + int drag_mode = DRAG_MOVE; layer_t *layer = goxel.image->active_layer; - if (layer_is_volume(layer)) { - goxel.tool_drag_mode = DRAG_MOVE; - } + if (layer->shape) drag_mode = DRAG_RESIZE; volume_get_box(goxel.image->active_layer->volume, true, box); // Fix problem with shape layer box. @@ -105,7 +104,7 @@ static void update_view(void) normalize_box(goxel.image->active_layer->mat, box); } - if (box_edit(box, goxel.tool_drag_mode, transf, &first)) { + if (box_edit(box, drag_mode, transf, &first)) { if (first) image_history_push(goxel.image); do_move(layer, transf, VEC(0, 0, 0), false); } @@ -152,12 +151,6 @@ static int gui(tool_t *tool) update_view(); layer = goxel.image->active_layer; - if (layer->shape) { - tool_gui_drag_mode(&goxel.tool_drag_mode); - } else { - goxel.tool_drag_mode = DRAG_MOVE; - } - x = (int)round(layer->mat[3][0]); y = (int)round(layer->mat[3][1]); z = (int)round(layer->mat[3][2]); diff --git a/src/tools/selection.c b/src/tools/selection.c index 282efd04e..a687f9d98 100644 --- a/src/tools/selection.c +++ b/src/tools/selection.c @@ -23,8 +23,6 @@ enum { DRAG_MOVE, }; -static int g_drag_mode = 0; - typedef struct { tool_t tool; @@ -95,8 +93,7 @@ static int iter(tool_t *tool, const painter_t *painter, snap_mask |= SNAP_ROUNDED; snap_mask &= ~(SNAP_SELECTION_IN | SNAP_SELECTION_OUT); - if (box_edit(goxel.selection, g_drag_mode == DRAG_RESIZE ? 1 : 0, - transf, NULL)) { + if (box_edit(goxel.selection, 1, transf, NULL)) { mat4_mul(transf, goxel.selection, goxel.selection); return 0; } @@ -141,10 +138,6 @@ static int gui(tool_t *tool) float (*box)[4][4] = &goxel.selection; if (box_is_null(*box)) return 0; - gui_text("Drag mode"); - gui_combo("##drag_mode", &g_drag_mode, - (const char*[]) {"Resize", "Move"}, 2); - gui_group_begin(NULL); if (gui_action_button(ACTION_reset_selection, "Reset", 1.0)) { gui_group_end();