Skip to content

Commit 1fc3489

Browse files
committed
wip: Provide ready-made configuration snippets to help set up the app's configuration file #1140
wip: Reorganize sticky map-based components #1085
1 parent 86d70c7 commit 1fc3489

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

extras/configs/stickies.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
module.exports = {
2-
position: (visible = false) => {
3-
return {
2+
position: (options) => {
3+
return Object.assign({
44
id: 'position-sticky',
5-
position: 'top',
5+
visible: false,
66
offset: [0, 42],
7-
component: 'stickies/KPosition',
8-
visible,
9-
}
7+
position: 'top',
8+
component: 'stickies/KPosition'
9+
}, options)
1010
},
11-
target: (visible = false) => {
12-
return {
13-
id: 'target-sticky',
14-
position: 'center',
11+
target: (options) => {
12+
return Object.assign({
13+
id: 'target-sticky',
14+
visible: false,
1515
offset: [0, -20],
16-
component: 'stickies/KTarget',
17-
visible
18-
}
16+
position: 'center',
17+
component: 'stickies/KTarget'
18+
}, options)
1919
},
20-
northArrow: (visible = true) => {
21-
return {
22-
id: 'north-arrow-sticky',
23-
position: 'bottom-left',
20+
northArrow: (options) => {
21+
return Object.assign({
22+
id: 'north-arrow-sticky',
23+
visible: true,
2424
offset: [100, 2],
25-
component: 'stickies/KNorthArrow',
26-
visible
27-
}
25+
position: 'bottom-left',
26+
component: 'stickies/KNorthArrow'
27+
}, options)
2828
},
29-
attribution: (visible = true) => {
30-
return {
29+
attribution: (options) => {
30+
return Object.assign({
3131
id: 'attribution-sticky',
32+
visible: true,
3233
position: 'bottom-right',
3334
offset: [80, 24],
34-
component: 'stickies/KAttribution',
35-
visible
36-
}
35+
component: 'stickies/KAttribution'
36+
}, options)
3737
}
3838
}

map/client/components/stickies/KPosition.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async function onClose () {
7272
7373
onMounted(() => {
7474
// Show target sticky
75-
if (!_.isEmpty(props.target)) Layout.showSticky(props.target)
75+
if (!_.isEmpty(props.targetId)) Layout.showSticky(props.targetId)
7676
// Listen move events
7777
if (CurrentActivity.value) {
7878
CurrentActivity.value.$engineEvents.on('movestart', updatePosition)
@@ -84,7 +84,7 @@ onMounted(() => {
8484
})
8585
// Hooks
8686
onBeforeUnmount(() => {
87-
if (!_.isEmpty(props.target)) Layout.hideSticky(props.target)
87+
if (!_.isEmpty(props.targetId)) Layout.hideSticky(props.targetId)
8888
// Stop listening move events
8989
if (CurrentActivity.value) {
9090
CurrentActivity.value.$engineEvents.off('movestart', updatePosition)

0 commit comments

Comments
 (0)