mirror of
https://github.com/litruv/PNGTuber-Plus.git
synced 2026-07-24 02:26:02 +10:00
Viewmode Panning
This commit is contained in:
Binary file not shown.
BIN
bin/~libgdexample.windows.template_debug.x86_64.dll
Normal file
BIN
bin/~libgdexample.windows.template_debug.x86_64.dll
Normal file
Binary file not shown.
@@ -49,6 +49,12 @@ var initialPanPosition = Vector2.ZERO
|
||||
var initialCameraOffset = Vector2.ZERO
|
||||
var cameraOffset = Vector2.ZERO
|
||||
|
||||
#View Mode Panning
|
||||
var viewModePanning = false
|
||||
var initialViewPanPosition = Vector2.ZERO
|
||||
var viewPanOffset = Vector2.ZERO
|
||||
var viewPanLerpSpeed = 3.0
|
||||
|
||||
var bounceChange = 0.0
|
||||
|
||||
#IMPORTANT
|
||||
@@ -148,6 +154,16 @@ func _process(delta):
|
||||
|
||||
yVel += bounceGravity*0.0166
|
||||
|
||||
# Handle view mode panning lerp back to center
|
||||
if !editMode:
|
||||
if !viewModePanning:
|
||||
# Lerp back to center when not actively panning
|
||||
viewPanOffset = viewPanOffset.lerp(Vector2.ZERO, viewPanLerpSpeed * delta)
|
||||
|
||||
# Apply view pan offset to the root character (affects physics)
|
||||
origin.position = (get_viewport().get_visible_rect().size * 0.5) + viewPanOffset
|
||||
updateCameraPosition()
|
||||
|
||||
if Input.is_action_just_pressed("openFolder"):
|
||||
OS.shell_open(ProjectSettings.globalize_path("user://"))
|
||||
|
||||
@@ -173,10 +189,14 @@ func _input(event):
|
||||
isPanning = false
|
||||
else:
|
||||
if event.pressed:
|
||||
# Reset camera in view mode
|
||||
resetCameraPosition()
|
||||
# Start view mode panning
|
||||
viewModePanning = true
|
||||
initialViewPanPosition = event.global_position
|
||||
else:
|
||||
# Stop view mode panning
|
||||
viewModePanning = false
|
||||
|
||||
# Handle mouse movement during panning
|
||||
# Handle mouse movement during edit mode panning
|
||||
elif editMode and event is InputEventMouseMotion and isPanning:
|
||||
var totalDelta = event.global_position - initialPanPosition
|
||||
|
||||
@@ -200,6 +220,15 @@ func _input(event):
|
||||
pushUpdates.position.y = controlPanel.position.y
|
||||
pushUpdates.position.x = editControls.position.x
|
||||
|
||||
# Handle mouse movement during view mode panning
|
||||
elif !editMode and event is InputEventMouseMotion and viewModePanning:
|
||||
var totalDelta = event.global_position - initialViewPanPosition
|
||||
|
||||
# Scale pan distance for view mode (less sensitive than edit mode)
|
||||
# Invert the movement so dragging right moves character right (not left)
|
||||
var panSensitivity = 0.5
|
||||
viewPanOffset = -totalDelta * panSensitivity
|
||||
|
||||
func followShadow():
|
||||
# Shadow disabled for selected sprites
|
||||
shadow.visible = false
|
||||
@@ -301,6 +330,8 @@ func updateCameraPosition():
|
||||
func resetCameraPosition():
|
||||
cameraOffset = Vector2.ZERO
|
||||
isPanning = false
|
||||
viewPanOffset = Vector2.ZERO
|
||||
viewModePanning = false
|
||||
updateCameraPosition()
|
||||
Global.pushUpdate("Camera reset to center.")
|
||||
|
||||
@@ -320,6 +351,10 @@ func swapMode():
|
||||
# Reset camera when entering view mode
|
||||
if !editMode:
|
||||
resetCameraPosition()
|
||||
else:
|
||||
# Reset view mode panning when entering edit mode
|
||||
viewPanOffset = Vector2.ZERO
|
||||
viewModePanning = false
|
||||
|
||||
get_viewport().transparent_bg = !editMode
|
||||
if Global.backgroundColor.a != 0.0:
|
||||
|
||||
@@ -14358,6 +14358,7 @@ text = "Zoom : 100%"
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="VersionLabels" type="Node2D" parent="ControlPanel"]
|
||||
position = Vector2(-205, 59)
|
||||
|
||||
[node name="Label" type="Label" parent="ControlPanel/VersionLabels"]
|
||||
offset_left = -713.0
|
||||
@@ -14378,10 +14379,11 @@ label_settings = SubResource("LabelSettings_qg0do")
|
||||
[node name="versionNo" type="Label" parent="ControlPanel/VersionLabels/Label2"]
|
||||
layout_mode = 0
|
||||
offset_left = 144.0
|
||||
offset_top = 40.0
|
||||
offset_top = 17.0
|
||||
offset_right = 282.0
|
||||
offset_bottom = 74.0
|
||||
text = "v1.4.5"
|
||||
offset_bottom = 60.0
|
||||
text = "v1.4.5
|
||||
Litruv"
|
||||
label_settings = SubResource("LabelSettings_xvf50")
|
||||
|
||||
[node name="EditControls" type="Node2D" parent="."]
|
||||
|
||||
Reference in New Issue
Block a user