File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 101
101
102
102
function setAlignByMouse(e ? : MouseEvent ) {
103
103
if (! e ) return ;
104
- menuPosition = { x: e .clientX , y: e .clientY };
104
+ const clientX = horizontalAlign === ' left' ? e .clientX - contextMenuWidth : e .clientX ;
105
+ const clientY = side === ' top' ? e .clientY - contextMenuHeight : e .clientY ;
106
+
107
+ menuPosition = { x: clientX , y: clientY };
105
108
}
106
109
107
110
function setAlignByTarget(target : HTMLElement ) {
170
173
horizontalAlign = ' left' ;
171
174
setAlignment ();
172
175
}
173
- if (rect .bottom > viewport .bottom ) {
174
- side = ' top' ;
175
- setAlignment ();
176
+ if (rect .bottom > viewport .bottom && rect .top > viewport .top ) {
177
+ setTimeout (() => {
178
+ side = ' top' ;
179
+ setAlignment ();
180
+ }, 0 );
176
181
}
177
182
if (rect .top < viewport .top ) {
178
183
side = ' bottom' ;
You can’t perform that action at this time.
0 commit comments