mirror of
https://github.com/google/blockly.git
synced 2026-01-14 20:37:10 +01:00
[WIP] Merge field.js and flyout.js
This commit is contained in:
@@ -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.
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user