fix(bundle): mirror source fixes in embedded userscript
This commit is contained in:
@@ -356,6 +356,7 @@
|
|||||||
else { this.root.style.top = '20px'; this.root.style.left = '50%'; this.root.style.transform = 'translateX(-50%)'; }
|
else { this.root.style.top = '20px'; this.root.style.left = '50%'; this.root.style.transform = 'translateX(-50%)'; }
|
||||||
}
|
}
|
||||||
_positionAnchored(rect) {
|
_positionAnchored(rect) {
|
||||||
|
if (!rect) return; // defensive: setMode may be called without a rect
|
||||||
const dialogRect = this.root.getBoundingClientRect();
|
const dialogRect = this.root.getBoundingClientRect();
|
||||||
let top = rect.top - dialogRect.height - 8;
|
let top = rect.top - dialogRect.height - 8;
|
||||||
if (top < 8) top = 20;
|
if (top < 8) top = 20;
|
||||||
@@ -516,8 +517,7 @@
|
|||||||
const el = findAnchorElement();
|
const el = findAnchorElement();
|
||||||
if (el) {
|
if (el) {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
dialog.setMode('anchored', { canAnchor: true });
|
dialog.setMode('anchored', { canAnchor: true, rect: rect });
|
||||||
dialog._positionAnchored(rect);
|
|
||||||
if (typeof ResizeObserver !== 'undefined') {
|
if (typeof ResizeObserver !== 'undefined') {
|
||||||
const ro = new ResizeObserver(function () {
|
const ro = new ResizeObserver(function () {
|
||||||
if (prefs.mode === 'anchored') dialog._positionAnchored(el.getBoundingClientRect());
|
if (prefs.mode === 'anchored') dialog._positionAnchored(el.getBoundingClientRect());
|
||||||
|
|||||||
Reference in New Issue
Block a user