mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
Fixed trashcan flyout positioning.
This commit is contained in:
@@ -154,18 +154,32 @@ Blockly.HorizontalFlyout.prototype.position = function() {
|
||||
|
||||
// X is always 0 since this is a horizontal flyout.
|
||||
var x = 0;
|
||||
// If there is a toolbox.
|
||||
if (targetWorkspaceMetrics.toolboxHeight) {
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP) {
|
||||
var y = targetWorkspaceMetrics.toolboxHeight;
|
||||
// If this flyout is the toolbox flyout.
|
||||
if (targetWorkspaceMetrics.toolboxPosition == this.toolboxPosition_) {
|
||||
// If there is a toolbox.
|
||||
if (targetWorkspaceMetrics.toolboxHeight) {
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP) {
|
||||
var y = targetWorkspaceMetrics.toolboxHeight;
|
||||
} else {
|
||||
var y = targetWorkspaceMetrics.viewHeight - this.height_;
|
||||
}
|
||||
} else {
|
||||
var y = targetWorkspaceMetrics.viewHeight - this.height_;
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP) {
|
||||
var y = 0;
|
||||
} else {
|
||||
var y = targetWorkspaceMetrics.viewHeight;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP) {
|
||||
var y = 0;
|
||||
} else {
|
||||
var y = targetWorkspaceMetrics.viewHeight;
|
||||
// Because the anchor point of the flyout is on the top, but we want
|
||||
// to align the bottom edge of the flyout with the bottom edge of the
|
||||
// blocklyDiv, we calculate the full height of the div minus the height
|
||||
// of the flyout.
|
||||
var y = targetWorkspaceMetrics.viewHeight
|
||||
+ targetWorkspaceMetrics.absoluteTop - this.height_;
|
||||
}
|
||||
}
|
||||
this.positionAt_(this.width_, this.height_, x, y);
|
||||
|
||||
@@ -151,18 +151,32 @@ Blockly.VerticalFlyout.prototype.position = function() {
|
||||
|
||||
// Y is always 0 since this is a vertical flyout.
|
||||
var y = 0;
|
||||
// If there is a toolbox.
|
||||
if (targetWorkspaceMetrics.toolboxWidth) {
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_LEFT) {
|
||||
var x = targetWorkspaceMetrics.toolboxWidth;
|
||||
// If this flyout is the toolbox flyout.
|
||||
if (targetWorkspaceMetrics.toolboxPosition == this.toolboxPosition_) {
|
||||
// If there is a category toolbox.
|
||||
if (targetWorkspaceMetrics.toolboxWidth) {
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_LEFT) {
|
||||
var x = targetWorkspaceMetrics.toolboxWidth;
|
||||
} else {
|
||||
var x = targetWorkspaceMetrics.viewWidth - this.width_;
|
||||
}
|
||||
} else {
|
||||
var x = targetWorkspaceMetrics.viewWidth - this.width_;
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_LEFT) {
|
||||
var x = 0;
|
||||
} else {
|
||||
var x = targetWorkspaceMetrics.viewWidth;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.toolboxPosition_ == Blockly.TOOLBOX_AT_LEFT) {
|
||||
var x = 0;
|
||||
} else {
|
||||
var x = targetWorkspaceMetrics.viewWidth;
|
||||
// Because the anchor point of the flyout is on the left, but we want
|
||||
// to align the right edge of the flyout with the right edge of the
|
||||
// blocklyDiv, we calculate the full width of the div minus the width
|
||||
// of the flyout.
|
||||
var x = targetWorkspaceMetrics.viewWidth
|
||||
+ targetWorkspaceMetrics.absoluteLeft - this.width_;
|
||||
}
|
||||
}
|
||||
this.positionAt_(this.width_, this.height_, x, y);
|
||||
|
||||
Reference in New Issue
Block a user