Skip to content

Commit

Permalink
Add a full screen dialog button on the titlebar.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-wu committed Jun 10, 2019
1 parent 9a135a7 commit 7d10680
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/styles/dialog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.displayNone {
display: none;
}

.ui-dialog .ui-dialog-titlebar {
padding: .1em 1em;
}

#iconExpand{
cursor: pointer;
float: right;
margin-right:15px;
margin-top: 3px;
transform: scale(1.5, 1.5);
}
33 changes: 32 additions & 1 deletion src/ui/BaseDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ BaseDialog.prototype.getContainment = function() {
return this.containment;
}

BaseDialog.prototype.openFullscreen = function() {
return function() {
var elem = container[0];
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) { /* Firefox */
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) { /* IE/Edge */
elem.msRequestFullscreen();
}
}
}

BaseDialog.prototype.create = function(htmlData) {
this.container = $('<div></div>');
this.container.attr('title', this.title);
Expand All @@ -126,7 +141,23 @@ BaseDialog.prototype.create = function(htmlData) {
},
resizeStop: this.resizeStopCallback(this),
beforeClose: this.beforeClose(this),
close: this.close(this)
close: this.close(this),
create: function(event, ui) {
var myInstance = this;
$('<span id="iconExpand" class="ui-icon ui-icon-arrow-2-ne-sw"></span>').
appendTo($(this).dialog('widget').children('.ui-dialog-titlebar')).
click(function() {
if (myInstance.requestFullscreen) {
myInstance.requestFullscreen();
} else if (myInstance.mozRequestFullScreen) { /* Firefox */
myInstance.mozRequestFullScreen();
} else if (myInstance.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
myInstance.webkitRequestFullscreen();
} else if (myInstance.msRequestFullscreen) { /* IE/Edge */
myInstance.msRequestFullscreen();
}
});
}
});
this.container.parent().draggable({
containment: this.containment
Expand Down

0 comments on commit 7d10680

Please sign in to comment.