From 081574babe4c7887cf13cc136caf21973911d969 Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Wed, 28 Sep 2016 20:51:17 -0400 Subject: [PATCH] [WIP] Merge field.js and flyout.js --- core/field.js.rej | 37 ------------------------------------- core/flyout.js | 4 ++-- core/flyout.js.rej | 17 ----------------- 3 files changed, 2 insertions(+), 56 deletions(-) delete mode 100644 core/field.js.rej delete mode 100644 core/flyout.js.rej diff --git a/core/field.js.rej b/core/field.js.rej deleted file mode 100644 index 9371818a1..000000000 --- a/core/field.js.rej +++ /dev/null @@ -1,37 +0,0 @@ -*************** -*** 87,93 **** - } - this.sourceBlock_ = block; - this.updateEditable(); - block.getSvgRoot().appendChild(this.fieldGroup_); - this.mouseUpWrapper_ = - Blockly.bindEvent_(this.fieldGroup_, 'mouseup', this, this.onMouseUp_); - // Bump to set the colours for dropdown arrows. ---- 87,113 ---- - } - this.sourceBlock_ = block; - this.updateEditable(); -+ -+ // [lyn, 10/25/13] Handle the special case where adding a title to a collapsed block. -+ // This can happen if a mutator is forced open on a procedure declaration, which happens -+ // in the current AI implementation in Blockly.FieldProcedure.onChange and -+ // in Blockly.Language.procedures_callnoreturn.setProcedureParameters. -+ // Then when the mutator is closed, the compose method of a procedure declaration -+ // is called, and this can invoke the declarations updateParams_ method, which -+ // makes new title elements for the declaration (even a collapsed one). -+ // -+ // Note: even with this "fix", can still see a few white pixels added to top of -+ // collapsed procedure decl when svg is added. I can't explain why. -+ // So it's even better to avoid adding titles to collapsed blocks in the first place! -+ // E.g., I modified proc decl compose method to avoid calling updateParams_ -+ // if arg names haven't changed from before. -+ // if (block.collapsed) { -+ // // this.fieldGroup_.style.display = 'none'; -+ // this.getRootElement().style.display = 'none'; -+ // } -+ - block.getSvgRoot().appendChild(this.fieldGroup_); -+ - this.mouseUpWrapper_ = - Blockly.bindEvent_(this.fieldGroup_, 'mouseup', this, this.onMouseUp_); - // Bump to set the colours for dropdown arrows. diff --git a/core/flyout.js b/core/flyout.js index c11726562..0cb557b0b 100644 --- a/core/flyout.js +++ b/core/flyout.js @@ -207,14 +207,14 @@ Blockly.Flyout.prototype.MARGIN = Blockly.Flyout.prototype.CORNER_RADIUS; * element. * @const {number} */ -Blockly.Flyout.prototype.GAP_X = Blockly.Flyout.prototype.MARGIN * 3; +Blockly.Flyout.prototype.GAP_X = Blockly.Flyout.prototype.MARGIN * Blockly.Flyout.prototype.VERTICAL_SEPARATION_FACTOR; /** * Gap between items in vertical flyouts. Can be overridden with the "sep" * element. * @const {number} */ -Blockly.Flyout.prototype.GAP_Y = Blockly.Flyout.prototype.MARGIN * 3; +Blockly.Flyout.prototype.GAP_Y = Blockly.Flyout.prototype.MARGIN * Blockly.Flyout.prototype.VERTICAL_SEPARATION_FACTOR; /** * Top/bottom padding between scrollbar and edge of flyout background. diff --git a/core/flyout.js.rej b/core/flyout.js.rej deleted file mode 100644 index fcb010f80..000000000 --- a/core/flyout.js.rej +++ /dev/null @@ -1,17 +0,0 @@ -*************** -*** 304,310 **** - var block = Blockly.Xml.domToBlock( - /** @type {!Blockly.Workspace} */ (this.workspace_), xml); - blocks.push(block); -- gaps.push(margin * 3); - } - } - } ---- 318,324 ---- - var block = Blockly.Xml.domToBlock( - /** @type {!Blockly.Workspace} */ (this.workspace_), xml); - blocks.push(block); -+ gaps.push(margin * this.VERTICAL_SEPARATION_FACTOR); // [lyn, 10/06/13] introduced VERTICAL_SEPARATION_FACTOR - } - } - }