mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
@@ -208,7 +208,7 @@ Blockly.FieldMultilineInput.prototype.updateSize_ = function() {
|
||||
*/
|
||||
Blockly.FieldMultilineInput.prototype.widgetCreate_ = function() {
|
||||
var div = Blockly.WidgetDiv.DIV;
|
||||
var scale = this.workspace_.scale;
|
||||
var scale = this.workspace_.getScale();
|
||||
|
||||
var htmlInput =
|
||||
/** @type {HTMLTextAreaElement} */ (document.createElement('textarea'));
|
||||
|
||||
@@ -330,7 +330,7 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() {
|
||||
var htmlInput = /** @type {HTMLInputElement} */ (document.createElement('input'));
|
||||
htmlInput.className = 'blocklyHtmlInput';
|
||||
htmlInput.setAttribute('spellcheck', this.spellcheck_);
|
||||
var scale = this.workspace_.scale;
|
||||
var scale = this.workspace_.getScale();
|
||||
var fontSize =
|
||||
(this.getConstants().FIELD_TEXT_FONTSIZE * scale) + 'pt';
|
||||
div.style.fontSize = fontSize;
|
||||
|
||||
@@ -2152,6 +2152,19 @@ Blockly.WorkspaceSvg.prototype.setScale = function(newScale) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the workspace's zoom factor. If the workspace has a parent, we call into
|
||||
* the parent to get the workspace scale.
|
||||
* @return {number} The workspace zoom factor. Units: (pixels / workspaceUnit).
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.getScale = function() {
|
||||
if (this.options.parentWorkspace) {
|
||||
return this.options.parentWorkspace.getScale();
|
||||
}
|
||||
return this.scale;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scroll the workspace to a specified offset (in pixels), keeping in the
|
||||
* workspace bounds. See comment on workspaceSvg.scrollX for more detail on
|
||||
|
||||
@@ -217,7 +217,9 @@ suite('Text Input Fields', function() {
|
||||
setup(function() {
|
||||
this.prepField = function(field) {
|
||||
var workspace = {
|
||||
scale: 1,
|
||||
getScale: function() {
|
||||
return 1;
|
||||
},
|
||||
getRenderer: function() { return {
|
||||
getClassName: function() { return ''; }
|
||||
}; },
|
||||
|
||||
Reference in New Issue
Block a user