Make sure the moving works when the width/height are auto
This commit is contained in:
parent
e594b6beb0
commit
9ea2eebdd9
1 changed files with 6 additions and 3 deletions
|
|
@ -94,9 +94,13 @@ export class PopoverEventManager {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// When the frameless is already rendered, we should just move it to the
|
||||||
|
// new location instead of spawning a new one
|
||||||
if (this.#frameless?.rendered) {
|
if (this.#frameless?.rendered) {
|
||||||
const { width, height } = this.#frameless.position;
|
const { width, height } = this.#frameless.element.getBoundingClientRect();
|
||||||
this.#frameless.render({ position: { left: x - Math.floor(width / 2), top: y - height }});
|
const top = y - height;
|
||||||
|
const left = x - Math.floor(width / 2);
|
||||||
|
this.#frameless.setPosition({ left, top });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +130,6 @@ export class PopoverEventManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
#pointerUpHandler(event) {
|
#pointerUpHandler(event) {
|
||||||
Logger.debug(event);
|
|
||||||
if (event.button !== 1 || !this.#frameless?.rendered || Tour.tourInProgress) { return };
|
if (event.button !== 1 || !this.#frameless?.rendered || Tour.tourInProgress) { return };
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.#frameless.toggleLock();
|
this.#frameless.toggleLock();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue