WIP Позиционирование descriptionCard сверху-снизу

This commit is contained in:
Daria Golova
2022-11-18 16:17:41 +03:00
parent c8fc1b944a
commit 021e954538
2 changed files with 5 additions and 17 deletions

View File

@@ -69,7 +69,7 @@ export default {
selectedEvent: {}, selectedEvent: {},
showModal: false, showModal: false,
timeInformation: { timeInformation: {
dayStartTime: "00:00", dayStartTime: "08:00",
dayEndTime: "20:00", dayEndTime: "20:00",
}, },
eventsData: [], eventsData: [],

View File

@@ -122,25 +122,13 @@ export default {
const cardRect = this.$refs.descriptionCard.getBoundingClientRect(); const cardRect = this.$refs.descriptionCard.getBoundingClientRect();
const bodyRect = this.scheduleBodyRef.getBoundingClientRect(); const bodyRect = this.scheduleBodyRef.getBoundingClientRect();
const bodyHeight = this.scheduleBodyRef.clientHeight + bodyRect.y - 20; const bodyHeight = this.scheduleBodyRef.clientHeight + bodyRect.y - 20;
const bodyWidth = this.scheduleBodyRef.clientWidth; if (cardRect.y + cardRect.height > bodyHeight) {
console.log(cardRect.x, cardRect.width, bodyWidth);
if (cardRect.x + 2 * cardRect.width < bodyWidth) {
this.position = { this.position = {
top: 0, top: `-${cardRect.height + 8}px`,
right: `-${cardRect.width + 8}px`,
};
} else if (cardRect.x - 84 > bodyRect.x) {
this.position = {
top: 0,
left: `-${cardRect.width + 8}px`,
};
} else if (cardRect.y + cardRect.height < bodyHeight) {
this.position = {
"margin-top": "8px",
}; };
} else } else
this.position = { this.position = {
top: `-${cardRect.height + 8}px`, "margin-top": "8px",
}; };
}, },
}; };
@@ -148,7 +136,7 @@ export default {
<style lang="sass" scoped> <style lang="sass" scoped>
.wrapper .wrapper
width: 100% !important width: 426px !important
height: auto !important height: auto !important
background-color: var(--default-white) background-color: var(--default-white)
color: var(--font-dark-blue-color) color: var(--font-dark-blue-color)