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.
Added Middle Mouse Button (MMB) and Scroll Wheel Controls for Camera Movement
Panning: Modified the pan method to use the middle mouse button (MMB) for panning the camera. Added event listeners to handle mouse down, mouse move, and mouse up events to track the MMB state and pan accordingly.
Rotating: Adjusted the rotate method to allow camera rotation using the MMB. In SketchUp, it requires holding Shift while pressing the MMB. In Blender, it only requires pressing the MMB. Event listeners were added to handle the rotation logic.
Zooming: Updated the zoom method to use the scroll wheel for zooming in and out. Added an event listener to detect the scroll wheel events and adjust the camera position based on the scroll direction.
Detailed Changes
Event Listeners:
Added event listeners for mousedown, mouseup, mousemove, and wheel events.
Implemented logic to handle panning, rotating, and zooming based on the middle mouse button and scroll wheel actions.
Panning Logic:
Modified the pan method to be triggered by the middle mouse button.
Calculated the panning direction and distance based on the mouse movement.
Rotating Logic:
Adjusted the rotate method to account for both SketchUp and Blender styles.
Added logic to start rotation when the middle mouse button is pressed with or without the Shift key.
Zooming Logic:
Updated the zoom method to respond to the scroll wheel events.
Adjusted the camera position and target based on the scroll direction.
Impact
These changes enhance the user experience by aligning the camera controls with familiar behaviors from popular 3D modeling software like SketchUp and Blender. Users can now pan, rotate, and zoom the camera more intuitively using the middle mouse button and scroll wheel.