Skip to content

Commit fd4f069

Browse files
author
minjk-bl
committed
Fix PopupComponent to prevent top-left position of popup not to be less than 0
1 parent 7f56186 commit fd4f069

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

js/com/component/PopupComponent.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,20 @@ define([
792792
open() {
793793
vpLog.display(VP_LOG_TYPE.DEVELOP, 'open popup', this);
794794
this.loadState();
795+
795796
this.show();
797+
798+
// set popup position if its top-left side is outside of view
799+
let pos = $(this.wrapSelector()).position();
800+
if (pos) {
801+
if (pos.top < 0) {
802+
$(this.wrapSelector()).css({ top: 0 });
803+
}
804+
if (pos.left < 0) {
805+
$(this.wrapSelector()).css({ left: 0 });
806+
}
807+
}
808+
796809
this._bindCodemirror();
797810

798811
$(this.eventTarget).trigger({

0 commit comments

Comments
 (0)