1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-13 17:23:08 +00:00

rename _fill to _fill_inside for sync consistency (fill in pencil and shape tools basically represent the same thing)

This commit is contained in:
Variable 2024-10-14 20:18:45 +05:00
parent 63a23ccb9c
commit f882fd2375
3 changed files with 16 additions and 14 deletions

View file

@ -435,7 +435,8 @@ func remove_tool(t: Tool) -> void:
func set_tool(tool_name: String, button: int) -> void:
## To prevent any unintentional syncing, we will temporarily disconnect the signal
Tools.config_changed.disconnect(attempt_config_share)
if Tools.config_changed.is_connected(attempt_config_share):
Tools.config_changed.disconnect(attempt_config_share)
var slot: Slot = _slots[button]
var panel: Node = _panels[button]
var node: Node = tools[tool_name].instantiate_scene()
@ -460,7 +461,8 @@ func set_tool(tool_name: String, button: int) -> void:
# Wait for config to get loaded, then re-connect and sync
await get_tree().process_frame
Tools.config_changed.connect(attempt_config_share)
if not Tools.config_changed.is_connected(attempt_config_share):
Tools.config_changed.connect(attempt_config_share)
attempt_config_share(config_slot) # Sync it with the other tool

View file

@ -3,7 +3,7 @@ extends "res://src/Tools/BaseDraw.gd"
var _start := Vector2i.ZERO
var _offset := Vector2i.ZERO
var _dest := Vector2i.ZERO
var _fill := false
var _fill_inside := false
var _drawing := false
var _displace_origin := false
var _thickness := 1
@ -41,27 +41,27 @@ func update_indicator() -> void:
func _on_FillCheckbox_toggled(button_pressed: bool) -> void:
_fill = button_pressed
_fill_inside = button_pressed
update_config()
save_config()
func get_config() -> Dictionary:
var config := super.get_config()
config["fill"] = _fill
config["fill_inside"] = _fill_inside
config["thickness"] = _thickness
return config
func set_config(config: Dictionary) -> void:
super.set_config(config)
_fill = config.get("fill", _fill)
_fill_inside = config.get("fill_inside", _fill_inside)
_thickness = config.get("thickness", _thickness)
func update_config() -> void:
super.update_config()
$FillCheckbox.button_pressed = _fill
$FillCheckbox.button_pressed = _fill_inside
$ThicknessSlider.value = _thickness
@ -237,7 +237,7 @@ func _get_result_rect(origin: Vector2i, dest: Vector2i) -> Rect2i:
func _get_points(shape_size: Vector2i) -> Array[Vector2i]:
return _get_shape_points_filled(shape_size) if _fill else _get_shape_points(shape_size)
return _get_shape_points_filled(shape_size) if _fill_inside else _get_shape_points(shape_size)
func _set_cursor_text(rect: Rect2i) -> void:

View file

@ -2,7 +2,7 @@ extends "res://src/Tools/BaseDraw.gd"
var _curve := Curve2D.new() ## The [Curve2D] responsible for the shape of the curve being drawn.
var _drawing := false ## Set to true when a curve is being drawn.
var _fill := false ## When true, the inside area of the curve gets filled.
var _fill_inside := false ## When true, the inside area of the curve gets filled.
var _fill_inside_rect := Rect2i() ## The bounding box that surrounds the area that gets filled.
var _editing_bezier := false ## Needed to determine when to show the control points preview line.
var _editing_out_control_point := false ## True when controlling the out control point only.
@ -29,7 +29,7 @@ func _on_thickness_value_changed(value: int) -> void:
func _on_fill_checkbox_toggled(toggled_on: bool) -> void:
_fill = toggled_on
_fill_inside = toggled_on
update_config()
save_config()
@ -44,20 +44,20 @@ func update_indicator() -> void:
func get_config() -> Dictionary:
var config := super.get_config()
config["fill"] = _fill
config["fill_inside"] = _fill_inside
config["thickness"] = _thickness
return config
func set_config(config: Dictionary) -> void:
super.set_config(config)
_fill = config.get("fill", _fill)
_fill_inside = config.get("fill_inside", _fill_inside)
_thickness = config.get("thickness", _thickness)
func update_config() -> void:
super.update_config()
$FillCheckbox.button_pressed = _fill
$FillCheckbox.button_pressed = _fill_inside
$ThicknessSlider.value = _thickness
@ -191,7 +191,7 @@ func _draw_shape() -> void:
_fill_inside_rect = _fill_inside_rect.expand(point)
# Draw each point offsetted based on the shape's thickness
_draw_pixel(point, images)
if _fill:
if _fill_inside:
var v := Vector2i()
for x in _fill_inside_rect.size.x:
v.x = x + _fill_inside_rect.position.x