-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submarine Editor Transform Tool #15469
base: master
Are you sure you want to change the base?
Conversation
…tools # Conflicts: # Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! This seems like a really handy addition. The code changes look mostly good, but I spotted a couple of things that could have some negative performance implications and would most likely be easy to optimize.
Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
Outdated
Show resolved
Hide resolved
Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's still an issue with how the behavior of the Hovered
callback was modified.
@@ -112,9 +112,9 @@ public virtual void Update(float deltaTime) | |||
{ | |||
PreUpdate?.Invoke(deltaTime); | |||
if (!enabled) { return; } | |||
if (IsMouseOver || (!RequireMouseOn && SelectedWidgets.Contains(this) && PlayerInput.PrimaryMouseButtonHeld())) | |||
if (IsMouseOver) { Hovered?.Invoke(); } | |||
if (PlayerInput.PrimaryMouseButtonHeld() && (IsMouseOver || !RequireMouseOn && SelectedWidgets.Contains(this))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still changes the behavior of the method. Previously Hovered was called if the cursor is on the widget, or if it's being dragged and doesn't require the mouse to be on it to be draggable.
If you want the new widgets to behave in some other way, I think that should be handled in the callbacks or by disabling RequireMouseOn
.
|
Revert changes to Widget.Update in favor of custom implementation. Keep widget at a fixed distance when only rotation is enabled.
This PR adds a rotation & scaling tool to the submarine editor.
Its functions can be toggled with the tickboxes to the right of the "Generate Waypoints" button.
With "Edit Rotation" active, users can drag the widget around to rotate the selected entities about the center of the selection.
With "Edit Scaling" active, users can drag the widget around to scale the selected entities about the center of the selection.
The current rotation and/or scaling offset is visible in a tooltip next to the widget while it is being dragged.
Added content is in the mod provided with the PR.
The tickboxes also require their own art to be done, hence the duplicate styles I have added.