mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-08-15 12:15:37 +08:00
feat: dynamic max-height and width (#1)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export function setElementPositionInViewport(element, x = 0, y = 0) {
|
||||
const retX = Math.min(window.innerWidth - element.offsetWidth, Math.max(0, x))
|
||||
const retY = Math.min(window.innerHeight - element.offsetHeight, Math.max(0, y))
|
||||
const retX = Math.min(Math.max(0, window.innerWidth - element.offsetWidth), Math.max(0, x))
|
||||
const retY = Math.min(Math.max(0, window.innerHeight - element.offsetHeight), Math.max(0, y))
|
||||
element.style.left = retX + 'px'
|
||||
element.style.top = retY + 'px'
|
||||
return { x: retX, y: retY }
|
||||
|
||||
Reference in New Issue
Block a user