Skip to content

Commit

Permalink
Merge pull request #983 from geoadmin/bug-look-and-feel
Browse files Browse the repository at this point in the history
Put drawing style edit popover in a more optimal position - #patch
  • Loading branch information
ltshb authored Jul 8, 2024
2 parents 2208080 + a10f744 commit e9f1f3d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/modules/drawing/components/DrawingToolbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function onDeleteLastPoint() {
<div :class="[{ 'drawing-toolbox-closed': !drawMenuOpen }, 'drawing-toolbox']">
<div
class="card text-center drawing-toolbox-content shadow-lg rounded-bottom rounded-top-0 rounded-start-0"
:class="{ 'rounded-bottom-0': isPhoneMode }"
>
<div class="card-body position-relative container">
<div
Expand Down Expand Up @@ -183,7 +184,7 @@ function onDeleteLastPoint() {
@click="drawMenuOpen = !drawMenuOpen"
>
<FontAwesomeIcon :icon="drawMenuOpen ? 'caret-up' : 'caret-down'" />
<span class="ms-1">{{ $t(drawMenuOpen ? 'close_menu' : 'open_menu') }}</span>
<span class="ms-2">{{ $t(drawMenuOpen ? 'close_menu' : 'open_menu') }}</span>
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
:class="{ 'transparent-bottom': !showAllSymbols }"
>
<div
class="rounded d-flex align-content-center p-2"
class="rounded d-flex align-items-center p-2"
data-cy="drawing-style-toggle-all-icons-button"
@click="showAllSymbols = !showAllSymbols"
>
{{ $t('modify_icon_label') }}
&nbsp;
<font-awesome-icon :icon="['fas', showAllSymbols ? 'caret-down' : 'caret-right']" />
<div>{{ $t('modify_icon_label') }}</div>
<font-awesome-icon
:icon="['fas', showAllSymbols ? 'caret-down' : 'caret-right']"
class="ms-2"
/>
</div>
<div class="marker-icon-select-box" :class="{ 'one-line': !showAllSymbols }">
<button
Expand Down Expand Up @@ -196,7 +198,7 @@ export default {
}
}
.marker-icon-select-box {
max-height: 15rem;
max-height: 10rem;
overflow-y: scroll;
&.one-line {
max-height: 2rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,22 @@ export default {
type: String,
default: null,
},
placement: {
type: String,
default: 'auto',
},
},
watch: {
placement(newValue) {
this.popover.setProps({ placement: newValue })
},
},
mounted() {
this.popover = tippy(this.$refs.popoverButton, {
theme: 'popover-button light-border',
content: this.$refs.popoverContent,
allowHTML: true,
placement: 'top',
placement: this.placement,
interactive: true,
arrow: true,
trigger: 'click',
Expand Down
16 changes: 9 additions & 7 deletions src/modules/infobox/components/styling/FeatureStyleEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const coordinateFormat = computed(() => {
const isFeatureMarker = computed(() => feature.value.featureType === EditableFeatureTypes.MARKER)
const isFeatureText = computed(() => feature.value.featureType === EditableFeatureTypes.ANNOTATION)
const isFeatureLine = computed(() => feature.value.featureType === EditableFeatureTypes.LINEPOLYGON)
const showInBottomPanel = computed(() => store.getters.showFeatureInfoInBottomPanel)
const store = useStore()
const availableIconSets = computed(() => store.state.drawing.iconSets)
Expand Down Expand Up @@ -189,10 +190,10 @@ function mediaTypes() {
</div>
<div v-if="!isFeatureText" class="form-group mb-2">
<label class="form-label" for="drawing-style-feature-description">
{{ $t('modify_description') }}
</label>
<div>
<div class="d-flex justify-content-between">
<label class="form-label" for="drawing-style-feature-description">
{{ $t('modify_description') }}
</label>
<div class="d-flex justify-content-end align-items-center">
<div v-for="(media, index) in mediaTypes()" :key="media.type">
<DrawingStylePopoverButton
Expand All @@ -212,6 +213,8 @@ function mediaTypes() {
</DrawingStylePopoverButton>
</div>
</div>
</div>
<div>
<textarea
id="drawing-style-feature-description"
v-model="description"
Expand All @@ -221,6 +224,7 @@ function mediaTypes() {
:class="{
'form-control-plaintext': readOnly,
}"
rows="2"
></textarea>
</div>
</div>
Expand Down Expand Up @@ -262,6 +266,7 @@ function mediaTypes() {
v-if="isFeatureMarker"
data-cy="drawing-style-marker-button"
icon="fas fa-map-marker-alt"
:placement="showInBottomPanel ? 'top' : 'auto'"
>
<DrawingStyleIconSelector
data-cy="drawing-style-marker-popup"
Expand Down Expand Up @@ -302,7 +307,4 @@ function mediaTypes() {
.feature-title {
height: 1rem;
}
.feature-description {
height: 2rem;
}
</style>
2 changes: 1 addition & 1 deletion src/modules/map/components/MapPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function onClose() {
@click="showContent = !showContent"
@mousedown.stop=""
>
<FontAwesomeIcon :icon="`caret-${showContent ? 'down' : 'right'}`" />
<FontAwesomeIcon :icon="`caret-${showContent ? 'up' : 'down'}`" />
</button>
<button
class="btn btn-sm btn-light d-flex align-items-center"
Expand Down
2 changes: 1 addition & 1 deletion src/utils/components/SimpleWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const emit = defineEmits(['close'])
<span v-if="title" class="me-auto text-truncate">{{ i18n.t(title) }}</span>
<span v-else class="me-auto" />
<button class="btn btn-light btn-sm me-2" @click.stop="showBody = !showBody">
<FontAwesomeIcon :icon="`caret-${showBody ? 'down' : 'right'}`" />
<FontAwesomeIcon :icon="`caret-${showBody ? 'up' : 'down'}`" />
</button>
<button
class="btn btn-light btn-sm"
Expand Down
1 change: 1 addition & 0 deletions tests/cypress/tests-e2e/drawing.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ describe('Drawing module tests', () => {
expect(agnosticContent).to.be.equal(agnosticMockCsv)
})
})
cy.get('[data-cy="infobox-close"]').should('be.visible').click()

// it exports KML when clicking on the export button (without choosing format)
cy.get(
Expand Down

0 comments on commit e9f1f3d

Please sign in to comment.