mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Add a new "CanvasRulers" node group for the canvas rulers
This commit is contained in:
parent
d05787d6ef
commit
dddcfed3c4
|
@ -561,7 +561,10 @@ var draw_grid := false
|
|||
## If [code]true[/code], the pixel grid is visible.
|
||||
var draw_pixel_grid := false
|
||||
## If [code]true[/code], the rulers are visible.
|
||||
var show_rulers := true
|
||||
var show_rulers := true:
|
||||
set(value):
|
||||
show_rulers = value
|
||||
get_tree().set_group(&"CanvasRulers", "visible", value)
|
||||
## If [code]true[/code], the guides are visible.
|
||||
var show_guides := true
|
||||
## If [code]true[/code], the mouse guides are visible.
|
||||
|
@ -612,10 +615,6 @@ var cel_button_scene: PackedScene = load("res://src/UI/Timeline/CelButton.tscn")
|
|||
@onready var global_tool_options: PanelContainer = control.find_child("Global Tool Options")
|
||||
## Camera of the main canvas.
|
||||
@onready var camera: CanvasCamera = main_viewport.find_child("Camera2D")
|
||||
## Horizontal ruler of the main canvas. It has the [param HorizontalRuler.gd] script attached.
|
||||
@onready var horizontal_ruler: BaseButton = control.find_child("HorizontalRuler")
|
||||
## Vertical ruler of the main canvas. It has the [param VerticalRuler.gd] script attached.
|
||||
@onready var vertical_ruler: BaseButton = control.find_child("VerticalRuler")
|
||||
## Transparent checker of the main canvas. It has the [param TransparentChecker.gd] script attached.
|
||||
@onready var transparent_checker: ColorRect = control.find_child("TransparentChecker")
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ var minor_subdivision := 4
|
|||
var first: Vector2
|
||||
var last: Vector2
|
||||
|
||||
@onready var vertical_ruler := $"../ViewportandVerticalRuler/VerticalRuler" as Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Global.project_switched.connect(queue_redraw)
|
||||
|
@ -120,7 +122,7 @@ func create_guide() -> void:
|
|||
return
|
||||
var mouse_pos := get_local_mouse_position()
|
||||
if mouse_pos.x < RULER_WIDTH: # For double guides
|
||||
Global.vertical_ruler.create_guide()
|
||||
vertical_ruler.create_guide()
|
||||
var guide := Guide.new()
|
||||
if absf(Global.camera.rotation_degrees) < 45 or absf(Global.camera.rotation_degrees) > 135:
|
||||
guide.type = guide.Types.HORIZONTAL
|
||||
|
|
|
@ -735,8 +735,6 @@ func _toggle_show_pixel_grid() -> void:
|
|||
func _toggle_show_rulers() -> void:
|
||||
Global.show_rulers = !Global.show_rulers
|
||||
view_menu.set_item_checked(Global.ViewMenu.SHOW_RULERS, Global.show_rulers)
|
||||
Global.horizontal_ruler.visible = Global.show_rulers
|
||||
Global.vertical_ruler.visible = Global.show_rulers
|
||||
|
||||
|
||||
func _toggle_show_guides() -> void:
|
||||
|
|
|
@ -275,7 +275,7 @@ tab_close_display_policy = 2
|
|||
drag_to_rearrange_enabled = true
|
||||
script = ExtResource("3")
|
||||
|
||||
[node name="HorizontalRuler" type="Button" parent="DockableContainer/Main Canvas"]
|
||||
[node name="HorizontalRuler" type="Button" parent="DockableContainer/Main Canvas" groups=["CanvasRulers"]]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(0, 16)
|
||||
layout_mode = 2
|
||||
|
@ -291,7 +291,7 @@ size_flags_horizontal = 3
|
|||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="VerticalRuler" type="Button" parent="DockableContainer/Main Canvas/ViewportandVerticalRuler"]
|
||||
[node name="VerticalRuler" type="Button" parent="DockableContainer/Main Canvas/ViewportandVerticalRuler" groups=["CanvasRulers"]]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(16, 0)
|
||||
layout_mode = 2
|
||||
|
|
Loading…
Reference in a new issue