From 7f79e0a89f0dade92e12589e2e5519dc4748ff9a Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Thu, 23 Nov 2023 13:52:33 +0100 Subject: [PATCH] Add setting for moving selection with selection tool Hide Element Fill Tool mode in 2D editor --- js/interface/settings.js | 1 + js/texturing/painter.js | 2 +- js/texturing/uv.js | 6 +++--- lang/en.json | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/js/interface/settings.js b/js/interface/settings.js index 6bc24bdc..fd07a81a 100644 --- a/js/interface/settings.js +++ b/js/interface/settings.js @@ -502,6 +502,7 @@ const Settings = { if (!value) scene.remove(Canvas.brush_outline); }}); new Setting('outlines_in_paint_mode', {category: 'paint', value: true}); + new Setting('move_with_selection_tool', {category: 'paint', value: true}); new Setting('pick_color_opacity', {category: 'paint', value: false}); new Setting('paint_through_transparency', {category: 'paint', value: true}); new Setting('paint_side_restrict', {category: 'paint', value: true}); diff --git a/js/texturing/painter.js b/js/texturing/painter.js index 4530df69..0df3fd98 100644 --- a/js/texturing/painter.js +++ b/js/texturing/painter.js @@ -2678,7 +2678,7 @@ BARS.defineActions(function() { condition: () => Toolbox && Toolbox.selected.id === 'fill_tool', options: { face: true, - element: true, + element: {name: true, condition: () => !Format.image_editor}, color_connected: true, color: true, } diff --git a/js/texturing/uv.js b/js/texturing/uv.js index 4861f982..dd3e0c18 100644 --- a/js/texturing/uv.js +++ b/js/texturing/uv.js @@ -2227,7 +2227,7 @@ Interface.definePanels(function() { this.mouse_coords.x = x; this.mouse_coords.y = y; let grab = Toolbox.selected.id == 'move_layer_tool' || - (Toolbox.selected.id == 'selection_tool' && this.texture && this.texture.selection.get(this.mouse_coords.x, this.mouse_coords.y) && BarItems.selection_tool_operation_mode.value == 'create'); + (Toolbox.selected.id == 'selection_tool' && settings.move_with_selection_tool.value && this.texture && this.texture.selection.get(this.mouse_coords.x, this.mouse_coords.y) && BarItems.selection_tool_operation_mode.value == 'create'); this.$refs.frame.style.cursor = grab ? 'move' : ''; }, onMouseWheel(event) { @@ -3263,7 +3263,7 @@ Interface.definePanels(function() { let start_x, start_y, calcrect; let layer = texture.selected_layer; let create_selection = Toolbox.selected.id == 'selection_tool' - && !(op_mode == 'create' && clicked_val) + && !(op_mode == 'create' && settings.move_with_selection_tool.value && clicked_val) && !event.target.classList.contains('uv_layer_transform_handles'); let initial_offset = layer ? layer.offset.slice() : [0, 0]; @@ -3539,7 +3539,7 @@ Interface.definePanels(function() { isTransformingLayer() { if (!this.texture || !this.texture.selected_layer) return false; let tool = Toolbox.selected; - if (tool.id == 'move_layer_tool' || (tool.id == 'selection_tool' && TextureLayer.selected?.in_limbo)) { + if (tool.id == 'move_layer_tool' || (tool.id == 'selection_tool' && settings.move_with_selection_tool.value && TextureLayer.selected?.in_limbo)) { return true; } return false; diff --git a/lang/en.json b/lang/en.json index 0da0ce4f..bde76cc5 100644 --- a/lang/en.json +++ b/lang/en.json @@ -961,6 +961,8 @@ "settings.brush_cursor_3d.desc": "Display an outline around the brush in the 3D workspace", "settings.outlines_in_paint_mode": "Selection Outlines in Paint Mode", "settings.outlines_in_paint_mode.desc": "Display element selection outlines while in paint mode", + "settings.move_with_selection_tool": "Use Selection Tool to Move Selections", + "settings.move_with_selection_tool.desc": "Allow the Selection Tool to directly move selections, without having to switch to the Move Layer tool", "settings.paint_through_transparency": "Paint Through Transparency", "settings.paint_through_transparency.desc": "Paint through transparent pixels when Lock Alpha Channel is enabled", "settings.paint_side_restrict": "Restrict Brush to Side",