mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
feat(globe): answer both reset buttons through the globe actions store
The top-center and cockpit reset buttons call the location controls' new reset() through the globe actions store, and render a reset under way from it, instead of the location controls binding their clicks and the navigation writing their labels. The store keeps each owner's reset under way like its clear, and controls replaced mid-reset keep it on the buttons. LocationControls no longer takes resetButtons.
This commit is contained in:
1 parent
eccaeea0c4
commit
b4ee2321cf
17 files changed
+173
-84
No files matched your search
@@ -322,14 +322,14 @@ export class StyleManager extends ShellFacade {
|
||||
elements: {
|
||||
_locationSearch: this._locationSearch,
|
||||
_searchToggle: this._searchToggle,
|
||||
_resetGlobeBtn: this._resetGlobeBtn,
|
||||
_cockpitResetGlobeBtn: this._cockpitResetGlobeBtn,
|
||||
},
|
||||
operations: {
|
||||
_publishLocation: (view) =>
|
||||
useLocationStore(applicationPinia()).publish(view),
|
||||
_connectLocation: (controls) =>
|
||||
useLocationStore(applicationPinia()).connect(controls),
|
||||
_connectGlobeReset: (controls) => this._connectGlobeReset(controls),
|
||||
_publishGlobeResetting: (busy) => this._publishGlobeResetting(busy),
|
||||
_beginDeferredNavigation: (...args) =>
|
||||
this._beginDeferredNavigation(...args),
|
||||
_reassertNavigationHandoff: (...args) =>
|
||||
@@ -1649,6 +1649,32 @@ export class StyleManager extends ShellFacade {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer the globe and cockpit reset buttons through the location controls,
|
||||
* or stop answering them (null).
|
||||
*/
|
||||
_connectGlobeReset(controls) {
|
||||
const store = useGlobeActionsStore(applicationPinia());
|
||||
if (this._resetToken) store.detach(this._resetToken);
|
||||
this._resetToken = controls
|
||||
? store.connect({ reset: () => controls.reset() })
|
||||
: null;
|
||||
// A reset under way as the controls are replaced stays on the buttons.
|
||||
if (this._resetToken && this._globeResetting != null)
|
||||
store.publishResetting(this._resetToken, this._globeResetting);
|
||||
}
|
||||
|
||||
/** Publish a reset to the full globe view under way. */
|
||||
_publishGlobeResetting(busy) {
|
||||
if (this._disposed) return;
|
||||
this._globeResetting = Boolean(busy);
|
||||
if (this._resetToken)
|
||||
useGlobeActionsStore(applicationPinia()).publishResetting(
|
||||
this._resetToken,
|
||||
busy,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop answering the globe actions. Its clear under way goes with its
|
||||
* owner, and its camera state too; a newer shell's stays.
|
||||
@@ -1659,7 +1685,9 @@ export class StyleManager extends ShellFacade {
|
||||
if (this._clearLayersToken) store.detach(this._clearLayersToken);
|
||||
if (this._shareToken) store.detach(this._shareToken);
|
||||
if (this._orientationToken) store.detach(this._orientationToken);
|
||||
if (this._resetToken) store.detach(this._resetToken);
|
||||
this._clearLayersToken = this._shareToken = this._orientationToken = null;
|
||||
this._resetToken = null;
|
||||
}
|
||||
|
||||
/** Wire Google Maps-style tilt and north-up camera actions. */
|
||||
|
||||
Reference in new issue
Block a user