Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/windows/tracker.es6
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export const track = (options, blankWindow) => {
save_states();
});
blankWindow.on('dialogextendrestore',() => {
dialog.draggable({ containment: false })
state.position.offset = dialog.offset();
state.position.mode = 'normal';
save_states();
Expand Down
16 changes: 11 additions & 5 deletions src/windows/windows.es6
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,21 @@ export const createBlankWindow = function($html,options) {
dialog.draggable( "option", "scroll", true );
}
dialog.on('dragstop', () => {
const top = dialog.offset().top;
const left = dialog.offset().left;

if (top < 0) {
dialog.animate({ top: '0px' }, 300, dialog.trigger.bind(dialog, 'animated'));
const top = dialog.offset().top;
const left = dialog.offset().left;
const dialogWidth = blankWindow.dialog( "option", "width" );
const windowWidth = $(window).width();
const navHeight = $('#nav-menu .container').height();

if (top < navHeight + 36) {
dialog.animate({ top: `${navHeight + 36}px` }, 300, dialog.trigger.bind(dialog, 'animated'));
}
if (left < 0) {
dialog.animate({ left: '0px' }, 300, dialog.trigger.bind(dialog, 'animated'));
}
if (left + dialogWidth > windowWidth) {
dialog.animate({ left: `${windowWidth - dialogWidth - 10}px` }, 300, dialog.trigger.bind(dialog, 'animated'));
}
});

if(options.destroy) { /* register for destroy event which have been patched */
Expand Down