3
3
id =" position"
4
4
class =" row items-center no-padding k-position"
5
5
>
6
- <span class =" text-caption q-pl-sm q-pr-sm" >
6
+ <span class =" text-weight-regular q-pl-sm q-pr-sm" >
7
7
{{ formattedPosition }}
8
8
</span >
9
9
<KAction
10
10
id =" copy-position"
11
11
icon =" las la-copy"
12
12
tooltip =" KPosition.COPY"
13
- size =" sm "
13
+ size =" 0.75rem "
14
14
:handler =" onCopy"
15
15
/>
16
+ <KAction
17
+ id =" close-position"
18
+ icon =" cancel"
19
+ tooltip =" KPosition.CLOSE"
20
+ size =" 0.75rem"
21
+ :handler =" onClose"
22
+ />
16
23
</div >
17
24
</template >
18
25
@@ -27,7 +34,11 @@ import KAction from '../../../../core/client/components/action/KAction.vue'
27
34
28
35
// Props
29
36
const props = defineProps ({
30
- target: {
37
+ stickyId: {
38
+ type: String ,
39
+ default: ' position-sticky'
40
+ },
41
+ targetId: {
31
42
type: String ,
32
43
default: ' target-sticky'
33
44
}
@@ -39,7 +50,7 @@ const position = ref(null)
39
50
40
51
// Computed
41
52
const formattedPosition = computed (() => {
42
- if (_ .isNil (position .value )) return i18n .t (' KPositionIndicator .OUTSIDE_MAP' )
53
+ if (_ .isNil (position .value )) return i18n .t (' KPosition .OUTSIDE_MAP' )
43
54
return formatUserCoordinates (position .value .latitude , position .value .longitude , Store .get (' locationFormat' , ' FFf' ))
44
55
})
45
56
@@ -50,15 +61,18 @@ function updatePosition () {
50
61
async function onCopy () {
51
62
try {
52
63
await copyToClipboard (formattedPosition .value )
53
- Notify .create ({ type: ' positive' , message: i18n .t (' KPositionIndicator .POSITION_COPIED' ) })
64
+ Notify .create ({ type: ' positive' , message: i18n .t (' KPosition .POSITION_COPIED' ) })
54
65
} catch (error) {
55
- Notify .create ({ type: ' negative' , message: i18n .t (' KPositionIndicator .CANNOT_COPY_POSITION' ) })
66
+ Notify .create ({ type: ' negative' , message: i18n .t (' KPosition .CANNOT_COPY_POSITION' ) })
56
67
}
57
68
}
69
+ async function onClose () {
70
+ if (! _ .isEmpty (props .stickyId )) Layout .hideSticky (props .stickyId )
71
+ }
58
72
59
73
onMounted (() => {
60
74
// Show target sticky
61
- if (props .target ) Layout .showSticky (props .target )
75
+ if (! _ . isEmpty ( props .target ) ) Layout .showSticky (props .target )
62
76
// Listen move events
63
77
if (CurrentActivity .value ) {
64
78
CurrentActivity .value .$engineEvents .on (' movestart' , updatePosition)
@@ -70,7 +84,7 @@ onMounted(() => {
70
84
})
71
85
// Hooks
72
86
onBeforeUnmount (() => {
73
- if (props .target ) Layout .hideSticky (props .target )
87
+ if (! _ . isEmpty ( props .target ) ) Layout .hideSticky (props .target )
74
88
// Stop listening move events
75
89
if (CurrentActivity .value ) {
76
90
CurrentActivity .value .$engineEvents .off (' movestart' , updatePosition)
0 commit comments