Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Address comments

  • Loading branch information...
commit 29e33c55fa988603ce179dc0874f6a4727b62261 1 parent 44764b4
Garen Torikian gjtorikian authored
Showing with 21 additions and 24 deletions.
  1. +21 −24 plugins-client/ext.zen/zen.js
45 plugins-client/ext.zen/zen.js
View
@@ -44,6 +44,8 @@ module.exports = ext.register("ext/zen/zen", {
handleLeftMove : false,
handleRightMove : false,
+ entered: false,
+
nodes : [],
hook : function(){
@@ -158,18 +160,22 @@ module.exports = ext.register("ext/zen/zen", {
});
ide.addEventListener("enterzen", function() {
- vbMain.parentNode.appendChild(new apf.vbox({
- anchors: "0 0 0 0",
- id: "vbZen",
- "class": "vbZen",
- visible: false
- }));
-
- vbZen.addEventListener("resize", function(e) {
- if (_self.isFocused) {
- _self.calculatePositions();
- }
- });
+ // prevent adding vbZen every time the button is clicked
+ if (!_self.entered) {
+ _self.entered = true;
+ vbMain.parentNode.appendChild(new apf.vbox({
+ anchors: "0 0 0 0",
+ id: "vbZen",
+ "class": "vbZen",
+ visible: false
+ }));
+
+ vbZen.addEventListener("resize", function(e) {
+ if (_self.isFocused) {
+ _self.calculatePositions();
+ }
+ });
+ }
});
setTimeout(function() {
@@ -552,29 +558,20 @@ module.exports = ext.register("ext/zen/zen", {
enable : function(){
btnZenFullscreen.show();
- this.nodes.each(function(item){
- item.enable();
- });
+ this.$enable();
},
disable : function(){
if (this.isFocused)
this.escapeFromZenMode(false, false);
btnZenFullscreen.hide();
- this.nodes.each(function(item){
- item.disable();
- });
+ this.$disable();
},
destroy : function(){
menus.remove("View/Zen");
-
commands.removeCommandsByName(["zen", "zenslow"]);
-
- this.nodes.each(function(item){
- item.destroy(true, true);
- });
- this.nodes = [];
+ this.$destroy();
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.