Permalink
Browse files

on fullscreen exit, automatically close the dialog

  • Loading branch information...
1 parent 226d258 commit 956607505d5f66da10c5c397b9c1027d892aff22 @dyoo committed Dec 14, 2012
Showing with 37 additions and 2 deletions.
  1. +14 −0 war-src/js/openEditor/editor.js
  2. +6 −1 war-src/js/openEditor/index.js
  3. +17 −1 war-src/js/openEditor/interaction.js
@@ -52,6 +52,8 @@ var WeSchemeEditor;
this.userName = attrs.userName; // string
this.actions = new plt.wescheme.AjaxActions();
+ this.onResize = undefined;
+
// defn is assumed to be Containers.
// The only container we've got so far are TextContainers.
this.defn = attrs.defn; // TextAreaContainer
@@ -221,6 +223,18 @@ var WeSchemeEditor;
aBooleanBehavior.changes().mapE(f);
}
+
+ WeSchemeEditor.prototype.setOnResize = function(onResize) {
+ this.onResize = onResize;
+ };
+
+
+ // Force a refresh on the size of the editor.
+ WeSchemeEditor.prototype.forceOnResize = function() {
+ this.onResize();
+ };
+
+
WeSchemeEditor.prototype.highlight = function(id, offset, line, column, span, color) {
if(id === '<no-location>'){
//do nothing
@@ -239,7 +239,7 @@ var initializeEditor;
// The display should consist of the top, the middle, and the bottom.
// The middle should expand to the size of the viewport minus the top and bottom.
- var onResize = function(e) {
+ var onResize = function() {
var viewportSize = vsm.getSize();
var desiredWidth = viewportSize.width;
@@ -316,6 +316,11 @@ var initializeEditor;
goog.events.listen(vsm,
goog.events.EventType.RESIZE,
onResize);
+ myEditor.setOnResize(onResize);
+ jQuery.bind("fullscreenchange",
+ function() {
+ onResize();
+ });
setTimeout(onResize, 0);
};
@@ -349,13 +349,29 @@ WeSchemeInteractions = (function () {
return result;
}
});
+
+ var dialog = jQuery("<div/>");
+ var onFullScreenChange = function() {
+ if (document.fullscreen || document.mozFullScreen || document.webkitIsFullScreen) {
+ // do nothing if we're full-screen.
+ } else {
+ // if we came out of fullscreen, try closing
+ if (dialog.dialog && dialog.dialog("isOpen")) {
+ dialog.dialog('close');
+ }
+ }
+ };
+ jQuery(document).bind("fullscreenchange", onFullScreenChange);
+ jQuery(document).bind("mozfullscreenchange", onFullScreenChange);
+ jQuery(document).bind("webkitfullscreenchange", onFullScreenChange);
+
that.initializeRoundRobinCompilation(
evaluator,
function() {
evaluator.makeToplevelNode = function() {
- var dialog = jQuery("<div/>");
var handleClose = function(event, ui) {
that.evaluator.requestBreak();
+ dialog.dialog("destroy");
};
dialog.dialog( {

0 comments on commit 9566075

Please sign in to comment.