diff --git a/src/UI/Timeline/AnimationTimeline.gd b/src/UI/Timeline/AnimationTimeline.gd index c5bb90a63..97789224f 100644 --- a/src/UI/Timeline/AnimationTimeline.gd +++ b/src/UI/Timeline/AnimationTimeline.gd @@ -89,18 +89,28 @@ func _get_minimum_size() -> Vector2: return Vector2(Global.layer_vbox.rect_size.x + cel_size + 26, cel_size + 105) -func _frame_scroll_changed(value: float) -> void: +func _frame_scroll_changed(_value: float) -> void: # Update the tag scroll as well: - tag_scroll_container.get_child(0).rect_min_size.x = Global.frame_hbox.rect_size.x - tag_scroll_container.scroll_horizontal = value + adjust_scroll_container() func _on_LayerVBox_resized() -> void: frame_scroll_bar.margin_left = frame_scroll_container.rect_position.x + adjust_scroll_container() + + +func adjust_scroll_container(): tag_spacer.rect_min_size.x = ( frame_scroll_container.rect_global_position.x - tag_scroll_container.rect_global_position.x ) + print(" ") + tag_scroll_container.get_child(0).rect_min_size.x = Global.frame_hbox.rect_size.x + Global.tag_container.rect_min_size = Global.frame_hbox.rect_size + tag_scroll_container.scroll_horizontal = frame_scroll_bar.value + print(tag_scroll_container.get_child(0).rect_min_size.x) + print(Global.tag_container.rect_min_size) + print(tag_scroll_container.scroll_horizontal) func _on_LayerFrameSplitContainer_gui_input(event: InputEvent) -> void: @@ -189,6 +199,8 @@ func add_frame() -> void: project.undo_redo.add_do_method(project, "change_cel", project.current_frame + 1) project.undo_redo.add_undo_method(project, "change_cel", project.current_frame) project.undo_redo.commit_action() + yield(get_tree(), "idle_frame") + adjust_scroll_container() func _on_DeleteFrame_pressed() -> void: @@ -256,6 +268,8 @@ func delete_frames(indices := []) -> void: project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() + yield(get_tree(), "idle_frame") + adjust_scroll_container() func _on_CopyFrame_pressed() -> void: @@ -277,7 +291,7 @@ func copy_frames(indices := [], destination := -1) -> void: var copied_frames := [] var copied_indices := [] # the indices of newly copied frames if destination != -1: - copied_indices = range((destination + 1), (destination + 1) + indices.size()) + copied_indices = range(destination + 1, (destination + 1) + indices.size()) else: copied_indices = range(indices[-1] + 1, indices[-1] + 1 + indices.size()) @@ -389,7 +403,7 @@ func _on_TagList_id_pressed(id: int) -> void: var frames = [] for i in range(tag.from - 1, tag.to): frames.append(i) - copy_frames(frames, Global.current_project.current_frame) + copy_frames(frames, Global.current_project.current_frame - 1) func _on_FrameTagButton_pressed() -> void: