Sub location X and Y from form inputs#2
Open
LiveNathan wants to merge 4 commits intoinitial-cubes-axes-labelsfrom
Open
Sub location X and Y from form inputs#2LiveNathan wants to merge 4 commits intoinitial-cubes-axes-labelsfrom
LiveNathan wants to merge 4 commits intoinitial-cubes-axes-labelsfrom
Conversation
Updated the HTML form and related JavaScript to make some inputs dynamic, depending on checkbox values. Introduced a new JavaScript file "updated-alignment-position-fields.js" to handle changes in form field values based on user inputs. The changes allow users to dynamically adjust the array alignment position and automatically update other related fields. An event listener has been added to handle real-time changes in "sub depth relative to mains on x-axis" and "units" fields. This allows for a more interactive, use-friendly experience.
This commit fixes a bug where the sub's X position was not updating and the scene not re-rendering due to missing code in the event listener. A conversion from the input event value into a number was also added for correct positioning calculation. Now the submarine properly moves along the x-axis on input and the animation is triggered on each change.
This commit encompasses a significant refactor of the cube creation and positioning in the main.js file. Originally, the cubes were created and placed directly within the main script. Now, I have introduced a utility class, "Location", for encapsulating a 3D location (x, y, z), and a helper function, "createCube", to portion out the creation of cubes. This enhancement adds more readability, maintains code cleanliness, and allows easy reusability of the logic for creating a cube.
The code's structure was rearranged to clarify what each section does. Some parts have been repositioned and others extracted into seperate functions to make it easier to understand. The 'Location' class was moved to the top, and event listeners were moved to the bottom. Moreover, the inline code for the 'sub' y location setting was extracted into a separate function 'setSubLocationY', resulting in more straightforward, easier-to-read code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.