File tree Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 36
36
<script setup lang="ts">
37
37
import { computed } from " vue" ;
38
38
import { Settings } from " @wwtelescope/engine" ;
39
- import { engineStore } from " @wwtelescope/engine-pinia" ;
40
39
import { storeToRefs } from " pinia" ;
41
40
42
41
import { WwtHUDProps } from " ../types" ;
43
42
44
- const store = engineStore ();
45
- const {
46
- raRad,
47
- decRad,
48
- rollRad,
49
- zoomDeg,
50
- currentTime,
51
- clockRate,
52
- foregroundOpacity,
53
- backgroundImageset,
54
- foregroundImageset,
55
- } = storeToRefs (store );
56
43
57
44
const R2D = 180 / Math .PI ;
58
45
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -68,6 +55,26 @@ const props = withDefaults(defineProps<WwtHUDProps>(), {
68
55
textShadow: " 0 0 5px black" ,
69
56
});
70
57
58
+ /*
59
+ * I really don't care for passing the store as a prop,
60
+ * but without just calling `engineStore` (or even `engineStore(wwtPinia)`),
61
+ * we were getting a different store instance than in the using downstream app.
62
+ * Note that if this component is placed directly in the downstream app package,
63
+ * everything worked exactly as expected, so this some sort of Pinia configuration issue.
64
+ * This works, so until I figure out the "right" approach, we'll just do this.
65
+ */
66
+ const {
67
+ raRad,
68
+ decRad,
69
+ rollRad,
70
+ zoomDeg,
71
+ currentTime,
72
+ clockRate,
73
+ foregroundOpacity,
74
+ backgroundImageset,
75
+ foregroundImageset,
76
+ } = storeToRefs (props .store );
77
+
71
78
const cssVars = computed (() => {
72
79
return {
73
80
" --hud-top" : props .location .top ?? " auto" ,
Original file line number Diff line number Diff line change 1
1
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome" ;
2
2
import { CircleMarkerOptions , TileLayerOptions } from "leaflet" ;
3
+ import { engineStore } from "@wwtelescope/engine-pinia" ;
4
+
5
+ export type WWTEngineStore = ReturnType < typeof engineStore > ;
3
6
4
7
/* Funding acknowledgement */
5
8
@@ -142,4 +145,5 @@ export interface WwtHUDProps {
142
145
fontSize ?: string ;
143
146
backgroundColor ?: string | null ;
144
147
textShadow ?: string | null ;
148
+ store : ReturnType < typeof engineStore > ;
145
149
}
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ module.exports = defineConfig({
32
32
'commonjs2' : '@wwtelescope/engine' , // typeof exports === 'object' && typeof module === 'object'
33
33
'commonjs' : '@wwtelescope/engine' , // typeof exports === 'object'
34
34
'root' : 'wwtlib' // none of the above: browser mode using global variables
35
- }
35
+ } ,
36
+ pinia : 'pinia' ,
36
37
} ) ;
37
38
38
39
} ,
You can’t perform that action at this time.
0 commit comments