Allows the Spacekit control to resize as its canvas resizes.
Updates label positions when the time isn't incrementing and when canvas is resized
What is the current behavior?
The Spacekit control size is defined when it is first initalized and can never be changed.
Labels on objects don't track the object if the user pans/zooms/shifts the view or if the window is resized
How was the solution implemented (if it's not obvious)?
Added a Simulation.staticForcedUpdate method which initiates a forced update of all objects if time isn't incrementing. It will only initiate an update every 30 milliseconds since the events can come in drastically faster than that
Added a Simulation.resizeUpdate method which properly recomputes the control size and aspect ratio when requested and then initiates a staticForceUpdate.
Added event handlers to the camera change event, the DOM element resize event, and the window resize event.
This was tested on FireFox on Linux using a mouse and FireFox on macOS with a trackpad.
What does the pull request do?
What is the current behavior?
How was the solution implemented (if it's not obvious)?
Simulation.staticForcedUpdate
method which initiates a forced update of all objects if time isn't incrementing. It will only initiate an update every 30 milliseconds since the events can come in drastically faster than thatSimulation.resizeUpdate
method which properly recomputes the control size and aspect ratio when requested and then initiates a staticForceUpdate.change
event, the DOM elementresize
event, and the window resize event.This was tested on FireFox on Linux using a mouse and FireFox on macOS with a trackpad.