At present, this.get('scrollMagic').getController() only searches for scroll controllers registered on the current route. Currently, preserving the scroll controller for pages with nested routes requires custom scroll controllers to be registered and shared across routes, creating a messy pattern.
Instead, getController() should recursively look up the route tree for a parent ScrollMagic controller if one is not registered for the current route. This way, navigating to a nested child route will not break components initialised on the parent route's scroll controller.
It should also be noted that is unlikely for nested routes to want their own scroll controller if a parent already has one registered.
This also opens up the possibility to have just one scroll controller registered on the ApplicationController and to simply add and remove scenes inside the component didRender and willDestroyElement hooks.
At present,
this.get('scrollMagic').getController()
only searches for scroll controllers registered on the current route. Currently, preserving the scroll controller for pages with nested routes requires custom scroll controllers to be registered and shared across routes, creating a messy pattern.Instead,
getController()
should recursively look up the route tree for a parent ScrollMagic controller if one is not registered for the current route. This way, navigating to a nested child route will not break components initialised on the parent route's scroll controller.It should also be noted that is unlikely for nested routes to want their own scroll controller if a parent already has one registered.
This also opens up the possibility to have just one scroll controller registered on the
ApplicationController
and to simply add and remove scenes inside the componentdidRender
andwillDestroyElement
hooks.