mirror of
https://github.com/google/blockly.git
synced 2026-01-16 13:27:09 +01:00
Add issue to todo and getter for isVisible on workspace
This commit is contained in:
@@ -172,11 +172,11 @@ Blockly.svgResize = function(workspace) {
|
||||
* @param {!Event} e Key down event.
|
||||
* @private
|
||||
*/
|
||||
// TODO handle cases where there are multiple workspaces and non-main workspaces are able to accept
|
||||
// input.
|
||||
// TODO (https://github.com/google/blockly/issues/1998) handle cases where there are multiple workspaces
|
||||
// and non-main workspaces are able to accept input.
|
||||
Blockly.onKeyDown_ = function(e) {
|
||||
if (Blockly.mainWorkspace.options.readOnly || Blockly.utils.isTargetInput(e)
|
||||
|| (Blockly.mainWorkspace.rendered && !Blockly.mainWorkspace.isVisible)) {
|
||||
|| (Blockly.mainWorkspace.rendered && !Blockly.mainWorkspace.isVisible())) {
|
||||
// No key actions on readonly workspaces.
|
||||
// When focused on an HTML text input widget, don't trap any keys.
|
||||
// Ignore keypresses on rendered workspaces that have been explicitly
|
||||
|
||||
@@ -139,11 +139,11 @@ Blockly.WorkspaceSvg.prototype.rendered = true;
|
||||
|
||||
/**
|
||||
* Whether the workspace is visible. False if the workspace has been hidden
|
||||
* by calling `setVisisble(false)`.
|
||||
* by calling `setVisible(false)`.
|
||||
* @type {boolean}
|
||||
* @package
|
||||
* @private
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.isVisible = true;
|
||||
Blockly.WorkspaceSvg.prototype.isVisible_ = true;
|
||||
|
||||
/**
|
||||
* Is this workspace the surface for a flyout?
|
||||
@@ -342,6 +342,15 @@ Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM = function() {
|
||||
this.inverseScreenCTMDirty_ = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Getter for isVisible
|
||||
* @return {boolean} Whether the workspace is visible. False if the workspace has been hidden
|
||||
* by calling `setVisible(false)`.
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.isVisible = function() {
|
||||
return this.isVisible_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the absolute coordinates of the top-left corner of this element,
|
||||
* scales that after canvas SVG element, if it's a descendant.
|
||||
@@ -890,7 +899,7 @@ Blockly.WorkspaceSvg.prototype.setVisible = function(isVisible) {
|
||||
} else {
|
||||
Blockly.hideChaff(true);
|
||||
}
|
||||
this.isVisible = isVisible;
|
||||
this.isVisible_ = isVisible;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user