mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
Add comments; scroll to start for always open flyout
This commit is contained in:
@@ -872,8 +872,8 @@ Blockly.Flyout.prototype.placeNewBlock_ = function(originBlock) {
|
||||
var scale = this.workspace_.scale;
|
||||
xyOld.x += scrollX / scale - scrollX;
|
||||
// If the flyout is on the right side, (0, 0) in the flyout is offset to
|
||||
// the right of (0, 0) in the main workspace. Offset to take that into
|
||||
// account.
|
||||
// the right of (0, 0) in the main workspace. Add an offset to take that
|
||||
// into account.
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT) {
|
||||
scrollX = targetWorkspace.getMetrics().viewWidth - this.width_;
|
||||
scale = targetWorkspace.scale;
|
||||
@@ -889,7 +889,7 @@ Blockly.Flyout.prototype.placeNewBlock_ = function(originBlock) {
|
||||
scale = this.workspace_.scale;
|
||||
xyOld.y += scrollY / scale - scrollY;
|
||||
// If the flyout is on the bottom, (0, 0) in the flyout is offset to be below
|
||||
// (0, 0) in the main workspace. Offset to take that into account.
|
||||
// (0, 0) in the main workspace. Add an offset to take that into account.
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM) {
|
||||
scrollY = targetWorkspace.getMetrics().viewHeight - this.height_;
|
||||
scale = targetWorkspace.scale;
|
||||
|
||||
@@ -278,6 +278,7 @@ Blockly.init_ = function(mainWorkspace) {
|
||||
// Build a fixed flyout with the root blocks.
|
||||
mainWorkspace.flyout_.init(mainWorkspace);
|
||||
mainWorkspace.flyout_.show(options.languageTree.childNodes);
|
||||
mainWorkspace.flyout_.scrollToStart();
|
||||
// Translate the workspace sideways to avoid the fixed flyout.
|
||||
mainWorkspace.scrollX = mainWorkspace.flyout_.width_;
|
||||
if (options.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) {
|
||||
|
||||
@@ -153,6 +153,11 @@ h1 {
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="logic_operation"></block>
|
||||
<block type="logic_negate"></block>
|
||||
<block type="logic_boolean"></block>
|
||||
<block type="logic_null" disabled="true"></block>
|
||||
<block type="logic_ternary"></block>
|
||||
</xml>
|
||||
|
||||
<xml id="toolbox_categoriesScroll" style="display: none">
|
||||
|
||||
Reference in New Issue
Block a user