mirror of
https://github.com/google/blockly.git
synced 2026-01-26 18:20:10 +01:00
Add method for changing scrollbar visibility
This commit is contained in:
@@ -711,7 +711,9 @@ Blockly.Flyout.prototype.updateDisplay_ = function() {
|
||||
this.svgGroup_.style.display = show ? 'block' : 'none';
|
||||
// Update the scrollbar's visiblity too since it should mimic the
|
||||
// flyout's visibility.
|
||||
this.scrollbar_.setContainerVisible(show);
|
||||
if (this.scrollbar_) {
|
||||
this.scrollbar_.setContainerVisible(show);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -721,7 +723,9 @@ Blockly.Flyout.prototype.hide = function() {
|
||||
if (!this.isVisible()) {
|
||||
return;
|
||||
}
|
||||
Blockly.mainWorkspace.scrollbar.setContainerVisible(true);
|
||||
if (Blockly.mainWorkspace) {
|
||||
Blockly.mainWorkspace.setScrollbarsVisible(true);
|
||||
}
|
||||
this.setVisible(false);
|
||||
// Delete all the event listeners.
|
||||
for (var x = 0, listen; listen = this.listeners_[x]; x++) {
|
||||
@@ -742,7 +746,9 @@ Blockly.Flyout.prototype.hide = function() {
|
||||
* Variables and procedures have a custom set of blocks.
|
||||
*/
|
||||
Blockly.Flyout.prototype.show = function(xmlList) {
|
||||
Blockly.mainWorkspace.scrollbar.setContainerVisible(false); // hide parent's scrollbars
|
||||
if (Blockly.mainWorkspace) {
|
||||
Blockly.mainWorkspace.setScrollbarsVisible(false); // hide parent's scrollbars
|
||||
}
|
||||
this.workspace_.setResizesEnabled(false);
|
||||
this.hide();
|
||||
this.clearOldBlocks_();
|
||||
|
||||
@@ -1671,6 +1671,15 @@ Blockly.WorkspaceSvg.prototype.getButtonCallback = function(key) {
|
||||
return this.flyoutButtonCallbacks_[key];
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience method to hide the scrollbars on the workspace. This method has
|
||||
* no effect if the workspace's options had scrollbars set to false.
|
||||
* @param {boolean} visible true to show the scrollbars, otherwise false.
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.setScrollbarsVisible = function(visible) {
|
||||
this.scrollbar && this.scrollbar.setContainerVisible(visible)
|
||||
};
|
||||
|
||||
// Export symbols that would otherwise be renamed by Closure compiler.
|
||||
Blockly.WorkspaceSvg.prototype['setVisible'] =
|
||||
Blockly.WorkspaceSvg.prototype.setVisible;
|
||||
|
||||
Reference in New Issue
Block a user