mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
[zelos] Output connection position (#3516)
* Move connection point for output connections to the left and centerline
This commit is contained in:
@@ -392,11 +392,12 @@ Blockly.blockRendering.Drawer.prototype.positionInlineInputConnection_ = functio
|
||||
// Move the connection.
|
||||
if (input.connection) {
|
||||
// xPos already contains info about startX
|
||||
var connX = input.xPos + input.connectionWidth;
|
||||
var connX = input.xPos + input.connectionWidth + input.connectionOffsetX;
|
||||
if (this.info_.RTL) {
|
||||
connX *= -1;
|
||||
}
|
||||
input.connection.setOffsetInBlock(connX, yPos + input.connectionOffsetY);
|
||||
input.connection.setOffsetInBlock(connX,
|
||||
yPos + input.connectionOffsetY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -471,7 +472,7 @@ Blockly.blockRendering.Drawer.prototype.positionNextConnection_ = function() {
|
||||
*/
|
||||
Blockly.blockRendering.Drawer.prototype.positionOutputConnection_ = function() {
|
||||
if (this.info_.outputConnection) {
|
||||
var x = this.info_.startX;
|
||||
var x = this.info_.startX + this.info_.outputConnection.connectionOffsetX;
|
||||
var connX = this.info_.RTL ? -x : x;
|
||||
this.block_.outputConnection.setOffsetInBlock(connX,
|
||||
this.info_.outputConnection.connectionOffsetY);
|
||||
|
||||
@@ -74,6 +74,7 @@ Blockly.blockRendering.OutputConnection = function(constants, connectionModel) {
|
||||
this.startX = this.width;
|
||||
|
||||
this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;
|
||||
this.connectionOffsetX = 0;
|
||||
};
|
||||
Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,
|
||||
Blockly.blockRendering.Connection);
|
||||
|
||||
@@ -97,13 +97,18 @@ Blockly.blockRendering.InlineInput = function(constants, input) {
|
||||
this.height = this.connectedBlockHeight;
|
||||
}
|
||||
|
||||
this.connectionHeight = this.shape.height;
|
||||
this.connectionHeight = !this.isDynamicShape ? this.shape.height :
|
||||
this.shape.height(this.height);
|
||||
this.connectionWidth = !this.isDynamicShape ? this.shape.width :
|
||||
this.shape.width(this.height);
|
||||
this.shape.width(this.height);
|
||||
if (!this.connectedBlock) {
|
||||
this.width += this.connectionWidth * (this.isDynamicShape ? 2 : 1);
|
||||
}
|
||||
this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;
|
||||
this.connectionOffsetY = this.isDynamicShape ?
|
||||
this.shape.connectionOffsetY(this.connectionHeight) :
|
||||
this.constants_.TAB_OFFSET_FROM_TOP;
|
||||
this.connectionOffsetX = this.isDynamicShape ?
|
||||
this.shape.connectionOffsetX(this.connectionWidth) : 0;
|
||||
};
|
||||
Blockly.utils.object.inherits(Blockly.blockRendering.InlineInput,
|
||||
Blockly.blockRendering.InputConnection);
|
||||
|
||||
@@ -444,6 +444,12 @@ Blockly.zelos.ConstantProvider.prototype.makeHexagonal = function() {
|
||||
height: function(height) {
|
||||
return height;
|
||||
},
|
||||
connectionOffsetY: function(connectionHeight) {
|
||||
return connectionHeight / 2;
|
||||
},
|
||||
connectionOffsetX: function(connectionWidth) {
|
||||
return - connectionWidth;
|
||||
},
|
||||
pathDown: function(height) {
|
||||
return makeMainPath(height, false, false);
|
||||
},
|
||||
@@ -483,6 +489,12 @@ Blockly.zelos.ConstantProvider.prototype.makeRounded = function() {
|
||||
height: function(height) {
|
||||
return height;
|
||||
},
|
||||
connectionOffsetY: function(connectionHeight) {
|
||||
return connectionHeight / 2;
|
||||
},
|
||||
connectionOffsetX: function(connectionWidth) {
|
||||
return - connectionWidth;
|
||||
},
|
||||
pathDown: function(height) {
|
||||
return makeMainPath(height, false, false);
|
||||
},
|
||||
|
||||
@@ -295,6 +295,10 @@ Blockly.zelos.RenderInfo.prototype.finalizeOutputConnection_ = function() {
|
||||
this.outputConnection.height = connectionHeight;
|
||||
this.outputConnection.width = connectionWidth;
|
||||
this.outputConnection.startX = connectionWidth;
|
||||
this.outputConnection.connectionOffsetY =
|
||||
this.outputConnection.shape.connectionOffsetY(connectionHeight);
|
||||
this.outputConnection.connectionOffsetX =
|
||||
this.outputConnection.shape.connectionOffsetX(connectionWidth);
|
||||
|
||||
// Adjust right side measurable.
|
||||
this.rightSide.height = connectionHeight;
|
||||
|
||||
Reference in New Issue
Block a user