Merge pull request #567 from SVG-Edit/issues/566
#566 When you display the context panel on the right of the screen, t…master
commit
97d52f8745
|
@ -306,8 +306,21 @@ export class SeCMenuDialog extends HTMLElement {
|
||||||
const current = this;
|
const current = this;
|
||||||
const onMenuOpenHandler = (e) => {
|
const onMenuOpenHandler = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
current.$dialog.style.top = e.pageY + 'px';
|
// Detect mouse position
|
||||||
current.$dialog.style.left = e.pageX + 'px';
|
let x = e.pageX;
|
||||||
|
let y = e.pageY;
|
||||||
|
|
||||||
|
const xOff = screen.width - 250; // menu width
|
||||||
|
const yOff = screen.height - (276 + 150); // menu height + bottom panel height and scroll bar
|
||||||
|
|
||||||
|
if (x > xOff) {
|
||||||
|
x = xOff;
|
||||||
|
}
|
||||||
|
if (y > yOff) {
|
||||||
|
y = yOff;
|
||||||
|
}
|
||||||
|
current.$dialog.style.top = y + 'px';
|
||||||
|
current.$dialog.style.left = x + 'px';
|
||||||
current.$dialog.style.display = 'block';
|
current.$dialog.style.display = 'block';
|
||||||
};
|
};
|
||||||
const onMenuCloseHandler = (e) => {
|
const onMenuCloseHandler = (e) => {
|
||||||
|
|
Loading…
Reference in New Issue