mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Add zooming feature.
By carloslfu.
This commit is contained in:
@@ -98,7 +98,7 @@ Blockly.Field.prototype.init = function(block) {
|
||||
'ry': 4,
|
||||
'x': -Blockly.BlockSvg.SEP_SPACE_X / 2,
|
||||
'y': -12,
|
||||
'height': 16}, this.fieldGroup_);
|
||||
'height': 16}, this.fieldGroup_, this.sourceBlock_.workspace);
|
||||
this.textElement_ = Blockly.createSvgElement('text',
|
||||
{'class': 'blocklyText'}, this.fieldGroup_);
|
||||
|
||||
@@ -224,6 +224,18 @@ Blockly.Field.prototype.getSize = function() {
|
||||
return this.size_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the height and width of the field,
|
||||
* accounting for the workspace scaling.
|
||||
* @return {!Object} Height and width.
|
||||
*/
|
||||
Blockly.Field.prototype.getScaledBBox_ = function() {
|
||||
var bBox = this.borderRect_.getBBox();
|
||||
bBox.width *= this.sourceBlock_.workspace.scale;
|
||||
bBox.height *= this.sourceBlock_.workspace.scale;
|
||||
return bBox;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the text from this field.
|
||||
* @return {string} Current text.
|
||||
|
||||
Reference in New Issue
Block a user