diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ac913d..15f6e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ This is a high-level changelog for each released versions of the plugin. For a more detailed list of past changes, see the commit history. 1.0.2 ------- +------- +- Added scroll in draw mode to change pen size - Auto hide toolbar when in draw mode - Added keyboard shortcut to toggle toolbar diff --git a/README.md b/README.md index 0941ce0..9dd0efc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Draw Anywhere (Godot Editor) ========================================= -###### (Get it from Godot Asset Library - Coming soon) +###### (Get it from Godot Asset Library - [Asset Library](https://godotengine.org/asset-library/asset/1184)) ### Draw anywhere in the Godot Editor. Supports multiple pen sizes and colors. @@ -18,7 +18,7 @@ Features - Floating, draggable toolbar - Change pen size and color - Draw over Popups -- Easy keyboard shortcuts +- Easy shortcut keys Automatic Installation -------------- @@ -51,7 +51,7 @@ Once the plugin is enabled, a new floating toolbar will appear. This toolbar has When draw mode is active, an indicator will be shown in the bottom-left of the screen. -Keyboard Shortcuts +Shortcuts -------------- ### Global shortcuts @@ -72,6 +72,8 @@ These shortcuts will only work when draw mode is active | Z | Clear last line | | R | Reset the toolbar position | +Scroll to change pen size + Limitations? -------------- diff --git a/addons/draw_anywhere/README.md b/addons/draw_anywhere/README.md index 0941ce0..9dd0efc 100644 --- a/addons/draw_anywhere/README.md +++ b/addons/draw_anywhere/README.md @@ -1,6 +1,6 @@ Draw Anywhere (Godot Editor) ========================================= -###### (Get it from Godot Asset Library - Coming soon) +###### (Get it from Godot Asset Library - [Asset Library](https://godotengine.org/asset-library/asset/1184)) ### Draw anywhere in the Godot Editor. Supports multiple pen sizes and colors. @@ -18,7 +18,7 @@ Features - Floating, draggable toolbar - Change pen size and color - Draw over Popups -- Easy keyboard shortcuts +- Easy shortcut keys Automatic Installation -------------- @@ -51,7 +51,7 @@ Once the plugin is enabled, a new floating toolbar will appear. This toolbar has When draw mode is active, an indicator will be shown in the bottom-left of the screen. -Keyboard Shortcuts +Shortcuts -------------- ### Global shortcuts @@ -72,6 +72,8 @@ These shortcuts will only work when draw mode is active | Z | Clear last line | | R | Reset the toolbar position | +Scroll to change pen size + Limitations? -------------- diff --git a/addons/draw_anywhere/plugin.gd b/addons/draw_anywhere/plugin.gd index b767ac8..337be38 100644 --- a/addons/draw_anywhere/plugin.gd +++ b/addons/draw_anywhere/plugin.gd @@ -38,6 +38,8 @@ var default_plugin_settings = { } var draw_settings = { "size": 1, + "min_size": 1, + "max_size": 16, "color": Color("#eee"), "antialised": true, "begin_cap_mode": Line2D.LINE_CAP_ROUND, @@ -147,6 +149,18 @@ func _input(event: InputEvent) -> void: current_line.add_point(event.position) get_tree().set_input_as_handled() + # Handle scrolling to change size + if event is InputEventMouseButton and event.pressed: + if event.button_index == BUTTON_WHEEL_UP: + _set_draw_size(draw_settings.size + 1) + elif event.button_index == BUTTON_WHEEL_DOWN: + _set_draw_size(draw_settings.size - 1) + + +func _set_draw_size(p_size): + draw_settings.size = clamp(p_size, draw_settings.min_size, draw_settings.max_size) + canvas.update_drag_preview_size(self) + func _on_draw_button_pressed(is_now_active): # Draw button on the toolbar was pressed diff --git a/addons/draw_anywhere/scenes/Canvas.gd b/addons/draw_anywhere/scenes/Canvas.gd index b324f51..ae2513a 100644 --- a/addons/draw_anywhere/scenes/Canvas.gd +++ b/addons/draw_anywhere/scenes/Canvas.gd @@ -44,6 +44,9 @@ func show_draw_preview(plugin): draw_preview.visible = true draw_preview.set_process(true) +func update_drag_preview_size(plugin): + draw_preview.rect_size = Vector2(plugin.draw_settings.size, plugin.draw_settings.size) + func hide_draw_preview(): draw_preview.visible = false