Skip to content

Commit 7f4835e

Browse files
committed
wip: Create a style editor #1073
wip: Create a style manager #1072
1 parent 86a349d commit 7f4835e

7 files changed

+66
-64
lines changed

map/client/components/styles/KStyleEditor.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<!-- Point editor -->
2020
<KStyleEditorSection
2121
v-if="canEditPoint"
22-
title="KStyleEditor.SECTION_TITLE_POINT"
22+
label="KStyleEditor.POINT_SECTION"
2323
:style="style"
2424
type="point"
2525
:dense="dense"
@@ -30,22 +30,22 @@
3030
<KStyleProperty v-model="style.point.shape" :name="$t('KStyleEditor.SHAPE')" type="shape" :dense="dense" />
3131
<KStylePropertiesGroup
3232
v-if="!is3D"
33+
label="KStyleEditor.ICON_GROUP"
3334
v-model="style.point.icon"
34-
label="icon"
3535
:properties="pointIconProperties"
3636
:dense="dense"
3737
/>
3838
<KStylePropertiesGroup
39+
label="KStyleEditor.STROKE_GROUP"
3940
v-model="style.point.stroke"
40-
label="stroke"
4141
:properties="pointStrokeProperties"
4242
:dense="dense"
4343
/>
4444
</KStyleEditorSection>
4545
<!-- Line editor -->
4646
<KStyleEditorSection
4747
v-if="canEditLine"
48-
title="KStyleEditor.SECTION_TITLE_LINE"
48+
label="KStyleEditor.LINE_SECTION"
4949
:style="style"
5050
type="line"
5151
:dense="dense"
@@ -57,16 +57,16 @@
5757
<!-- Polygon editor -->
5858
<KStyleEditorSection
5959
v-if="canEditPolygon"
60-
title="KStyleEditor.SECTION_TITLE_POLYGON"
60+
label="KStyleEditor.POLYGON_SECTION"
6161
:style="style"
6262
type="polygon"
6363
:dense="dense"
6464
>
6565
<KStyleProperty v-model="style.polygon.color" :name="$t('KStyleEditor.FILL_COLOR')" type="color" :dense="dense" />
6666
<KStyleProperty v-model="style.polygon.opacity" :name="$t('KStyleEditor.FILL_OPACITY')" type="opacity" :dense="dense" />
6767
<KStylePropertiesGroup
68+
label="KStyleEditor.STROKE_GROUP"
6869
v-model="style.polygon.stroke"
69-
label="stroke"
7070
:properties="polygonStrokeProperties"
7171
:dense="dense"
7272
/>
@@ -172,7 +172,7 @@ const pointStrokeProperties = computed(() => {
172172
})
173173
const pointIconProperties = computed(() => {
174174
return [
175-
{ name: 'classes', label: 'KStyleEditor.ICON', type: 'color', default: defaultStyle.value.point.icon.classes },
175+
{ name: 'classes', label: 'KStyleEditor.ICON', type: 'icon', default: defaultStyle.value.point.icon.classes },
176176
{ name: 'size', label: 'KStyleEditor.ICON_SIZE', type: 'size', min: 8, max: 48, default: defaultStyle.value.point.icon.size }
177177
]
178178
})

map/client/components/styles/KStyleEditorSection.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
:dense="dense"
88
>
99
<template v-slot:header>
10-
<q-item-section v-if="title">
11-
{{ $t(title) }}
10+
<q-item-section v-if="label">
11+
{{ $t(label) }}
1212
</q-item-section>
1313
<q-item-section v-if="!isOpened" side>
1414
<KStylePreview :style="style[type]" :type="type" />
@@ -39,7 +39,7 @@ import KStyleTip from './KStyleTip.vue'
3939
4040
// Props
4141
defineProps({
42-
title: {
42+
label: {
4343
type: String,
4444
required: true
4545
},

map/client/components/styles/KStyleManager.vue

+3-4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ const { getSelectedFeaturesByLayer, CurrentActivity, CurrentActivityContext } =
101101
const styleEditor = ref(null)
102102
const style = ref(null)
103103
const viewMode = ref('list')
104+
const defaultStyle = _.pick(_.get(CurrentActivityContext.config, 'engine.style'), ['point', 'line', 'polygon'])
105+
106+
console.log(defaultStyle)
104107
105108
// Computed
106109
const baseQuery = computed(() => {
@@ -109,10 +112,6 @@ const baseQuery = computed(() => {
109112
const filterQuery = computed(() => {
110113
return Object.assign({}, Filter.get().query)
111114
})
112-
const defaultStyle = computed(() => {
113-
const style = _.get(CurrentActivityContext.config, 'engine.style')
114-
return _.pick(style, ['point', 'line', 'polygon'])
115-
})
116115
const toolbar = computed(() => {
117116
if (viewMode.value === 'editor') return []
118117
return [

map/client/components/styles/KStylePropertiesGroup.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="full-width row items-center no-wrap">
44
<q-toggle
55
v-model="isActive"
6-
:label="label"
6+
:label="$t(label)"
77
size="sm"
88
:dense="dense"
99
@update:model-value="onToggled"

map/client/components/styles/KStyleTip.vue

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ watch(() => props.modelValue, (value) => {
108108
showTip.value = value
109109
}, { immediate: true })
110110
watch(() => props.style, (value) => {
111-
console.log(props.style)
112111
location.value = refresh()
113112
}, { immediate: true, deep: true })
114113

map/client/i18n/map_en.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,11 @@
763763
"KStyleEditor": {
764764
"NAME_LABEL": "Enter the name of the style",
765765
"STYLE_ALREADY_EXISTS": "Style {style} already exists !",
766-
"SECTION_TITLE_POINT": "Point",
767-
"SECTION_TITLE_LINE": "Line",
768-
"SECTION_TITLE_POLYGON": "Polygon",
766+
"POINT_SECTION": "Point",
767+
"LINE_SECTION": "Line",
768+
"POLYGON_SECTION": "Polygon",
769+
"STROKE_GROUP": "Stroke",
770+
"ICON_GROUP": "Icon",
769771
"COLOR": "Color",
770772
"FILL_COLOR": "Fill color",
771773
"OPACITY": "Opacity",

0 commit comments

Comments
 (0)