v4.0.0
v4.0.0 brings huge improvements to marker transition behaviors and other features!
Features and Improvements
- Markers now update and apply transitions without resetting the globe or other markers. This creates a simple way to add/remove/update markers with intuitive visual feedback.
- Globe avoids resetting and re-rendering when props change.
- Globe animations are better optimized and less 'lag' is encountered.
- Additional named exports (e.g.
Globe,Tooltip) empower useful ways to work withreact-globe. - You can now retrieve the
Globeinstance via theonGetGlobeInstanceprop, which allows you to fully access and control theGlobeclass outside of the React lifecycle.- This also opens up powerful new ways to work with the globe (e.g.
freezeandunfreezemethods). - Note that we still strongly recommend that you keep to React props to control behaviors of the globe.
- This also opens up powerful new ways to work with the globe (e.g.
- Updated docs and examples.
Breaking Changes
lookAtprop is renamed toinitialCoordinates.- Some exported Typescript types have changed. Address and import the relevant types accordingly. Noticeably, all
*Optionsprop are now explicitly renamed to*OptionsProp. The former is used internally in the codebase while the*OptionsPropsupports specifying optional option key/value pair in the component props. - The underlying
defaultCameraOptionsvalues are updated to reflect changes in dependent libraries. You might need to update these option values if custom values were previously used. - Tooltip behaviors have changed slightly to improve rendering performance. Tooltips are auto-disabled on non-interactable scenarios (e.g. focusing, animating).
globeOptions.cloudsSpeedoption is removed because it was not very useful, and was overcomplicating the animation cycle. We should explore a better way to implement/customize cloud speeds in every rotation axis in the future.
Internal Changes
- Refactor rendering logic to use
Globe.tsclass instead of custom React hooks.- While React hooks organized the code better, it created unneccessary complexity when dealing with hook dependencies.
- This refactor decouples the React component and the ThreeJS rendering responsibilities. The React component is basically now a thin wrapper to pass props to the
Globeinstance and control how theGlobeinstance should be updated when props change. - The refactor was also required to better support and control marker transitions, and optimizing globe re-rendering when props change.