Skip to content

Commit

Permalink
Fixed Settings modal offset on click-drag ↞ [auto-sync from `adamlui/…
Browse files Browse the repository at this point in the history
…chatgpt-apps/duckduckgpt`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Sep 7, 2024
1 parent 72f15fa commit abb98c1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions chatgpt/duckduckgpt/duckduckgpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2024.9.6
// @version 2024.9.6.1
// @license MIT
// @icon https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png?af89302
// @icon64 https://media.ddgpt.com/images/icons/duckduckgpt/icon64.png?af89302
Expand Down Expand Up @@ -606,9 +606,10 @@
modals.dragHandlers.draggableElem = event.currentTarget
event.preventDefault(); // prevent sub-elems like icons being draggable
['mousemove', 'mouseup'].forEach(event => document.addEventListener(event, modals.dragHandlers[event]))
const draggableElemRect = modals.dragHandlers.draggableElem.getBoundingClientRect()
modals.dragHandlers.offsetX = event.clientX - draggableElemRect.left +21
modals.dragHandlers.offsetY = event.clientY - draggableElemRect.top +12
const draggableElemRect = modals.dragHandlers.draggableElem.getBoundingClientRect(),
targetModalIsSettings = event.currentTarget.closest('[id*="-settings"]')
modals.dragHandlers.offsetX = event.clientX - draggableElemRect.left + ( targetModalIsSettings ? 0 : 21 )
modals.dragHandlers.offsetY = event.clientY - draggableElemRect.top + ( targetModalIsSettings ? 0 : 12 )
},

mousemove(event) { // drag modal
Expand Down

0 comments on commit abb98c1

Please sign in to comment.