Skip to content

Commit

Permalink
fix(ui): improve network graph popup visibility (#3896)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando authored Sep 16, 2024
1 parent b3df21c commit ca84d51
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/views/Mesh.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
max-height: 80vh;
overflow-y: scroll;
overflow-x: hidden;
cursor: move;
}
.details::-webkit-scrollbar {
Expand Down Expand Up @@ -113,6 +114,23 @@ export default {
},
methods: {
...mapActions(useBaseStore, ['showSnackbar', 'setNeighbors']),
setInitialPosition(element) {
const windowHeight = window.innerHeight
const windowWidth = window.innerWidth
const popupHeight = element.offsetHeight
const popupWidth = element.offsetWidth
// Set initial position (e.g., center of the window)
let initialTop = (windowHeight - popupHeight) / 2 - 50
let initialLeft = (windowWidth - popupWidth) / 10
if (initialTop < 0) initialTop = 10
if (initialLeft < 0) initialLeft = 10
element.style.top = initialTop + 'px'
element.style.left = initialLeft + 'px'
},
makeDivDraggable() {
const elmnt = document.getElementById('properties')
Expand All @@ -127,6 +145,10 @@ export default {
elmnt.setAttribute('data-draggable', true)
setTimeout(() => {
this.setInitialPosition(elmnt)
}, 100)
let startX = 0
let startY = 0
Expand Down

0 comments on commit ca84d51

Please sign in to comment.