@@ -4,6 +4,7 @@ import { computed, nextTick, ref, watch } from 'vue'
4
4
import { useStore } from ' vuex'
5
5
6
6
import { EditableFeatureTypes } from ' @/api/features/EditableFeature.class'
7
+ import { FeatureInfoPositions } from ' @/store/modules/ui.store'
7
8
import promptUserToPrintHtmlContent from ' @/utils/print'
8
9
9
10
import FeatureCombo from ' ./components/FeatureCombo.vue'
@@ -17,55 +18,47 @@ const content = ref(null)
17
18
const store = useStore ()
18
19
19
20
const selectedFeatures = computed (() => store .state .features .selectedFeatures )
20
- const floatingTooltip = computed (() => store .state .ui .floatingTooltip )
21
+ const bottomPanelFeatureInfo = computed (() => store .getters .bottomPanelFeatureInfo )
22
+ const tooltipFeatureInfo = computed (() => store .getters .tooltipFeatureInfo )
21
23
const showDrawingOverlay = computed (() => store .state .ui .showDrawingOverlay )
22
24
const projection = computed (() => store .state .position .projection )
23
25
24
26
const selectedFeature = computed (() => selectedFeatures .value [0 ])
25
27
26
- const isEdit = computed (() => ! floatingTooltip .value && selectedFeature .value ? .isEditable )
27
- const isList = computed (
28
- () => ! floatingTooltip .value && ! isEdit .value && selectedFeatures .value .length > 0
29
- )
30
- const showElevationProfile = computed (
31
- () =>
32
- selectedFeature .value &&
33
- (selectedFeature .value .featureType === EditableFeatureTypes .MEASURE ||
34
- (selectedFeature .value .featureType === EditableFeatureTypes .LINEPOLYGON &&
35
- floatingTooltip .value ))
36
- )
37
- const isCombo = computed (
38
- () =>
39
- isEdit .value &&
40
- [EditableFeatureTypes .LINEPOLYGON , EditableFeatureTypes .MEASURE ].includes (
41
- selectedFeature .value .featureType
42
- )
43
- )
44
- const showContainer = computed (
45
- () => isList .value || isEdit .value || showElevationProfile .value || isCombo .value
46
- )
47
- const showFloatingToggle = computed (
48
- () =>
49
- isList .value ||
50
- (isEdit .value && ! showElevationProfile .value ) ||
51
- (isCombo .value && ! floatingTooltip .value )
28
+ const isEdit = computed (() => selectedFeature .value ? .isEditable )
29
+
30
+ const showElevationProfile = computed (() =>
31
+ [EditableFeatureTypes .LINEPOLYGON , EditableFeatureTypes .MEASURE ].includes (
32
+ selectedFeature .value ? .featureType
33
+ )
52
34
)
53
35
36
+ const showContainer = computed (() => {
37
+ return (
38
+ selectedFeatures .value .length > 0 &&
39
+ (bottomPanelFeatureInfo .value || (showElevationProfile .value && tooltipFeatureInfo .value ))
40
+ )
41
+ })
42
+ const showTooltipToggle = computed (() => bottomPanelFeatureInfo .value )
43
+
54
44
watch (selectedFeatures, (features ) => {
55
45
if (features .length === 0 ) {
56
46
return
57
47
}
58
48
showContent .value = true
59
49
nextTick (() => {
60
- content .value .scrollTo (0 , 0 )
50
+ content .value ? .scrollTo (0 , 0 )
61
51
})
62
52
})
63
53
64
54
function onToggleContent () {
65
55
showContent .value = ! showContent .value
66
56
}
67
- function onToggleFloating () {
68
- store .dispatch (' toggleFloatingTooltip' , dispatcher)
57
+ function setTooltipInfoPosition () {
58
+ store .dispatch (' setFeatureInfoPosition' , {
59
+ featureInfo: FeatureInfoPositions .TOOLTIP ,
60
+ ... dispatcher,
61
+ })
69
62
}
70
63
function onPrint () {
71
64
promptUserToPrintHtmlContent (content .value )
@@ -76,13 +69,13 @@ function onClose() {
76
69
< / script>
77
70
78
71
< template>
79
- < div v- show = " showContainer" class = " infobox card rounded-0" data- cy= " infobox" @contextmenu .stop >
72
+ < div v- if = " showContainer" class = " infobox card rounded-0" data- cy= " infobox" @contextmenu .stop >
80
73
< div class = " infobox-header card-header d-flex justify-content-end" data- cy= " infobox-header" >
81
74
< button
82
- v- if = " showFloatingToggle "
75
+ v- if = " showTooltipToggle "
83
76
class = " btn btn-light btn-sm d-flex align-items-center"
84
77
data- cy= " infobox-toggle-floating"
85
- @click .stop = " onToggleFloating "
78
+ @click .stop = " setTooltipInfoPosition "
86
79
>
87
80
< FontAwesomeIcon icon= " caret-up" / >
88
81
< / button>
@@ -108,15 +101,15 @@ function onClose() {
108
101
109
102
< div v- show= " showContent" ref= " content" class = " infobox-content" data- cy= " infobox-content" >
110
103
< FeatureElevationProfile
111
- v- if = " showElevationProfile && !isCombo "
104
+ v- if = " showElevationProfile && tooltipFeatureInfo "
112
105
class = " card-body"
113
106
: feature= " selectedFeature"
114
107
: read- only= " !showDrawingOverlay"
115
108
: projection= " projection"
116
109
/ >
117
110
118
111
< FeatureCombo
119
- v- else - if = " isCombo "
112
+ v- else - if = " showElevationProfile "
120
113
class = " card-body"
121
114
: feature= " selectedFeature"
122
115
: read- only= " !showDrawingOverlay"
@@ -129,7 +122,7 @@ function onClose() {
129
122
: read- only= " !showDrawingOverlay"
130
123
/ >
131
124
132
- < FeatureList v- else - if = " isList " / >
125
+ < FeatureList v- else / >
133
126
< / div>
134
127
< / div>
135
128
< / template>
0 commit comments